-
Notifications
You must be signed in to change notification settings - Fork 117
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
Stopping criteria #64
Conversation
Seems that the static analysis is failing for |
@leonlan thanks for your PR. I just left some comments, but overall this already looks pretty good to me.
Thanks for letting me know about this! I have a style that I use, but that style can best be described as "tweaked over the years and baked into my editor". I do not have a formal document describing it, so I will not hold you to what I think looks good. I will look into standardising the style for ALNS sometime soon! |
Codecov Report
@@ Coverage Diff @@
## master #64 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 19 +4
Lines 322 367 +45
=========================================
+ Hits 322 367 +45
Continue to review full report at Codecov.
|
@leonlan thanks for the PR and your hard work! I will release this in a few days as v3.0.0. I have to bump the major since this is a breaking change. |
Thanks to you for the helpful feedback as well! I make extensive use of ALNS and I’m really grateful for the wonderful package that you wrote! I’m happy that I could contribute and I hope to make more contributions in the near future as I get to it (e.g., I’ll soon start with integrated problems so #57 is on my radar). One last thing, should I also rewrite the examples/docs or do you want to do that yourself? |
Good to hear! I am happy you find it useful. You are more than welcome to have a look at #57 - it should be fairly straightforward to implement. Further, as a fellow user of (and now contributor to!) the library: if there are things you cannot yet do with the current package that you would like to see included, feel free to open an issue to discuss those things further!
I have that on my list, no worries! Master is a bit inconsistent now, but I will fix that with the next release. |
Related issue: #62
I had more free time than I predicted :-).
The changes I made mainly follow the same implementation style of the acceptance criteria.
Changes
StoppingCriterion
class and provide two default criteriaMaxIterations
andMaxRuntime
ALNS.iterate
interface to takestop: StoppingCriterion
parameter as input instead ofiterations: int
Motivation behind the
StoppingCriterion
interface:In particular:
StoppingCriterion.__call__(self, best: State, current: State)
I searched through the Handbook of Metaheuristics (2019) for termination criteria possibilities. Section 2.3.7. on Tabu Search - Termination criteria gives the following examples:
I based my implementation to take into account these points. The first point is addressed by the implementation of
MaxIterations
andMaxRuntime
. The second and third point can be implemented based on this interface, which would not have been possible if__call__
does not accept the best and current solution.Remarks
pyproject.toml
.