Comments (6)
I've already hacked through the entire ALNS class for my research :-)
😄
from alns.
I am not opposed to such callbacks, but: what's stopping you from writing your own AcceptanceCriterion that does both?
Minimal example:
from alns.accept import HillClimbing
class MyAcceptanceCriterion(HillClimbing):
def __call__(..., cand, ...):
<do after_repair around candidate>
if accept := super().__call__(..., cand, ...): # modified candidate was accepted
<do on_accept around candidate>
return accept
In both cases you can, as far as I can tell, freely modify the passed-in candidate argument without having to worry about copying anything.
from alns.
Nothing is stopping me personally since I've already hacked through the entire ALNS class for my research :-). That's indeed a good suggestion which covers the proposed implementations.
from alns.
But that's OK. Clearly there's some demand for callbacks and such then - I believed in #30 that there was not. I will leave this issue open to revisit at some point in the near future!
from alns.
After some experimenting, I no longer think it's beneficial to have more callbacks in ALNS.
As you said before, the acceptance criterion can be easily modified to apply local search after repair/on accept. This same principle can be also applied directly to destroy/repair operators, e.g., by decorating the operators.
I think it's good to keep the ALNS class as simple as possible. Rather than adding more callbacks to the ALNS class, the current implementation provides enough flexibility for the user to define their own callbacks through the destroy/repair and acceptance criteria interfaces. These use cases can be demonstrated in the documentation/cookbook (#88).
Feel free to close the issue if you agree/have no other remarks.
from alns.
This same principle can be also applied directly to destroy/repair operators, e.g., by decorating the operators.
I agree. The paper you referenced having a destroy-local search-repair cycle is completely equivalent to (destroy + local search)-repair, or destroy-(local search + repair). I think we are better off not adding all sorts of callbacks for these things into the library, but instead push those ideas off into user code.
These use cases can be demonstrated in the documentation/cookbook (#88).
Sounds like a good idea to me. We can definitely document some common 'callback use cases' there, and the recommended way to do that in the library.
I am open to adding new callbacks when something is hard to do currently. But I cannot think of anything right now. So I will wait until there's a concrete use case :-).
from alns.
Related Issues (20)
- Some quetions for using ALNS HOT 5
- Adaptive simulated annealing temperature and step-size HOT 4
- what's your alns.weights HOT 1
- Update docs
- Tasklist for next release HOT 2
- About other VRP destroy and repair operators HOT 3
- Bug in `examples/resource_constrained_project_scheduling_problem.ipynb:random_insert`?
- Circle bin packing with ALNS HOT 21
- Run example notebooks in CI HOT 1
- Deprecate AlphaUCB?
- How to solve vehicle routing problem with multiple capacities? HOT 5
- Documentation improvements HOT 2
- RCPSP示例中的“instance = ProblemData.read_instance('data/j9041_6.sm')”的数据在哪里 HOT 1
- Where is the data for "instance = ProblemData.read_instance('data/j9041_6.sm')" in the RCPSP example HOT 3
- Run w/o MABwiser in the CI
- Rename RandomWalk and WorseAccept? HOT 2
- Replace `RandomState` with `Generator` HOT 2
- Python 3.12 release
- Require help in understanding and coding the ALNS algorithm using alns package HOT 2
- ALNS parameter optimization HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alns.