All,<div><br></div><div>I have a problem where I need to assign tasks:</div><div>1.) Times</div><div>2.) Resources based on a Resource Type</div><div><br></div><div>I've used the nurse rostering problem as an example and come up with a planning entity ResourceAssignment that looks like:</div>
<div><br></div><div>Facts:</div><div>Task</div><div>ResourceType</div><div><br></div><div>Variables:</div><div>Time</div><div>Resource</div><div><br></div><div>For example:</div><div>1.) Lets say there are two resource types Type1 & Type2</div>
<div>2.) A pool of resources: Resource1(type1), Resource2(type1), Resource3(type1), Resource4(type2), Resource4(type2), Resource5(type2) ...</div><div>3.) Task A: that requires 1 resource of type1 and one resource of type2</div>
<div><br></div><div>My program creates two PlanningEntities</div><div>ResourceAssignment1</div><div>Fact:</div><div>Task=A</div><div>ResourceType=1</div><div>Variables</div><div>Time</div><div>Resource</div><div><br></div>
<div>ResourceAssignment2</div><div>Fact:</div><div>Task=A</div><div>ResourceType=2</div><div>Variables:</div><div>Time</div><div>Resource</div><div><br></div><div>I've created a rule that is designed to keep tasks starting at the same time:</div>
<div><p style="margin:0px;font-size:11px;font-family:Monaco">//tasks need to be in the same timeSlot</p>
<p style="margin:0px;font-size:11px;font-family:Monaco">rule "taskInTimeSlot"</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>when</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>$ra1 : ResourceAssignment ( task != null, time != null, $id : id, $task : task, $time : time)</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>$ra2 : ResourceAssignment ( task != null, timeSlot != null, id != $id, task == $task, time != $time )</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>then</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>insertLogical(new IntConstraintOccurrence("taskInTimeSlot", ConstraintType.NEGATIVE_HARD,</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"> 1,$ra1, $ra2));</p>
<p style="margin:0px;font-size:11px;font-family:Monaco">end</p><p style="margin:0px;font-size:11px;font-family:Monaco"><br></p><p style="margin:0px;font-size:11px;font-family:Monaco">*PROBLEM*</p><p style="margin:0px;font-size:11px;font-family:Monaco">
<br></p><p style="margin:0px;font-size:11px;font-family:Monaco">This results in: Cancelled step index (7), time spend (2848): there is no doable move. Terminating phase early.</p><p style="margin:0px;font-size:11px;font-family:Monaco">
<br></p><p style="margin:0px;font-size:11px;font-family:Monaco">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.</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><br></p><p style="margin:0px;font-size:11px;font-family:Monaco">What I need is for swaps and moves to change the time on multiple ResourceAssignments together.</p><p style="margin:0px;font-size:11px;font-family:Monaco">
<br></p><p style="margin:0px;font-size:11px;font-family:Monaco">Am I going about the problem the right way? Do I need something other than the generic move/swap factories?</p><p style="margin:0px;font-size:11px;font-family:Monaco">
<br></p><p style="margin:0px;font-size:11px;font-family:Monaco">Thanks in advance,</p><p style="margin:0px;font-size:11px;font-family:Monaco">Jason</p></div><div><br></div><div><br></div>