-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Save intermediate populations to file to enable restarting #59
Comments
Any implementation of this should probably coordinate with #39 |
Hi! Sure any kind of contribution is appreciated. An easy way for saving the current status of an optimization process could be great; however, restarting the optimization (after an unexpected stopping) may require some considerations:
I would prefer to use BSON due to is lighter and faster than JDL2, as far as I remember. Regarding your idea, I have two possible implementations for you: 1. Using method = ECA(options = Options(save_every = 10)) # to save every 10 generations/iterations
optimize(f, bounds, method) A possible autogenerated file structure:
Where the BSON file would save a dictionary containing everything saved in To restart, the API would check for the existence of an existing file at 2. Wrapping the optimizers: The idea here is to define a wrapper solver = BackUp(ECA(), every = 10, at = "my-back-up-file.bson")
optimize(f, bounds, solver) Here, the API would check for the existence of an existing file at Names for the possible wrapper: "BackUp", "Save", "StoreTraces", ... |
This is a feature request and I'm not sure whether you're interested in including it in your package
For optimizing heavy-ish functions, sometimes computer stuff happens. It would be great to have an easy API for saving intermediate populations to file so that if computation is interrupted, it's possible to pick up from about where it left off.
I think this should be pretty easy to do and I'm happy to try to help out with a first stab PR (may take a while, next few weeks are busy, and will probably need some additional work) but wanted to check in on what that API and implementation might look like.
API: this seems like it might go in
Options()
. I'm not sure what the keyword arguments should be named, but it seems like there should be an option to save results everyN
iterations (defaults to Inf/missing/similar that gives current behavior). Additionally, I think making the user define the filename to use for caching would make sense.Implementation: Every
N
iterations, use JDL2 to save the result fromoptimize
.optimize
would need to check for the existence of an existing file -- to load in from file, an approach similar to that given in https://jmejia8.github.io/Metaheuristics.jl/stable/examples/#Providing-Initial-Solutions should work.The text was updated successfully, but these errors were encountered: