I have been trying to implement a custom Construction Heuristic
in Optaplanner on a problem similar to the Nurse Rostering one.
Everything seems to be annotated correctly, and is added to the SolverConfiguration
, but i keep getting this error:
Exception in thread "main" java.lang.IllegalArgumentException: A planning entity is an instance of an entitySubclass (class java.lang.Integer) that is not configured as a planning entity.
If that class (Integer) (or superclass thereof) is not a entityClass ([class org.optaplanner.examples.nurserostering.domain.SkillRequirement, class org.optaplanner.examples.nurserostering.domain.ShiftAssignment]), check your Solution implementation's annotated methods.
If it is, check your solver configuration.
at org.optaplanner.core.impl.domain.solution.descriptor.SolutionDescriptor.findEntityDescriptorOrFail(SolutionDescriptor.java:398)
at org.optaplanner.core.impl.domain.solution.descriptor.SolutionDescriptor.findVariableDescriptorOrFail(SolutionDescriptor.java:443)
at org.optaplanner.core.impl.score.director.AbstractScoreDirector.beforeVariableChanged(AbstractScoreDirector.java:226)
at org.optaplanner.examples.nurserostering.domain.solver.CustomConstructionHeuristic.changeWorkingSolution (CustomConstructionHeuristic.java:86)
at org.optaplanner.core.impl.phase.custom.DefaultCustomPhase.doStep(DefaultCustomPhase.java:89)
at org.optaplanner.core.impl.phase.custom.DefaultCustomPhase.solve(DefaultCustomPhase.java:71)
at org.optaplanner.core.impl.solver.DefaultSolver.runPhases(DefaultSolver.java:214)
at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:176)
at org.optaplanner.examples.nurserostering.app.NurseRosterConsoleApp.main(NurseRosterConsoleApp.java:142)
I tried to fix it by using these references:
OptaPlanner Xml configuration and entitySubclass is not configured as a planning entity error
OptaPlanner: java.lang.IllegalArgumentException
https://groups.google.com/forum/#!topic/optaplanner-dev/wCdeSQhGdaQ
So far nothing worked. Any clues on how i can solve this?