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

Resuming optimization from result object #641

Open
Leviathan321 opened this issue Sep 11, 2024 · 1 comment
Open

Resuming optimization from result object #641

Leviathan321 opened this issue Sep 11, 2024 · 1 comment
Assignees

Comments

@Leviathan321
Copy link

Leviathan321 commented Sep 11, 2024

I have executed an optimization run, and backed up the result object using dill as proposed in the Tutorial. Let say it executed 2 iterations. As checkpoint I use the last algorithm object of its history.

When I want to resume the search for a number of generations, let say 3, I encounter that the new result object has more algorithm objects in each history then the number of iterations. While it should have 5 algorithm objects, it does have 6. So it does one additional iteration. In addition, the very last generation is lost/overwritten from the previous search.

Is there anything wrong with my code?

termination = ...
history = result.history
problem = result.problem

checkpoint_algo = result.history[-1]
checkpoint_algo.start_time = time.time() - previous_exec_time
checkpoint_algo.termination = termination

# reset
checkpoint_algo.problem = None

res: ResultExtended = minimize(problem,
                checkpoint_algo,
                termination,
                save_history=True,
                copy_algorithm=True,
                verbose=True,
                callback=Callback(),
                history=history)
@blankjul blankjul self-assigned this Sep 22, 2024
@blankjul
Copy link
Collaborator

blankjul commented Sep 22, 2024

What checkpointing method are you using? The object oriented from here?
https://pymoo.org/misc/checkpoint.html?highlight=checkpoint#Object-Oriented

Can you provide a short example for me to reproduce the gap in history?
Would a simple algorithm.history.append(deepcopy(algorthm)) or something similar solve your issue?

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