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

Custom cooling function #9

Merged
merged 7 commits into from
Feb 7, 2022
Merged

Conversation

chrisbloom7
Copy link
Collaborator

What

Adds a custom cool down function as outline in #1.

Closes #1

Why

Simulator#cool_down provides a linear temperature reduction algorithm, but simulated annealing is not always linear. There are allowances in the definition for raising, lowering, and holding the temperature until certain conditions are met. It would be useful to provide a way to specify a custom cooling method that takes the current energy, temperature, and number of steps the algorithm has performed so far, and returns the new temperature, such that it could operate linearly, geometrically, exponentially, or based on some other custom formula with the current state in mind. It would use the linear Simulator#cool_down as the default.

How

  • Adds a new cool_down configuration option which defaults to a linear reduction function
  • Updates Annealing::Simulator to call either the global cool_down method or one passes in at run time
  • Refactors some tests to exercise their scenarios more directly.

@chrisbloom7 chrisbloom7 requested a review from 3zcurdia February 6, 2022 03:33
@chrisbloom7 chrisbloom7 self-assigned this Feb 6, 2022
Copy link
Owner

@3zcurdia 3zcurdia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@3zcurdia 3zcurdia merged commit c5e0184 into metal-has-temperature Feb 7, 2022
@3zcurdia 3zcurdia deleted the custom-cooling-function branch February 7, 2022 13:53
3zcurdia added a commit that referenced this pull request Feb 7, 2022
* Metal should know its temperature

* Custom cooling function (#9)

* Add debug gem for development and testing

* Use linear cooling function by default

* Add cool down function config option

* Do not convert cooling rate to negative number

* Add customizable cool_down function

* Add cool_down function to README

* Clean up metal interface

* Update strings at lib/annealing/simulator.rb

* Update strings at lib/annealing/simulator.rb:21

* Update strings at lib/annealing/simulator.rb:23

* Update strings at test/annealing/simulator_test.rb:42

* Update strings at test/annealing/simulator_test.rb:49

* Update strings at test/annealing/simulator_test.rb:57

Co-authored-by: Luis Ezcurdia <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants