<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Presuming that you don't want to leave space between tasks, you can
design your model differently by using the "chained" functionality:<br>
it will be far more efficient and the planning variable won't be
continuous.<br>
<br>
Let's presume you're scheduling Tasks to Persons.<br>
<br>
@PlanningEntity<br>
class Task implements TaskOrPerson {<br>
<br>
...<br>
<br>
@PlanningVariable(chained = true)<br>
@ValueRanges({<br>
@ValueRange(type =
ValueRangeType.FROM_SOLUTION_PROPERTY, solutionProperty =
"taskList"),<br>
@ValueRange(type =
ValueRangeType.FROM_SOLUTION_PROPERTY, solutionProperty =
"personList",<br>
excludeUninitializedPlanningEntity = true)})<br>
public TaskOrPerson getPreviousTaskOrPerson() {<br>
return previousTaskOrPerson;<br>
}<br>
<br>
public int getDuration() {<br>
return duration;<br>
}<br>
<br>
public int getStartingTime() {<br>
int startingTime = 0;<br>
TaskOrPerson taskOrPerson = getPreviousTaskOrPerson();<br>
while (taskOrPerson instanceof Task) { // Every chain is
guarantee to end up with an anchor (= Person)<br>
startingTime += ((Task) taskOrPerson).getDuration();<br>
taskOrPerson = ((Task)
taskOrPerson).getPreviousTaskOrPerson()<br>
}<br>
return startingTime;<br>
}<br>
<br>
}<br>
<br>
class Person implements TaskOrPerson {<br>
<br>
}<br>
<br>
For a good example, take a look at the VehicleRouting example.<br>
For more info about chaining, in the manual see section 4.3.4.2.6.
Chained<br>
<a class="moz-txt-link-freetext" href="http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/index.html">http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/index.html</a><br>
<br>
<div class="moz-cite-prefix">Op 22-07-12 18:00, Josef Bajada
schreef:<br>
</div>
<blockquote
cite="mid:CAJOvgL+E74Q9FCj=_eLnoY5j9UYsi3yvRPS=UjfhWO+FAudr=Q@mail.gmail.com"
type="cite">Hi,
<div><br>
</div>
<div>I am new to Drools and Drools Planner, so apologies if I am
asking anything obvious.</div>
<div><br>
</div>
<div>My objective is to implement a simple (for now) planner which
schedules tasks according to 2 main criteria:</div>
<div>- Their duration (in seconds)</div>
<div>- Their dependencies on other tasks (e.g. Hard Constraint
that Task B has to start between 180 and 200 seconds after Task
A finishes).</div>
<div><br>
</div>
<div>Since there are gaps between dependent tasks as part of the
hard constraints other tasks can be fitted in between dependent
tasks.</div>
<div>So the Solver needs to find the optimal start time for each
task that satisfies the hard constraints, and in the shortest
total timeline possible to complete all tasks (soft constraint).</div>
<div><br>
</div>
<div>The main problem I am finding is that this start time, which
is essentially the planning variable is a continuous variable. </div>
<div>Chapter 4 of the Drools documentation mentions very briefly
(Section 4.3.4.1) that planning variables can be continuous,
but there does not seem to be any more details about how to
achieve this.</div>
<div><br>
</div>
<div>Even if the planning variable was discrete (say bins of 5
second intervals), there is no upper bound as such.</div>
<div><br>
</div>
<div>How is it best to handle such planning variables in Drools
Planner?</div>
<div><br>
</div>
<div>thanks,<br>
josef</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>
<pre class="moz-signature" cols="72">--
With kind regards,
Geoffrey De Smet</pre>
</body>
</html>