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

Simulated annealing: bug in run method #11

Open
nelimee opened this issue Mar 14, 2020 · 0 comments
Open

Simulated annealing: bug in run method #11

nelimee opened this issue Mar 14, 2020 · 0 comments

Comments

@nelimee
Copy link

nelimee commented Mar 14, 2020

Description of the bug

The run() method of the SimulatedAnnealing class has a bug when the annealing method does not find a better state than the initial one.

When does it happens

The bug happens when the annealing algorithm fails to find a better state than the initial one. This can happen when the maximum number of steps is low or when the initial guess is already very good.

What is the current behaviour

The tuple returned by the run() method is (None, cost_of_initial_state).

How to fix

Add the line

self.best_state = deepcopy(self.current_state)

between L142 and L143.

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

1 participant