Re: [rules-users] Planner: Hard Constraint Prevents Moves and Swaps
Thank you for the advice. I've downloaded 5.5.0.Beta1 and carried out the required update steps. BTW the new selector system seems to be a giant leap forward. First question: Given that I want to keep certain entities together, do I still need to employ changeMoveSelector's? or should I only use pillars? With respect to the pillarSwapMoveSelector, as in my example above, how do I tell it I want to base the pillar on the planningVariable timeSlots? I tried to add a valueSelector/planningVariableName but it doesn't work. I had a look at the source code and it seems that the planningVariableName section of the code has been commented out. Thanks, Jason -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Planner-Hard-Constraint-Prevents-Moves-and-Swaps-tp4019953p4020023.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] Planner: Hard Constraint Prevents Moves and Swaps
Op 25-09-12 20:44, Jason Virtue schreef: All, I have a problem where I need to assign tasks: 1.) Times 2.) Resources based on a Resource Type I've used the nurse rostering problem as an example and come up with a planning entity ResourceAssignment that looks like: Facts: Task ResourceType Variables: Time Resource For example: 1.) Lets say there are two resource types Type1 Type2 2.) A pool of resources: Resource1(type1), Resource2(type1), Resource3(type1), Resource4(type2), Resource4(type2), Resource5(type2) ... 3.) Task A: that requires 1 resource of type1 and one resource of type2 My program creates two PlanningEntities ResourceAssignment1 Fact: Task=A ResourceType=1 Variables Time Resource ResourceAssignment2 Fact: Task=A ResourceType=2 Variables: Time Resource I've created a rule that is designed to keep tasks starting at the same time: //tasks need to be in the same timeSlot rule "taskInTimeSlot" when $ra1 : ResourceAssignment ( task != null, time != null, $id : id, $task : task, $time : time) $ra2 : ResourceAssignment ( task != null, timeSlot != null, id != $id, task == $task, time != $time ) then insertLogical(new IntConstraintOccurrence("taskInTimeSlot", ConstraintType.NEGATIVE_HARD, 1,$ra1, $ra2)); end *PROBLEM* This results in:Cancelled step index (7), time spend (2848): there is no doable move. Terminating phase early. If I change the constraint to a NEGATIVE_SOFT the problem is solved, but it doesn't scale. Any more that a few tasks and it doesn't seem to be able to find solutions. What I need is for swaps and moves to change the time on multiple ResourceAssignments together. Take a look at pillarSwapMove. You might want to upgrade to 5.5.0.Beta1 (follow the upgrade script) and take advantage of the improved pillarSwapMove there, as well as the documentation that now explains it. Am I going about the problem the right way? Do I need something other than the generic move/swap factories? A custom MoveListFactory gives you full control, so that will give you even more flexiblity, at the cost of more implementation work. Thanks in advance, Jason ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Planner: Hard Constraint Prevents Moves and Swaps
All, I have a problem where I need to assign tasks: 1.) Times 2.) Resources based on a Resource Type I've used the nurse rostering problem as an example and come up with a planning entity ResourceAssignment that looks like: Facts: Task ResourceType Variables: Time Resource For example: 1.) Lets say there are two resource types Type1 Type2 2.) A pool of resources: Resource1(type1), Resource2(type1), Resource3(type1), Resource4(type2), Resource4(type2), Resource5(type2) ... 3.) Task A: that requires 1 resource of type1 and one resource of type2 My program creates two PlanningEntities ResourceAssignment1 Fact: Task=A ResourceType=1 Variables Time Resource ResourceAssignment2 Fact: Task=A ResourceType=2 Variables: Time Resource I've created a rule that is designed to keep tasks starting at the same time: //tasks need to be in the same timeSlot rule taskInTimeSlot when $ra1 : ResourceAssignment ( task != null, time != null, $id : id, $task : task, $time : time) $ra2 : ResourceAssignment ( task != null, timeSlot != null, id != $id, task == $task, time != $time ) then insertLogical(new IntConstraintOccurrence(taskInTimeSlot, ConstraintType.NEGATIVE_HARD, 1,$ra1, $ra2)); end *PROBLEM* This results in: Cancelled step index (7), time spend (2848): there is no doable move. Terminating phase early. If I change the constraint to a NEGATIVE_SOFT the problem is solved, but it doesn't scale. Any more that a few tasks and it doesn't seem to be able to find solutions. What I need is for swaps and moves to change the time on multiple ResourceAssignments together. Am I going about the problem the right way? Do I need something other than the generic move/swap factories? Thanks in advance, Jason ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users