Thanks for the reply. It helped to see my mistake. I have now simplified the
rule for testing purposes. I now have:
rule "alternativeSkill"
when
$skill : Skill(code == '1')
$employee : Employee()
not SkillProficiency(employee == $employee, skill == $skill)
then
scoreHolder.addHardConstraintMatch(kcontext,
-1);//scoreHolder.addSoftConstraintMatch(kcontext, -
$contractLine.getWeight());
end
I have three employees and 19 shifts. 1 employee has the necessary skills to
do the shifts, the other 2 not. When I run the program I get:
14:42:19.237 [main] DEBUG o.o.c.i.l.DefaultLocalSearchSolverPhase - Step
index (135), time spend (20000), score (-2hard/-182soft), best score
(-2hard/-182soft), accepted/selected move count (85/252) for picked step
(2013-12-09(Mon)_intake->evgey_Intaketeam(Evelien Geysen - Intaketeam) <=>
2013-12-05(Thu)_intake->mavan_Intaketeam(Marie Van de Vliet - Intaketeam)).
14:42:19.237 [main] INFO o.o.c.i.l.DefaultLocalSearchSolverPhase - Phase
(1) localSearch ended: step total (136), time spend (20000), best score
(-2hard/-182soft).
14:42:19.237 [main] INFO o.o.core.impl.solver.DefaultSolver - Solving
ended: time spend (20000), best score (-2hard/-182soft), average calculate
count per second (19839).
I get 2 hard errors as expected. But the best solution still assigns all
three employees to the shifts. Why do I not get a solution where only the
one qualified employee is assigned to all shifts? That way I would get 0
hard errors. Am I missing something?
--
View this message in context:
http://drools.46999.n3.nabble.com/Optaplanner-rule-to-assign-employee-onl...
Sent from the Drools: User forum mailing list archive at
Nabble.com.