<div dir="ltr">Hello! After trying cloudComputer example i&#39;m trying to implement my own schedule distributor, but now i&#39;m facing heap space error, but i see that it does distribute some work orders. Here&#39;s the console error:<div>
<br></div><div>-------------------</div><div><div>17:05:02.776 [main] INFO  o.d.p.core.solver.DefaultSolver - Solving started: time spend (255), score (null), new best score (null), random seed (0).</div><div>17:05:02.821 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -     Step index (0), time spend (309), score (0hard/0soft), initialized planning entity ([Engineer-5]).</div>
<div>17:05:02.822 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -     Step index (1), time spend (310), score (0hard/0soft), initialized planning entity ([Engineer-4]).</div><div>17:05:02.824 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -     Step index (2), time spend (311), score (0hard/0soft), initialized planning entity ([Engineer-3]).</div>
<div>17:05:02.824 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -     Step index (3), time spend (312), score (0hard/0soft), initialized planning entity ([Engineer-2]).</div><div>17:05:02.825 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -     Step index (4), time spend (313), score (0hard/0soft), initialized planning entity ([Engineer-1]).</div>
<div>17:05:02.825 [main] INFO  o.d.p.c.c.g.DefaultGreedyFitSolverPhase - Phase constructionHeuristic ended: step total (5), time spend (313), best score (0hard/0soft).</div><div>17:05:03.020 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -     Step index (0), time spend (508), score (0hard/0soft),     best score (0hard/0soft), accepted/selected move count (1000/1000) for picked step ([Engineer-3] =&gt; [WorkOrder-12]).</div>
<div>17:05:03.315 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -     Step index (1), time spend (803), score (0hard/0soft),     best score (0hard/0soft), accepted/selected move count (1000/1703) for picked step ([Engineer-4] =&gt; [WorkOrder-8]).</div>
<div>17:05:03.736 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -     Step index (2), time spend (1224), score (0hard/0soft),     best score (0hard/0soft), accepted/selected move count (1000/2657) for picked step ([Engineer-1] =&gt; [WorkOrder-8]).</div>
<div>17:05:03.951 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -     Step index (3), time spend (1439), score (0hard/0soft),     best score (0hard/0soft), accepted/selected move count (1000/4315) for picked step ([Engineer-5] =&gt; [WorkOrder-9]).</div>
<div>17:05:04.251 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -     Step index (4), time spend (1739), score (0hard/0soft),     best score (0hard/0soft), accepted/selected move count (1000/9309) for picked step ([Engineer-2] =&gt; [WorkOrder-9]).</div>
<div>Exception in thread &quot;main&quot; java.lang.OutOfMemoryError: Java heap space</div><div><span class="" style="white-space:pre">        </span>at java.util.Arrays.copyOf(Unknown Source)</div><div><span class="" style="white-space:pre">        </span>at java.util.Arrays.copyOf(Unknown Source)</div>
<div><span class="" style="white-space:pre">        </span>at java.util.ArrayList.grow(Unknown Source)</div><div><span class="" style="white-space:pre">        </span>at java.util.ArrayList.ensureCapacityInternal(Unknown Source)</div><div>
<span class="" style="white-space:pre">        </span>at java.util.ArrayList.add(Unknown Source)</div><div><span class="" style="white-space:pre">        </span>at org.drools.planner.core.localsearch.decider.forager.AcceptedForager.addToMaxScoreUnacceptedList(AcceptedForager.java:143)</div>
<div><span class="" style="white-space:pre">        </span>at org.drools.planner.core.localsearch.decider.forager.AcceptedForager.addMove(AcceptedForager.java:101)</div><div><span class="" style="white-space:pre">        </span>at org.drools.planner.core.localsearch.decider.DefaultDecider.processMove(DefaultDecider.java:164)</div>
<div><span class="" style="white-space:pre">        </span>at org.drools.planner.core.localsearch.decider.DefaultDecider.doMove(DefaultDecider.java:144)</div><div><span class="" style="white-space:pre">        </span>at org.drools.planner.core.localsearch.decider.DefaultDecider.decideNextStep(DefaultDecider.java:116)</div>
<div><span class="" style="white-space:pre">        </span>at org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:62)</div><div><span class="" style="white-space:pre">        </span>at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)</div>
<div><span class="" style="white-space:pre">        </span>at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:155)</div><div><span class="" style="white-space:pre">        </span>at com.swa.planner.domain.WorkOrderTest.main(WorkOrderTest.java:66)</div>
</div><div>------------------------</div><div><br></div><div style>it does distribute some engineers to work orders, but after a while, it just show the error.</div><div style><br></div><div style>The drl is very simple:</div>
<div style><br></div><div style>--------------------------</div><div style><div>import org.drools.planner.core.score.buildin.hardandsoft.HardAndSoftScoreHolder;</div><div>import org.drools.planner.core.score.constraint.IntConstraintOccurrence;</div>
<div>import org.drools.planner.core.score.constraint.ConstraintType;</div><div><br></div><div>import com.swa.planner.domain.Distributor;</div><div>import com.swa.planner.domain.Engineer;</div><div>import com.swa.planner.domain.WorkOrder;</div>
<div><br></div><div>global HardAndSoftScoreHolder scoreHolder;</div><div><br></div><div>rule &quot;requiredTimeToFinish&quot;</div><div><span class="" style="white-space:pre">        </span>when</div><div><span class="" style="white-space:pre">                </span>$workOrder : WorkOrder($time : time)</div>
<div><span class="" style="white-space:pre">                </span>$requiredTimeTotal : Number(intValue &gt; $time) from accumulate(</div><div><span class="" style="white-space:pre">                        </span>Engineer (</div><div><span class="" style="white-space:pre">                                </span>workOrder == $workOrder, </div>
<div><span class="" style="white-space:pre">                                </span>$requiredTime : worktime),</div><div><span class="" style="white-space:pre">                        </span>sum($requiredTime)</div><div><span class="" style="white-space:pre">                </span>)</div>
<div><span class="" style="white-space:pre">        </span>then</div><div><span class="" style="white-space:pre">                </span>insertLogical(new IntConstraintOccurrence(&quot;requiredTimeToFinish&quot;, ConstraintType.NEGATIVE_HARD,</div>
<div><span class="" style="white-space:pre">                                </span>$requiredTimeTotal.intValue() - $time,</div><div><span class="" style="white-space:pre">                                </span>$workOrder));</div><div>end</div><div><br></div><div>rule &quot;hardConstraintBroken&quot;</div>
<div><span class="" style="white-space:pre">                </span>salience -1</div><div><span class="" style="white-space:pre">        </span>when</div><div><span class="" style="white-space:pre">                </span>$hardTotal : Number() from accumulate(</div>
<div><span class="" style="white-space:pre">                        </span>IntConstraintOccurrence(constraintType == ConstraintType.NEGATIVE_HARD, $weight : weight)</div><div><span class="" style="white-space:pre">                        </span>sum($weight)</div>
<div><span class="" style="white-space:pre">                        </span>)</div><div><span class="" style="white-space:pre">        </span>then</div><div><span class="" style="white-space:pre">                </span>scoreHolder.setHardConstraintsBroken($hardTotal.intValue());</div>
<div>end</div></div><div style>--------------------------<br></div><div style><br></div><div style>i guess no error there, i believe that i&#39;m missing when doing the strenght and difficulty comparators dince i didn&#39;t really understood the getMultiplicand thing of CloudComputer.</div>
<div style><br></div><div style>here&#39;s the implementation, also kept as simple as possible (and probably wrong):</div><div style><br></div><div style>------------</div><div style><div>public class WorkOrderStrengthComparator implements Comparator&lt;WorkOrder&gt; {</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>public int compare(WorkOrder a, WorkOrder b) {</div><div><span class="" style="white-space:pre">                </span>return new CompareToBuilder().append(a.getTime(), b.getTime())</div>
<div><span class="" style="white-space:pre">                                </span>.append(b.getId(), a.getId())</div><div><span class="" style="white-space:pre">                                </span>.toComparison();</div><div><span class="" style="white-space:pre">        </span>}</div>
<div><br></div><div>}</div></div><div style>------------</div><div style><div>public class EngineerDifficultyComparator implements Comparator&lt;Engineer&gt; {</div><div><br></div><div><span class="" style="white-space:pre">        </span>public int compare(Engineer a, Engineer b) {</div>
<div><span class="" style="white-space:pre">                </span>return new CompareToBuilder().append(a.getWorktime(), b.getWorktime())</div><div><span class="" style="white-space:pre">                                </span>.append(a.getId(), b.getId())</div><div>
<span class="" style="white-space:pre">                                </span>.toComparison();</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div>}</div></div><div style>------------</div><div style><br></div><div style>
i&#39;m missing something at these comparators ain&#39;t I?</div></div>