I'm trying to implement something like NurseRostering in example, so I did everything the same except of classes in 'solver/drools&moves' (also can someone explain what they do exactly?).
So, my problem is, I implemented Comparators: EmployeeStrengthComparator and JobDifficultyComparator, they are like EmployeeStrengthComparator and ShiftAssignmentDifficultyComparator in NurseRostering example.
So I set up my rules, my solution, and started to solve, but I get this error:
Exception in thread "main" java.lang.ClassCastException: org.demo.DemoApp.domain.JobAssignment cannot be cast to org.demo.DemoApp.domain.Employee
at org.demo.DemoApp.domain.solver.EmployeeStrengthComparator.compare(EmployeeStrengthComparator.java:12)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.util.TimSort.sort(TimSort.java:220)
at java.util.Arrays.sort(Arrays.java:1512)
at java.util.ArrayList.sort(ArrayList.java:1454)
at java.util.Collections.sort(Collections.java:175)
at org.optaplanner.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter.sort(ComparatorSelectionSorter.java:45)
at org.optaplanner.core.impl.heuristic.selector.value.decorator.SortingValueSelector.constructCache(SortingValueSelector.java:43)
at org.optaplanner.core.impl.heuristic.selector.common.SelectionCacheLifecycleBridge.phaseStarted(SelectionCacheLifecycleBridge.java:49)
at org.optaplanner.core.impl.phase.event.PhaseLifecycleSupport.firePhaseStarted(PhaseLifecycleSupport.java:39)
I hope somebody knows the reasons where did I go wrong, could provide more information\sources of course, but I guess the reason is pretty obvious, because I'm very new to this framework and could missed something in configurations may be.
UPD: so it was like:
@PlanningEntityCollectionProperty
@ValueRangeProvider(id = "employeeRange")
public List<JobAssignment> getJobAssignments() {
return jobAssignments;
}