There is a construction heuristic that should have already filled in that planning
entity.
The two other planning variables are filled for each planning entity.
I have put a printline in the setter of the troublesome planning variable:
@PlanningVariable(strengthComparatorClass = TasktypeStrengthComparator.class, nullable
= false)
@ValueRange(type = ValueRangeType.FROM_SOLUTION_PROPERTY, solutionProperty =
"tasktypes")
public TaskType getType() {
return type;
}
public void setType(TaskType type) {
System.out.println("Type set to " + type);
this.type = type;
}
And I get the following outprint:
Type set to TL
Type set to null
Type set to TL
Type set to TL
Type set to null
Type set to TL
Type set to null
Type set to TL
Type set to null
Type set to TL
Type set to null
Type set to TL
Type set to TL
Type set to null
Type set to TL
...
Type set to null
Type set to TL
Type set to null
Type set to TL
Note that I also tried to set the annotation property nullable to false.
This seems to have no effect.
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at
http://twitter.com/#!/Codessentials
________________________________
From: Geoffrey De Smet <ge0ffrey.spam(a)gmail.com>
To: Rules Users List <rules-users(a)lists.jboss.org>
Sent: Wednesday, January 9, 2013 9:30 AM
Subject: Re: [rules-users] Fw: proble with localSearch
Op 09-01-13 08:21, Michiel Vermandel schreef:
Hi Geoffrey,
Thanks for your advice.
Indeed one of the planning variables is consistently null over all planning entities.
And there was a construction heuristic that should have already filled in that
planning entity?
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.
If you have 2 <constructionHeuristics> configurations before
the <localSearch> configuration (which I don't see how you
could with the 5.5 CH behavior):
I just fixed a bug/feature for 6.0 earlier this week to support
that.
Should drools planner take care of this or should I impose an extra rule to exclude these
selections?
Once again I seem to struggle with nulls being passed in as planning
variable...
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential
software, for
free!
Follow us at
http://twitter.com/#!/Codessentials
________________________________
From: Geoffrey De Smet <ge0ffrey.spam(a)gmail.com>
To: Michiel Vermandel <mvermand(a)yahoo.com>; Rules Users List
<rules-users(a)lists.jboss.org>
Sent: Tuesday, January 8, 2013 4:27 PM
Subject: Re: proble with localSearch
Op 08-01-13 15:24, Michiel Vermandel schreef:
Hi,
>
>I'm trying to implement a basic local
search
(really new to it).
>
>When I run my project I now get:
>
>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.
> at
org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.phaseStarted(DefaultLocalSearchSolverPhase.java:120)
>
You have a construction heuristic configured, so all
@PlanningVariable's should be different from null after that phase is ended.
So when the local search phase starts, that
check should be ok and not throw that
exception.
Comment out local search, write the solution
to disk an
verify that all planning variables
are now not null.
Or debug where that exception is throw and
inspect
phaseScope.getSolverScope().getScoreDirector().getWorkingSolution().
>
>
>>This is my config:
>
>><?xml version="1.0"
encoding="UTF-8"?>
><solver>
>
<environmentMode>DEBUG</environmentMode>
>
>> <!-- Domain model configuration
-->
>
<solutionClass>be.axi.planner.app.InspectionSchedule</solutionClass>
>
<planningEntityClass>be.axi.planner.domain.Task</planningEntityClass>
>
>> <!-- Score configuration -->
>> <scoreDirectorFactory>
>
<scoreDefinitionType>HARD_AND_SOFT</scoreDefinitionType>
>
<scoreDrl>/inspectionRules.drl</scoreDrl>
>> </scoreDirectorFactory>
>
>> <constructionHeuristic>
>
<constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType>
> <!--
constructionHeuristicPickEarlyType>FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING</constructionHeuristicPickEarlyType-->
>> </constructionHeuristic>
>
>> <localSearch>
>> <termination>
>
<terminationCompositionStyle>OR</terminationCompositionStyle>
>
<maximumSecondsSpend>3600</maximumSecondsSpend>
>
<scoreAttained>0hard/0soft</scoreAttained>
> </termination>
> <unionMoveSelector>
> <changeMoveSelector>
> <valueSelector>
>
<planningVariableName>period</planningVariableName>
> </valueSelector>
> </changeMoveSelector>
> <changeMoveSelector>
> <valueSelector>
>
<planningVariableName>spector</planningVariableName>
> </valueSelector>
> </changeMoveSelector>
> <changeMoveSelector>
> <valueSelector>
>
<planningVariableName>type</planningVariableName>
>> </valueSelector>
>> </changeMoveSelector>
>> <swapMoveSelector>
>> </swapMoveSelector>
>> </unionMoveSelector>
>
>> <acceptor>
>
<planningEntityTabuSize>7</planningEntityTabuSize>
>> </acceptor>
>> <forager>
>
<minimalAcceptedSelection>1000</minimalAcceptedSelection>
>> </forager>
>> </localSearch>
>
>></solver>
>
>> Any thoughts on what I'm doing wrong?
>
>>Thanks
>
>>Michiel
>
>>-----------------
>>http://www.codessentials.com - Your essential software, for free!
>>Follow us at
http://twitter.com/#!/Codessentials
>
>
>>_______________________________________________
rules-users mailing list rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users