Reputation: 2862
I'm working with OptaPlanner and am using a HardMediumSoft score and nullable PlanningVariable to achieve over-constrained planning.
What I've noticed is that during CH phase, which I have left as default, it seems like usually all but maybe a few PlanningEntity will get a Planning Value set.
Then during LS phase, which is also default, I've forced my problem facts to force a failed hard constraint, with weight. Eventually, I get a score update, with a strong hard penalty.
So, the medium score at the beginning of LS is very close to zero. The hard score then goes very negative. I was expecting that after a hard score step is done, that OptaPlanner would make moves to un-assign Planning Values, as to satisfy the hard constraint. I've been working on this for weeks now, and have never seen the medium score go more negative.
Am I missing something here? Is this an inherit problem with how i've interpreted score levels?
Upvotes: 0
Views: 191
Reputation: 1029
For a nullable planning variable, OptaPlanner will add null
to the relevant value range to make it one of the possible values assignable to the variable.
In case you calculate the score via ConstraintStreams
API, make sure you use forEachIncludingNullVars()
instead of forEach()
in every constraint that works with a nullable planning variable
It may be worth investigating logs to see whether any such unassigning moves are generated and evaluated (trace level logging) and if so, whether they are selected as a step (debug level logging)
Upvotes: 1