From b738a211a2d7f331dee1838fb0acddcf4e27700c Mon Sep 17 00:00:00 2001 From: Geoffrey De Smet Date: Tue, 16 Jun 2015 15:08:33 +0200 Subject: [PATCH] PLANNER-352 use field annotations on the cheap time example (=> integration test) + add in docs overview --- .../Chapter-Use_cases_and_examples.xml | 45 ++++++++++++++----- .../cheaptime/domain/CheapTimeSolution.java | 4 +- .../cheaptime/domain/TaskAssignment.java | 6 +-- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/optaplanner-docs/src/main/docbook/en-US/Chapter-Use_cases_and_examples/Chapter-Use_cases_and_examples.xml b/optaplanner-docs/src/main/docbook/en-US/Chapter-Use_cases_and_examples/Chapter-Use_cases_and_examples.xml index feb8be6bd5..0c291d9a69 100755 --- a/optaplanner-docs/src/main/docbook/en-US/Chapter-Use_cases_and_examples/Chapter-Use_cases_and_examples.xml +++ b/optaplanner-docs/src/main/docbook/en-US/Chapter-Use_cases_and_examples/Chapter-Use_cases_and_examples.xml @@ -206,7 +206,7 @@ - Decision Table spreadsheet for score constraints + Decision Table spreadsheet (XLS) for score constraints @@ -396,12 +396,20 @@ - VariableListener + Shadow variable Real-time planning + + + Nearby selection + + + + Real road distances + @@ -438,13 +446,9 @@ - - - VariableListener - - + Extra on Vehicle routing: - Real-time planning + Custom VariableListener @@ -496,7 +500,11 @@ - VariableListener + Custom VariableListener + + + + ValueRangeFactory @@ -585,7 +593,7 @@ - VariableListener + Custom VariableListener @@ -675,7 +683,11 @@ - None + + + Custom MoveListFactory + + @@ -715,7 +727,15 @@ - None + + + Field annotations + + + + ValueRangeFactory + + @@ -1723,6 +1743,7 @@ testdata11 has 4 specialisms, 4 equipments, 4 departments, 107 rooms, 318 beds, testdata12 has 4 specialisms, 4 equipments, 4 departments, 105 rooms, 310 beds, 84 nights, 2750 patients and 2750 admissions with a search space of 10^6851. testdata13 has 5 specialisms, 4 equipments, 5 departments, 125 rooms, 368 beds, 28 nights, 907 patients and 1109 admissions with a search space of 10^2845. +
Domain Model diff --git a/optaplanner-examples/src/main/java/org/optaplanner/examples/cheaptime/domain/CheapTimeSolution.java b/optaplanner-examples/src/main/java/org/optaplanner/examples/cheaptime/domain/CheapTimeSolution.java index 84ea26d889..a2e40fa900 100644 --- a/optaplanner-examples/src/main/java/org/optaplanner/examples/cheaptime/domain/CheapTimeSolution.java +++ b/optaplanner-examples/src/main/java/org/optaplanner/examples/cheaptime/domain/CheapTimeSolution.java @@ -40,6 +40,7 @@ public class CheapTimeSolution extends AbstractPersistable implements Solution resourceList; + @ValueRangeProvider(id = "machineRange") private List machineList; private List machineCapacityList; private List taskList; @@ -47,6 +48,7 @@ public class CheapTimeSolution extends AbstractPersistable implements Solution periodPowerPriceList; + @PlanningEntityCollectionProperty private List taskAssignmentList; @XStreamConverter(value = XStreamScoreConverter.class, types = {HardMediumSoftLongScoreDefinition.class}) @@ -80,7 +82,6 @@ public List getResourceList() { return resourceList; } - @ValueRangeProvider(id = "machineRange") public List getMachineList() { return machineList; } @@ -125,7 +126,6 @@ public void setPeriodPowerPriceList(List periodPowerPriceList) this.periodPowerPriceList = periodPowerPriceList; } - @PlanningEntityCollectionProperty public List getTaskAssignmentList() { return taskAssignmentList; } diff --git a/optaplanner-examples/src/main/java/org/optaplanner/examples/cheaptime/domain/TaskAssignment.java b/optaplanner-examples/src/main/java/org/optaplanner/examples/cheaptime/domain/TaskAssignment.java index 76ac32de8c..caf3553fe2 100644 --- a/optaplanner-examples/src/main/java/org/optaplanner/examples/cheaptime/domain/TaskAssignment.java +++ b/optaplanner-examples/src/main/java/org/optaplanner/examples/cheaptime/domain/TaskAssignment.java @@ -32,7 +32,9 @@ public class TaskAssignment extends AbstractPersistable { private Task task; // Planning variables: changes during planning, between score calculations. + @PlanningVariable(valueRangeProviderRefs = {"machineRange"}) private Machine machine; + @PlanningVariable(valueRangeProviderRefs = {"startPeriodRange"}) private Integer startPeriod; public Task getTask() { @@ -43,7 +45,6 @@ public void setTask(Task task) { this.task = task; } - @PlanningVariable(valueRangeProviderRefs = {"machineRange"}) public Machine getMachine() { return machine; } @@ -52,7 +53,6 @@ public void setMachine(Machine machine) { this.machine = machine; } - @PlanningVariable(valueRangeProviderRefs = {"startPeriodRange"}) public Integer getStartPeriod() { return startPeriod; } @@ -85,7 +85,7 @@ public String getLabel() { // ************************************************************************ @ValueRangeProvider(id = "startPeriodRange") - public CountableValueRange getDelayRange() { + public CountableValueRange getStartPeriodRange() { return ValueRangeFactory.createIntValueRange(task.getStartPeriodRangeFrom(), task.getStartPeriodRangeTo()); }