You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom brancher cannot be implemented because type Assignments is not public. #309
Pumpkin-solver version 0.2.1
I would like to implement my own brancher therefore I need to implement function fn synchronise(&mut self, _assignments: &Assignments) but Assignments is not public.
That seems to be an oversight on our part. I will have a look at this next week with a resolution.
The reason we keep the Assignments private is that we are continually changing its interface. That would mean breaking compatibility regularly. However, there is a stable core that we could make public. Could you tell us what you would need from Assignments to implement your brancher?
I discovered this issue while implementing Brancher trait but actually I don't need to re-implement the sync method and I can rely on the default implementation.
I just wanted to contribute to the project by notifying this inconsistency.
However maybe you interested in my use case and why I am implementing Brancher trait.
Presently I am evaluating the usage of Pumpkin solver for an application at my company:
This application has a GUI where the user can decide to fix a parameter and let the other to be decided by the solver.
Parameters not fixed by user could have a drop down list with available choices or the possible range is shown.
When user change value or remove a fixed value, the GUI need to be updated.
To solve I use the method satisfy_under_assumptions and I would like to get the ranges of not fixed variables after the assumption instantiation but the before the solution.
Therefore I encapsulate brancher in a type to intercept the range on first invocation of next_decision
In my experience this use case is quite common and maybe you are interested to support in easier way.
I would suggest to support also more generic constraint as assumption.
Other solver as ECLiPSe or Choco4 has the capability to post temporary a constraint and then remove it.
I discovered this issue while implementing Brancher trait but actually I don't need to re-implement the sync method and I can rely on the default implementation.
I just wanted to contribute to the project by notifying this inconsistency.
Alright, that is good to know. Thank you for the notification. I hope to push a fix this week.
To solve I use the method satisfy_under_assumptions and I would like to get the ranges of not fixed variables after the assumption instantiation but the before the solution.
That is an interesting use case, and indeed, there is no convenient way to get that information. It is interesting for us to figure out what a good API for this would be.
I would suggest to support also more generic constraint as assumption.
That is a good suggestion, which we may look into in the future. Although we currently do not have a direct use-case for it, so I am not sure when we will find the time to implement that feature.
Question about the use case @pellico. You have a set of assumptions A, and you would like to get information about the domains of all/some variables after assumptions A have been posted by the solver (including propagation), just before the solver would start solving the problem? Did I understand this correctly?
About posting constraints temporarily. We can simulate this by creating a new Boolean B and posting a half-reified constraint "B -> constraint", and then one can solve under assumptions to enable/disable constraints. But we have not used this extensively so far.
Activity
maartenflippo commentedon Oct 30, 2025
That seems to be an oversight on our part. I will have a look at this next week with a resolution.
The reason we keep the
Assignmentsprivate is that we are continually changing its interface. That would mean breaking compatibility regularly. However, there is a stable core that we could make public. Could you tell us what you would need fromAssignmentsto implement your brancher?@ImkoMarijnissen what do you think of this?
pellico commentedon Nov 1, 2025
I discovered this issue while implementing Brancher trait but actually I don't need to re-implement the
syncmethod and I can rely on the default implementation.I just wanted to contribute to the project by notifying this inconsistency.
However maybe you interested in my use case and why I am implementing Brancher trait.
Presently I am evaluating the usage of Pumpkin solver for an application at my company:
To solve I use the method
satisfy_under_assumptionsand I would like to get the ranges of not fixed variables after the assumption instantiation but the before the solution.Therefore I encapsulate brancher in a type to intercept the range on first invocation of
next_decisionIn my experience this use case is quite common and maybe you are interested to support in easier way.
I would suggest to support also more generic constraint as assumption.
Other solver as ECLiPSe or Choco4 has the capability to post temporary a constraint and then remove it.
maartenflippo commentedon Nov 3, 2025
Alright, that is good to know. Thank you for the notification. I hope to push a fix this week.
That is an interesting use case, and indeed, there is no convenient way to get that information. It is interesting for us to figure out what a good API for this would be.
That is a good suggestion, which we may look into in the future. Although we currently do not have a direct use-case for it, so I am not sure when we will find the time to implement that feature.
fix: Provide `SelectionContext` instead of `Assignments` to `Brancher…
maartenflippo commentedon Nov 11, 2025
This is fixed in the latest release of pumpkin
EmirDe commentedon Nov 11, 2025
Question about the use case @pellico. You have a set of assumptions A, and you would like to get information about the domains of all/some variables after assumptions A have been posted by the solver (including propagation), just before the solver would start solving the problem? Did I understand this correctly?
About posting constraints temporarily. We can simulate this by creating a new Boolean B and posting a half-reified constraint "B -> constraint", and then one can solve under assumptions to enable/disable constraints. But we have not used this extensively so far.