1

I am new to OptaPlanner and having some diffculty in configuring the solution. I have anotated all of the classes correctly but I am getting the following error when the solver runs.

A planning entity is an instance of a entitySubclass (class 
org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector) that is not 
configured as a planning entity.
If that class (DroolsScoreDirector) (or superclass thereof) is not a entityClass 
([...Part]), check your Solution implementation's annotated methods.
If it is, check your solver configuration

Here is the xml configuration I am currently using.

<?xml version="1.0" encoding="UTF-8"?>
<solver>
    <solutionClass>(package name).SheetNesting</solutionClass>
    <planningEntityClass>(package name).Part</planningEntityClass>
    <scoreDirectorFactory>
        <scoreDefinitionType>HARD_SOFT</scoreDefinitionType>
        <scoreDrl>/Resources/Drools/NestingRules.drl</scoreDrl>
    </scoreDirectorFactory>
    <termination>
        <maximumSecondsSpend>500</maximumSecondsSpend>
    </termination>
    <constructionHeuristic>
        <constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
    </constructionHeuristic>
    <localSearch>
    <unionMoveSelector>
      <changeMoveSelector>
        <valueSelector>
          <variableName>sheet</variableName>
        </valueSelector>
      </changeMoveSelector>
      <moveListFactory>
          <moveListFactoryClass>(package name).XPosMoveFactory</moveListFactoryClass>
      </moveListFactory>
      <moveListFactory>
          <moveListFactoryClass>(package name).YPosMoveFactory</moveListFactoryClass>
      </moveListFactory>
    </unionMoveSelector>
    <acceptor>
      <lateAcceptanceSize>600</lateAcceptanceSize>
    </acceptor>
    <forager>
      <acceptedCountLimit>4</acceptedCountLimit>
    </forager>
  </localSearch>
</solver>

The output shows that the solution establishes (possible evaluates Phase(0) but then the error is thrown. Any help will be appreciated.

*EDIT Firstly thank you for your comments. The definition of the Part class is as follows

@PlanningEntity(difficultyComparatorClass = PartComparator.class)
public class Part 
{
     ....
    @PlanningVariable(valueRangeProviderRefs = {"sheetRange"})
    public Sheet getSheet()
    {
        ....
    }


    @PlanningVariable(valueRangeProviderRefs = {"xPosRange"})
    public double getXCenter()
    {
        ....
    }

    @PlanningVariable(valueRangeProviderRefs = {"yPosRange"})
    public double getYCenter()
    {
        ....
    }
}

As you can see the class is fully annotated, as described. This is why I believed the issue was with the configuration.

Jon
  • 95
  • 8
  • Are you sure your config matches the error you pasted? The message `entitySubclass (class ...DroolsScoreDirector)` is impossible with that config. A DroolsScoreDirector is never a planning entity. – Geoffrey De Smet Jun 10 '14 at 06:55
  • I have cleaned and rebuilt the application just to ensure that I was not loading a different configuration. To double check I also made a modification to the config, to target a different calss. All tests showed that the correct config was being loaded in. – Jon Jun 10 '14 at 09:40

2 Answers2

1

Seems like the error it's telling you that your (package name).Part class is not annotated with @PlanningEntity and @PlanningVariable as described in the documentation: http://docs.jboss.org/drools/release/6.0.1.Final/optaplanner-docs/html_single/index.html#planningEntity

If your class is correctly annotated please share it with us in your question.

cego
  • 194
  • 7
1

The error message for the problem was a little missleading. However, it was accurate. The issue was being caused by a component of the configuration and was a complete oversight on my part.

The custom move methods were passing the score director through to the beforeVariableChanged(object, string) method, instead of the Part class.

Thank you for your help.

Jon
  • 95
  • 8