I managed to create a rule to distribute the shiftassignments equally, using
your fairness example.
I am now however stuck on the part time, full time problem. A person that
works part time (50%) should get assigned only half the shifts that a full
time gets assigned. How do I do that?
I have tried the following:
rule "arbeidsbreuk"
when
$employee : Employee($arbeidsbreuk : arbeidsbreuk)
//count aantal shifts
$assignmentTotal : Number() from accumulate(
$assignment : ShiftAssignment(),
count($assignment)
)
//count aantal shifts per medewerker
$assignmentTotalEmployee : Number() from accumulate(
$assignment : ShiftAssignment(employee == $employee),
count($assignment)
)
//count arbeidsbreuken
$arbeidsbreukTotal : Number() from accumulate(
Employee($breuk : arbeidsbreuk),
count($breuk)
)
$over : ($assignmentTotal.intValue() /
$arbeidsbreukTotal.intValue()) - ($arbeidsbreuk.intValue() *
$assignmentTotalEmployee.intValue())
then
scoreHolder.addSoftConstraintMatch(kcontext, -$over.intValue() *
$over.intValue());
end
But I get the error:
Message [id=1, level=ERROR,
path=optaplanner-kie-namespace//be/ocmwturnhout/permanenties/solver/permanentiesScoreRules.drl,
line=117, column=0
text=[ERR 102] Line 117:45 mismatched input '/' in rule
"arbeidsbreuk"]
Message [id=2, level=ERROR,
path=optaplanner-kie-namespace//be/ocmwturnhout/permanenties/solver/permanentiesScoreRules.drl,
line=0, column=0
text=Parser returned a null Package]
I have also tried another rule in which I had a double in the
scoreHolder.addSoftConstraintMatch function and I tried to convert it to an
integer using intValue() . This however also gave an error. Is there a way
to convert doubles to integers?
--
View this message in context:
http://drools.46999.n3.nabble.com/Equal-shift-assignment-based-on-employm...
Sent from the Drools: User forum mailing list archive at
Nabble.com.