[rules-users] modifying the problem facts while running the solver - Drools Planner

ge0ffrey ge0ffrey.spam at gmail.com
Mon Aug 13 05:54:12 EDT 2012


spinjala wrote
> 
> I am new to Drools planner. I have one issue and wanted to understand how
> to resolve it best. 
> 
> I am trying to use planner to optimize the scheduling of work orders to
> resources. I have certain resources that need to be assigned to a work
> order in a way that maximizes the utilization of the resource. But I have
> a condition where once a resource is scheduled for a workorder, he/she
> shouldn't be scheduled for any other work order again during the same day.
> How do we manage this condition? do we add it as a constraint in the
> drools rule file so that scoring can handle it or do we write a custom
> solver phase to check if a solution has this resource assigned to a WO,
> then skip the resource and proceed with further solution. Please help.
> 

See nurseRosteringScoreRules.drl:

// a nurse can only work one shift per day, i.e. no two shift can be
assigned to the same nurse on a day.
rule "oneShiftPerDay"
    when
        $leftAssignment : ShiftAssignment($leftId : id, $employee :
employee, $shiftDate : shiftDate)
        $rightAssignment : ShiftAssignment(employee == $employee, shiftDate
== $shiftDate, id > $leftId)
    then
        insertLogical(new IntConstraintOccurrence("oneShiftPerDay",
ConstraintType.NEGATIVE_HARD,
                1,
                $leftAssignment, $rightAssignment));
end



--
View this message in context: http://drools.46999.n3.nabble.com/modifying-the-problem-facts-while-running-the-solver-Drools-Planner-tp4019099p4019104.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list