<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">Op 25-09-12 20:44, Jason Virtue
      schreef:<br>
    </div>
    <blockquote
cite="mid:CAM+feaJ25NnS5zXmtupXrZ=RbiLwwTtANp4aoCxPMvnEpTeUSw@mail.gmail.com"
      type="cite">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 &amp; 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">&nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp; &nbsp; &nbsp; 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:&nbsp;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>
      </div>
    </blockquote>
    Take a look at pillarSwapMove.<br>
    <br>
    You might want to upgrade to 5.5.0.Beta1 (follow the upgrade script)
    and take advantage of the improved pillarSwapMove there,<br>
    as well as the documentation that now explains it.<br>
    <blockquote
cite="mid:CAM+feaJ25NnS5zXmtupXrZ=RbiLwwTtANp4aoCxPMvnEpTeUSw@mail.gmail.com"
      type="cite">
      <div>
        <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>
      </div>
    </blockquote>
    A custom MoveListFactory gives you full control, so that will give
    you even more flexiblity, at the cost of more implementation work.<br>
    <blockquote
cite="mid:CAM+feaJ25NnS5zXmtupXrZ=RbiLwwTtANp4aoCxPMvnEpTeUSw@mail.gmail.com"
      type="cite">
      <div>
        <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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>