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

Consider more complex propagator notifications (and queueing) #116

Open
Dekker1 opened this issue Sep 10, 2024 · 0 comments
Open

Consider more complex propagator notifications (and queueing) #116

Dekker1 opened this issue Sep 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Dekker1
Copy link
Contributor

Dekker1 commented Sep 10, 2024

Background

The Propagator trait previously included a notify_event:

  • The method was signalled of a change in a subscribed variable
  • The method returned whether the propagator should be enqueue

The idea behind this method was that a propagator could pre-empt the different parts of the propagation algorithm it would need to activate. However, to ensure this mechanism works correctly, all changes must be signalled to the propagator.

We removed the notify_event method because most notify_event implementations simply returned true, and calling a virtual method every time seemed like a large overhead. In addition the implementation did not signal all events, but only the events until the propagator was enqueued (i.e., the method returned true). This meant that some propagation algorithms would likely be faulty when stressed.

Proposal

We can re-evaluate a new interface for notify_event that works in addition to the standard enqueueing system. My intuition says that some propagators, like AllDifferentValue, IntLinearNotEqValue, and ArrayVarIntElementBounds, might benefit from more fine-grained activation and/or partially activated propagation algorithm.

It should, however, be noted that theoretically the improvement is at most linear. The propagation algorithm could always first walk over all its variables to see what the changes are.

My plan would be to:

  1. Re-introduce the Propagator::notify_event method, possibly with access to InspectionActions.
  2. Introduce an additional InitializationActions::subscribe_<type> that signals to the solver which changes the notify_event method will always be called
    • This is in addition to the InitializationActions::enqueue_on_<type>_change that will always enqueue a propagator when an event happens
  3. Change the engine to walk a (separate) list of subscriptions to call the notify_event method.
  4. Implement the mechanism for 2 or 3 propagators to measure its effectiveness.

Evaluation: We should ensure that there to gather and run benchmarks that exercise the propagators that we intent to change and that they are merged/run before changing the propagators.

@Dekker1 Dekker1 added the enhancement New feature or request label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant