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

TargetFitness? #209

Open
MA-Kochen opened this issue Feb 5, 2023 · 6 comments
Open

TargetFitness? #209

MA-Kochen opened this issue Feb 5, 2023 · 6 comments

Comments

@MA-Kochen
Copy link

MA-Kochen commented Feb 5, 2023

Hello,

I am optimizing systems of differential equations (in the form of simulatable SBML models). The objective function takes the difference between a set of data and the simulated trace for the species in the model. Setting TargetFitness seems to have no effect. When running something like

bboptimize(objective; SearchRange=sample_distributions, PopulationSize=50, TargetFitness=100.0)

it blows through the target fitness and runs until the max step limit is reached. The output looks something like

Optimization stopped after 10001 steps and 1.47 seconds
Termination reason: Max number of steps (10000) reached
Steps per second = 6803.36
Function evals per second = 6885.00
Improvements/step = 0.23490
Total function evaluations = 10121
Best candidate found: [-2.17269e-8, -2.0, -0.522879]
Fitness: 0.000000001

Am I missing something here?

@robertfeldt
Copy link
Owner

Thanks for reporting this. It does seem like this is not properly implemented, yes. Should be a big thing though. So the functionality you would expect is that if it reaches a fitness <= the TargetFitness the optimization terminates and the result is returned? I need to check how other optimization packages does this so we can try to stay close in naming and behavior.

@robertfeldt
Copy link
Owner

"Shouldn't be a big thing though", is what I meant. ;)

@robertfeldt
Copy link
Owner

Actually, there is a way you can do this yourself via a callback function. Please see the test code from line 239 in this file for an example:

https://github.com/robertfeldt/BlackBoxOptim.jl/blob/master/test/test_toplevel_bboptimize.jl

@MA-Kochen
Copy link
Author

"So the functionality you would expect is that if it reaches a fitness <= the TargetFitness the optimization terminates and the result is returned? " Yes, that is what I would expect. I'll take a look at that test code.

@MA-Kochen
Copy link
Author

Can confirm that the callback function works. Thanks!

@robertfeldt
Copy link
Owner

Great. Note that you don't need to set CallbackInterval to zero (since it is a bit inefficient since it then call the callback every step of the optimization. If you set it to 1.0 or so it will stop the optimization within one second of reaching the target etc.

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