perf: add ability to ignore inconsistent solutions#2396
Conversation
|
|
What backwards incompatible behavior we are guarding against here using
I want to argue 1-YES, 2-YES, 3-YES. It is a move like any other, and it does not leave the solver in any inconsistent state. The user should see it. But the score is pretty much pointless, which means the logging should - instead of showing a score - show some other message. Score traps should not be a problem either. If this move never influences any of the solver's algorithms, it is as if it never existed, and therefore it can not cause a score trap. It will only reduce move speed, a vampiric loss. Should the move be counted towards tabu search? IMO NO. IMO we should work towards silently enabling this in the solver. We can do this backwards compatibly. |
Some users might want to get the score of a planning solution with some inconsistent variables; that is currently allowed and is handled via
TBH I am shocked that method is even being called; Entities can never be looped with how this is designed. My guess is it might still be iterating all the shadow variables on the entities to check if they are looped. |
Fair point. Even though I'm not worried about this scenario, we can solve this without introducing any preview features:
Unfortunately, this means we will have to keep the MNR complexity, but so be it. We will also have to investigate all the things I mentioned above - these invalid moves must never interact with the solver's logic around how future moves are generated, or how new best solutions are selected. |
|
More consequences to investigate:
I'm starting to think that the solution should carry an inconsistency flag. |
Currently, if the feature is enabled, it fail-fast on solve start.
I think it uses the old behaviour.
Ditto.
None (unless we remove the ability to solve/calculate the score of inconsistent solutions
How would that help? People cannot check the solution in their constraints; I would rather throw an exception in that case so users don't forget to check a flag. |
triceo
left a comment
There was a problem hiding this comment.
Good to go to the feature branch when comments resolved.


Added a new preview feature
IGNORE_INCONSISTENT_SOLUTIONS.When enabled, when a move causes the solution to be in an inconsistent state, that move is effectively ignored;
calculateScorewill return a score with the minimum init value possible (i.e. a score that is less than all other scores) and no shadow variables will be updated.Technically, this potentially introduces a score trap: all inconsistent solutions get the same -infinity score. However, this doesn't seem to be a problem in the benchmarks I performed.
TopologicalGraph#commitChangessignature has changed to return a boolean which is true iff the graph has loops (and thus the solution inconsistent.Benchmarks show significant improvements for Machine Job Scheduling on Enterprise.