[rules-users] Fw: proble with localSearch

Michiel Vermandel mvermand at yahoo.com
Wed Jan 9 02:21:19 EST 2013


Hi Geoffrey,


Thanks for your advice.
Indeed one of the planning variables is consistently null over all planning entities.
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 at gmail.com>
To: Michiel Vermandel <mvermand at yahoo.com>; Rules Users List <rules-users at 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 at lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130108/6b49ea89/attachment.html 


More information about the rules-users mailing list