Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to define new optimization object? #93

Open
wyattxuanyang opened this issue Jan 1, 2025 · 1 comment
Open

Question: how to define new optimization object? #93

wyattxuanyang opened this issue Jan 1, 2025 · 1 comment

Comments

@wyattxuanyang
Copy link

Thank you for your great work!

After writing a new Specification class with a "evaluate" method under the folder dnachisel/builtin_specifications(for eg. my_new_optimization_goal.py, similar to EnforceGCContent.py), what else should be done so that my DnaOptimizationProblem can directly use it in a way like
objectives = [my_new_optimization_goal(xxx=, xxx=), CodonOptimize(species='e_coli', location=(500, 1400))]?
Or I just have to put the new class somewhere else?

Thanks,
Wyatt

@Zulko
Copy link
Member

Zulko commented Jan 1, 2025

Defining evaluate() should be sufficient, although some other methods can additionally be redefined for your new objective if necessary (__str__, localized, initialized_on_problem).

Note that the new optimization objective does NOT need to be added to the library code in builtin_specifications/, it can simply be in the same file or notebook as the rest of your script (see an example here where a new MinimizeNinemersScore is defined just before being used).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants