Reputation: 99
I have a DRL using HardMediumSoftScore, and have found that in some cases there is a difference in score result while calculating and afterwards while explaining the score.
SolverFactory<Problem> solverFactory=solverFactory.cloneSolverFactory();
Solver<Problem> solver = requestSolverFactory.buildSolver();
Problem solved = solver.solve( problem );
At the end of this snippet, the Solver logs some kind of score, e.g:
Solving ended: time spent (100648), best score (-339hard/0medium/0soft)...
After the above snippet, I immediately have:
ScoreDirector<Roster> scoreDirector = solver.getScoreDirectorFactory().buildScoreDirector();
scoreDirector.setWorkingSolution( solved );
scoreDirector.calculateScore();
for( ConstraintMatchTotal constraintMatchTotal : scoreDirector.getConstraintMatchTotals() )
{
LOG.debug( "{} {} {}",constraintMatchTotal.getConstraintName(),constraintMatchTotal.getConstraintMatchCount(), constraintMatchTotal.getScoreTotal() );
}
Here hard scores always match, but sometimes there are also medium scores in the explanation, which are not there at the end of solving, like:
hardConstraint 3 -339hard/0medium/0soft
mediumConstraint 14 0hard/-1582medium/0soft
Anyone got an idea?
Upvotes: 1
Views: 272
Reputation: 27312
In the solver config, turn on environmentMode
FULL_ASSERT
(or FAST_ASSERT
) and let it run long enough. I suspect you 'll get a score corruption exception. Fix that first.
(Read the score corruption error message analysis a couple of times to understand it.)
Upvotes: 1