Re: [rules-users] modifying the problem facts while running the solver - Drools Planner
spinjala wrote Once the solver finds that a workorder (WO1) couldn't be assigned to any resource in the list of resources (due to the constraints), it simply picks up the 1st resource in the list with highest hard score and assigns it (even though this assignment breaks all constraints). My question is, why is it generating a solution by assigning the wrong resource to the workorder instead of say, throwing a message saying this workorder cannot be assigned to a resource or something like that. In my opinion, a solver should generate a solution only when it is possible to generate but not just assign something that has highest score. I may be wrong but would really appreciate if you can help here, i am unable to proceed further in evaluating this product for my project. Planner perceives an planning variable with the planning value as being uninitialized, not as unassigned. This is due to https://issues.jboss.org/browse/JBRULES-3317 Add a planning value resource that represents unassigned. Then add a hard constraint rule that gets trigged if something is assigned to that planning value. Give a lower weight than 2 entities being assigned to the same value and make the 2 entities being assigned to the same value not trigger if they are assigned to that unassigned value. -- View this message in context: http://drools.46999.n3.nabble.com/modifying-the-problem-facts-while-running-the-solver-Drools-Planner-tp4019099p4019273.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] modifying the problem facts while running the solver - Drools Planner
typo: Planner perceives an planning variable with the planning value *null* as being uninitialized, not as unassigned. This is due to https://issues.jboss.org/browse/JBRULES-3317 -- View this message in context: http://drools.46999.n3.nabble.com/modifying-the-problem-facts-while-running-the-solver-Drools-Planner-tp4019099p4019274.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] modifying the problem facts while running the solver - Drools Planner
spinjala wrote THis is what is happening now with my sample solution that I am writing.. Once the solver finds that a workorder (WO1) couldn't be assigned to any resource in the list of resources (due to the constraints)... Well, it's a slightly different problem them. Planner's approach is to solve problems in parallel, where it's not trivial to determine where a given item can be matched. Part of the motivation beyond using Planner is that whether one item fits may be dependent on how the other items are arranged. If workorders are coming in one at a time, why not apply the rules to that item alone -- and that remove it from the planning scenario if it can't be fit? Jon -- View this message in context: http://drools.46999.n3.nabble.com/modifying-the-problem-facts-while-running-the-solver-Drools-Planner-tp4019099p4019264.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] modifying the problem facts while running the solver - Drools Planner
spinjala wrote I tried setting the scoreAttained and maximum time allowed to spend in my termination configuration, but none seems to stop the solver finding the solution that violates ALL constraints and hence throws a negative hard score. Is this the only way to do it or any other way is available to force the solver not to look for a solution when ALL constraints are violated? From Planner's perspective, there are multiple possible solutions. Each solution has a score, a combination of the hard and soft scores, each of which represents the sum of constraint violations. If the scores are 0, then the solution is nonoptimal; and thus, it will keep looking. You might try the termination/maximumUnimprovedStepCount config setting. (see section 6.6.4 of the doc) This stops the solving after a number of steps have been tried without any improvement to the score. Jon -- View this message in context: http://drools.46999.n3.nabble.com/modifying-the-problem-facts-while-running-the-solver-Drools-Planner-tp4019099p4019161.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] modifying the problem facts while running the solver - Drools Planner
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. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users