Conversation
IgnaceBleukx
left a comment
There was a problem hiding this comment.
This will be very useful!
Ideally add some tests, I came up with some tests for a (future) generic callbacking system in #558; you could steal some from there.
|
Stole your callback test and its succeeds. But I can't really add it in this PR, since it requires some out-of-scope changes, e.g. to make the test also properly work for other solvers. Will become a different PR. |
|
When I look at your PR again (#561) I would basically be re-implementing 90% of your work to make the tests work (I.e. implement a <solvername>SolutionPrinter class for each of the solvers, the logic of which you already made). And I'm not sure if your PR adds so much code debt compared to the current <solvername>SolutionPrinter class approach (which is definitely not as user friendly). So I would recommend reviving that PR, maybe extracting the logic of the nested |
|
Ok I see, yes let's merge this already so people can use the Hexaly-specific callback. If and when we revive the other PR, we can add structured testing for this as well |
* solution_callback for Hexaly * Gracefully exit when not properly initialised * Populate objective on callback
Hexaly has support for intermediate solution callbacks. Added the necessary code on CPMpy's side for the
solution_callbackargument of a.solve()call, similar to OR-Tools.Also very small fix for setting solver-native arguments,
setattr(self.hex_solver, arg, val)should have beensetattr(self.hex_solver.param, arg, val).