Giter Site home page Giter Site logo

Comments (6)

N-Wouda avatar N-Wouda commented on August 26, 2024 1

I've already hacked through the entire ALNS class for my research :-)

shame

😄

from alns.

N-Wouda avatar N-Wouda commented on August 26, 2024

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.

leonlan avatar leonlan commented on August 26, 2024

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.

N-Wouda avatar N-Wouda commented on August 26, 2024

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.

leonlan avatar leonlan commented on August 26, 2024

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.

N-Wouda avatar N-Wouda commented on August 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.