<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt"><div><span>There is </span>a construction heuristic that should have already
filled in that planning entity.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">The two other planning variables are filled for each planning entity.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">I have put a printline in the setter of the troublesome planning variable:</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"> @PlanningVariable(strengthComparatorClass = TasktypeStrengthComparator.class, nullable = false)<br> @ValueRange(type =
ValueRangeType.FROM_SOLUTION_PROPERTY, solutionProperty = "tasktypes")<br> public TaskType getType() {<br> return type;<br> }<br><br> public void setType(TaskType type) {<br> <span style="font-weight: bold;">System.out.println("Type set to " + type);</span><br> this.type = type;<br> }<br></div><div> <br>And I get the following outprint:<br><br>Type set to TL<br>Type set to null<br>Type set to TL<br>Type set to TL<br>Type set to null<br>Type set to TL<br>Type set to null<br>Type set to TL<br>Type set to null<br>Type set to TL<br>Type set to null<br>Type set to TL<br>Type set to TL<br>Type set to null<br>Type set to TL<br>...<br>Type set to null<br>Type set to TL<br>Type set to null<br>Type set to TL<br><br>Note that I also tried to set the annotation property nullable
to false.<br>This seems to have no effect.<br><br>Thanks,<br>Michiel<br></div><div>-----------------<br>http://www.codessentials.com - Your essential software, for free!<br>Follow us at http://twitter.com/#!/Codessentials<br></div> <div style="font-family: tahoma, new york, times, serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Geoffrey De Smet <ge0ffrey.spam@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Rules Users List <rules-users@lists.jboss.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, January 9, 2013 9:30 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Fw: proble with localSearch<br> </font> </div> <br>
<div id="yiv2078556544">
<div>
<br>
<div class="yiv2078556544moz-cite-prefix">Op 09-01-13 08:21, Michiel Vermandel
schreef:<br>
</div>
<blockquote type="cite">
<div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;"><span>Hi Geoffrey,</span>
<div style="font-family:tahoma, new york, times, serif;font-size:10pt;">
<div style="font-family:times new roman, new york, times, serif;font-size:12pt;">
<div id="yiv2078556544">
<div>
<div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
<span></span></div>
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Thanks
for your advice.</span></div>
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Indeed
one of the planning variables is consistently null
over all planning entities.</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
And there was a construction heuristic that should have already
filled in that planning entity?<br>
Enable DEBUG logging, so you can see in the construction heuristic
log if it does steps which change that variable from null to a
non-null value.<br>
<br>
If you have 2 <constructionHeuristics> configurations before
the <localSearch> configuration (which I don't see how you
could with the 5.5 CH behavior):<br>
I just fixed a bug/feature for 6.0 earlier this week to support
that.<br>
<br>
<blockquote type="cite">
<div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
<div style="font-family:tahoma, new york, times, serif;font-size:10pt;">
<div style="font-family:times new roman, new york, times, serif;font-size:12pt;">
<div id="yiv2078556544">
<div>
<div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Should
drools planner take care of this or should I
impose an extra rule to exclude these selections?</span></div>
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Once
again I seem to struggle with nulls being passed
in as planning variable...</span></div>
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
<span></span></div>
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Thanks,</span></div>
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><br>
<span></span></div>
<div style="color:rgb(0, 0,
0);font-size:13.3333px;font-family:tahoma, new york, times, serif;background-color:transparent;font-style:normal;"><span>Michiel<br>
</span></div>
<div> </div>
<div>-----------------<br>
http://www.codessentials.com - Your essential
software, for free!<br>
Follow us at http://twitter.com/#!/Codessentials<br>
</div>
<div style="font-family:tahoma, new york, times, serif;font-size:10pt;">
<div style="font-family:times new roman, new york, times, serif;font-size:12pt;">
<div dir="ltr"> <font face="Arial" size="2">
<hr size="1"> <b><span style="font-weight:bold;">From:</span></b>
Geoffrey De Smet
<a rel="nofollow" class="yiv2078556544moz-txt-link-rfc2396E" ymailto="mailto:ge0ffrey.spam@gmail.com" target="_blank" href="mailto:ge0ffrey.spam@gmail.com"><ge0ffrey.spam@gmail.com></a><br>
<b><span style="font-weight:bold;">To:</span></b>
Michiel Vermandel <a rel="nofollow" class="yiv2078556544moz-txt-link-rfc2396E" ymailto="mailto:mvermand@yahoo.com" target="_blank" href="mailto:mvermand@yahoo.com"><mvermand@yahoo.com></a>;
Rules Users List
<a rel="nofollow" class="yiv2078556544moz-txt-link-rfc2396E" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org"><rules-users@lists.jboss.org></a> <br>
<b><span style="font-weight:bold;">Sent:</span></b>
Tuesday, January 8, 2013 4:27 PM<br>
<b><span style="font-weight:bold;">Subject:</span></b>
Re: proble with localSearch<br>
</font> </div>
<br>
<div id="yiv2078556544">
<div> <br>
<div class="yiv2078556544moz-cite-prefix">Op
08-01-13 15:24, Michiel Vermandel schreef:<br>
</div>
<blockquote type="cite">
<div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;">Hi,<br>
<br>
I'm trying to implement a basic local
search (really new to it).<br>
<br>
When I run my project I now get:<br>
<br>
Exception in thread "main"
java.lang.IllegalStateException: Phase
localSearch started with an uninitialized
Solution. First initialize the Solution.
For example, run a phase
constructionHeuristic first.<br>
at
org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.phaseStarted(DefaultLocalSearchSolverPhase.java:120)<br>
</div>
</blockquote>
You have a construction heuristic configured,
so all @PlanningVariable's should be different
from null after that phase is ended.<br>
So when the local search phase starts, that
check should be ok and not throw that
exception.<br>
<br>
Comment out local search, write the solution
to disk an verify that all planning variables
are now not null.<br>
Or debug where that exception is throw and
inspect
phaseScope.getSolverScope().getScoreDirector().getWorkingSolution().<br>
<blockquote type="cite">
<div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;"><br>
This is my config:<br>
<br>
<?xml version="1.0"
encoding="UTF-8"?><br>
<solver><br>
<environmentMode>DEBUG</environmentMode><br>
<br>
<!-- Domain model configuration
--><br>
<solutionClass>be.axi.planner.app.InspectionSchedule</solutionClass><br>
<planningEntityClass>be.axi.planner.domain.Task</planningEntityClass><br>
<br>
<!-- Score configuration --><br>
<scoreDirectorFactory><br>
<scoreDefinitionType>HARD_AND_SOFT</scoreDefinitionType><br>
<scoreDrl>/inspectionRules.drl</scoreDrl><br>
</scoreDirectorFactory><br>
<br>
<constructionHeuristic><br>
<constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType><br>
<!--
constructionHeuristicPickEarlyType>FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING</constructionHeuristicPickEarlyType--><br>
</constructionHeuristic><br>
<br>
<localSearch><br>
<termination><br>
<terminationCompositionStyle>OR</terminationCompositionStyle><br>
<maximumSecondsSpend>3600</maximumSecondsSpend><br>
<scoreAttained>0hard/0soft</scoreAttained><br>
</termination><br>
<unionMoveSelector><br>
<changeMoveSelector><br>
<valueSelector><br>
<planningVariableName>period</planningVariableName><br>
</valueSelector><br>
</changeMoveSelector><br>
<changeMoveSelector><br>
<valueSelector><br>
<planningVariableName>spector</planningVariableName><br>
</valueSelector><br>
</changeMoveSelector><br>
<changeMoveSelector><br>
<valueSelector><br>
<planningVariableName>type</planningVariableName><br>
</valueSelector><br>
</changeMoveSelector><br>
<swapMoveSelector><br>
</swapMoveSelector><br>
</unionMoveSelector><br>
<br>
<acceptor><br>
<planningEntityTabuSize>7</planningEntityTabuSize><br>
</acceptor><br>
<forager><br>
<minimalAcceptedSelection>1000</minimalAcceptedSelection><br>
</forager><br>
</localSearch><br>
<br>
</solver><br>
<div><span></span></div>
<div> Any thoughts on what I'm doing
wrong?<br>
<br>
Thanks<br>
<br>
Michiel<br>
</div>
<div>-----------------<br>
<a rel="nofollow" class="yiv2078556544moz-txt-link-freetext" target="_blank" href="http://www.codessentials.com/">http://www.codessentials.com</a>
- Your essential software, for free!<br>
Follow us at <a rel="nofollow" class="yiv2078556544moz-txt-link-freetext" target="_blank" href="http://twitter.com/#%21/Codessentials">http://twitter.com/#!/Codessentials</a></div>
</div>
<br>
<fieldset class="yiv2078556544mimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
rules-users mailing list
<a rel="nofollow" class="yiv2078556544moz-txt-link-abbreviated" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a rel="nofollow" class="yiv2078556544moz-txt-link-freetext" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</div>
</div>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
<br>
</div>
</div>
</div>
<br>
<fieldset class="yiv2078556544mimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
rules-users mailing list
<a rel="nofollow" class="yiv2078556544moz-txt-link-abbreviated" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a rel="nofollow" class="yiv2078556544moz-txt-link-freetext" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</div>
</div><br>_______________________________________________<br>rules-users mailing list<br><a ymailto="mailto:rules-users@lists.jboss.org" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br> </div> </div> </div></body></html>