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