@PlanningEntityProperty public TestdataEntity getSingleEntity() { return singleEntity; }
@PlanningSolution(solutionCloner = TestdataScoreNotClonedSolution.class) public class TestdataScoreNotClonedSolution implements SolutionCloner<TestdataScoreNotClonedSolution> { @PlanningScore private SimpleScore score; @PlanningEntityProperty private TestdataEntity entity = new TestdataEntity("A"); @ValueRangeProvider(id = "valueRange") @ProblemFactCollectionProperty public List<TestdataValue> valueRange() { return Collections.singletonList(new TestdataValue("1")); } @Override public TestdataScoreNotClonedSolution cloneSolution(TestdataScoreNotClonedSolution original) { TestdataScoreNotClonedSolution clone = new TestdataScoreNotClonedSolution(); clone.entity.setValue(original.entity.getValue()); return clone; } }
@PlanningSolution(solutionCloner = TestdataEntitiesNotClonedSolution.class) public class TestdataEntitiesNotClonedSolution implements SolutionCloner<TestdataEntitiesNotClonedSolution> { @PlanningScore private SimpleScore score; @PlanningEntityProperty private TestdataEntity entity = new TestdataEntity(); @ValueRangeProvider(id = "valueRange") @ProblemFactCollectionProperty public List<TestdataValue> valueRange() { // solver will never get to this point due to cloning corruption throw new UnsupportedOperationException("Not supported yet."); } @Override public TestdataEntitiesNotClonedSolution cloneSolution(TestdataEntitiesNotClonedSolution original) { TestdataEntitiesNotClonedSolution clone = new TestdataEntitiesNotClonedSolution(); clone.entity = original.entity; clone.score = original.score; return clone; } }
@PlanningScore private SimpleScore score; @PlanningEntityProperty private TestdataEntity entity = new TestdataEntity("A");
@PlanningEntityProperty private TestdataEntity entity = new TestdataEntity();