Questo contenuto non è disponibile nella lingua selezionata.
Chapter 19. Migration Guide
19.1. About the Business Resource Planner Migration Copia collegamentoCollegamento copiato negli appunti!
From Red Hat JBoss BRMS and Red Hat JBoss BPM Suite 6.1 onwards, Business Resource Planner is fully supported. Business Resource Planner is a lightweight, embeddable constraint satisfaction engine that is able to solve planning problems. Business Resource Planner includes a public API, which will be backwards compatible in later versions such as 6.2 and 6. For more information, see the Business Resource Planner documentation.
The following changes should be noted for implementation in JBoss BPM Suite/JBoss BRMS 6.1 onwards:
- Simulated Annealing now uses the time gradient of the current step instead of the time gradient of the last step. The impact of this change is negligible.
-
On AbstractScore, the methods
parseLevelStrings(…)
andbuildScorePattern(…)
have been changed from public to protected. It is highly unlikely that this affects your code. -
The
Descriptor
classes have been moved into a descriptor package.SolutionDescriptor.isInitialized(Solution)
now requires aScoreDirector
parameter. - There is now a better alternative to Brute Force: Branch And Bound, see docs for more information.
-
InverseRelationShadowVariableListener
has been renamed toSingletonInverseVariableListener
. It, andInverseRelationShadowVariableDescriptor
have moved to the package...impl.domain.variable.inverserelation
. -
The
ConstraintOccurrence
classes (which were deprecated) have been remove, and should be switched to theConstraintMatch
system. The interface
Solution
has been promoted to the public API. It has also moved package fromimpl.solution
toapi.domain.solution
.Previously in
*.java
:import org.optaplanner.core.impl.solution.Solution;
import org.optaplanner.core.impl.solution.Solution;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:import org.optaplanner.core.api.domain.solution.Solution;
import org.optaplanner.core.api.domain.solution.Solution;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow All classes in the package
impl.move
have been moved toimpl.heuristic.move
. None of them are future-proof enough at this time to be added the public API. Prefer generic moves whenever possible.Previously in
*.java
:import org.optaplanner.core.impl.move.Move; import org.optaplanner.core.impl.move.CompositeMove; import org.optaplanner.core.impl.move.NoChangeMove;
import org.optaplanner.core.impl.move.Move; import org.optaplanner.core.impl.move.CompositeMove; import org.optaplanner.core.impl.move.NoChangeMove;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:import org.optaplanner.core.impl.heuristic.move.Move; import org.optaplanner.core.impl.heuristic.move.CompositeMove; import org.optaplanner.core.impl.heuristic.move.NoChangeMove;
import org.optaplanner.core.impl.heuristic.move.Move; import org.optaplanner.core.impl.heuristic.move.CompositeMove; import org.optaplanner.core.impl.heuristic.move.NoChangeMove;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow All classpath resources must lose their leading slash, because Business Resource Planner now expects them to adhere to
ClassLoader.getResource(String)
instead ofClass.getResource(String)
.The
SolverFactory.createFromXmlResource(String)
parameter must lose its leading slash.Previously in
*.java
:... = SolverFactory.createFromXmlResource( "/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
... = SolverFactory.createFromXmlResource( "/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:... = SolverFactory.createFromXmlResource( "org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
... = SolverFactory.createFromXmlResource( "org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow All elements
<scoreDrl>
must lose their leading slash.Previously in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<scoreDrl>/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
<scoreDrl>/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<scoreDrl>org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
<scoreDrl>org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
PlannerBenchmarkFactory.createFromXmlResource(String)
parameter must lose its leading slash.Previously in
*.java
:... = PlannerBenchmarkFactory.createFromXmlResource( "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
... = PlannerBenchmarkFactory.createFromXmlResource( "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:... = PlannerBenchmarkFactory.createFromXmlResource( "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
... = PlannerBenchmarkFactory.createFromXmlResource( "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
PlannerBenchmarkFactory.createFromFreemarkerXmlResource(String)
parameter must lose its leading slash.Previously in
*.java
:... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource( "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource( "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource( "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource( "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The
@PlanningVariable
property chained has been refactored tographType
. This is to allow support for other graph types (such as TREE) in the future.Previously in
*.java
:@PlanningVariable(chained = true, ...) public Standstill getPreviousStandstill() { return previousStandstill; }
@PlanningVariable(chained = true, ...) public Standstill getPreviousStandstill() { return previousStandstill; }
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:@PlanningVariable(graphType = PlanningVariableGraphType.CHAINED, ...) public Standstill getPreviousStandstill() { return previousStandstill; }
@PlanningVariable(graphType = PlanningVariableGraphType.CHAINED, ...) public Standstill getPreviousStandstill() { return previousStandstill; }
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
constructionHeuristicType
BEST_FIT
has been renamed intoWEAKEST_FIT
. The terminology “Best Fit” was not correct and did not allow forSTRONGEST_FIT
.Previously in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<constructionHeuristic> <constructionHeuristicType>BEST_FIT</constructionHeuristicType> </constructionHeuristic>
<constructionHeuristic> <constructionHeuristicType>BEST_FIT</constructionHeuristicType> </constructionHeuristic>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<constructionHeuristic> <constructionHeuristicType>WEAKEST_FIT</constructionHeuristicType> </constructionHeuristic>
<constructionHeuristic> <constructionHeuristicType>WEAKEST_FIT</constructionHeuristicType> </constructionHeuristic>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
constructionHeuristicType
BEST_FIT_DECREASING
has been renamed intoWEAKEST_FIT_DECREASING
. The terminology “Best Fit” was not correct and did not allow forSTRONGEST_FIT_DECREASING
.Previously in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<constructionHeuristic> <constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType> </constructionHeuristic>
<constructionHeuristic> <constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType> </constructionHeuristic>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<constructionHeuristic> <constructionHeuristicType>WEAKEST_FIT_DECREASING</constructionHeuristicType> </constructionHeuristic>
<constructionHeuristic> <constructionHeuristicType>WEAKEST_FIT_DECREASING</constructionHeuristicType> </constructionHeuristic>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For the shadow variable of a bi-directional relationship, the declaration has changed from
@PlanningVariable(mappedBy)
to@InverseRelationShadowVariable(sourceVariableName)
.Previously in
*.java
:@PlanningVariable(mappedBy = "previousStandstill") Customer getNextCustomer(); void setNextCustomer(Customer nextCustomer);
@PlanningVariable(mappedBy = "previousStandstill") Customer getNextCustomer(); void setNextCustomer(Customer nextCustomer);
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:@InverseRelationShadowVariable(sourceVariableName = "previousStandstill") Customer getNextCustomer(); void setNextCustomer(Customer nextCustomer);
@InverseRelationShadowVariable(sourceVariableName = "previousStandstill") Customer getNextCustomer(); void setNextCustomer(Customer nextCustomer);
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Multiple
<planningEntityClass>
elements now need to be ordered by superclasses (and superinterfaces) first, instead of superclasses (and superinterfaces) last.Previously in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<planningEntityClass>...TimeWindowedCustomer</planningEntityClass> <planningEntityClass>...Customer</planningEntityClass> <planningEntityClass>...Standstill</planningEntityClass>
<planningEntityClass>...TimeWindowedCustomer</planningEntityClass> <planningEntityClass>...Customer</planningEntityClass> <planningEntityClass>...Standstill</planningEntityClass>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<planningEntityClass>...Standstill</planningEntityClass> <planningEntityClass>...Customer</planningEntityClass> <planningEntityClass>...TimeWindowedCustomer</planningEntityClass>
<planningEntityClass>...Standstill</planningEntityClass> <planningEntityClass>...Customer</planningEntityClass> <planningEntityClass>...TimeWindowedCustomer</planningEntityClass>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The element
<planningEntityClass>
has been renamed to<entityClass>
.Previously in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<planningEntityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</planningEntityClass>
<planningEntityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</planningEntityClass>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*SolverConfig.xml
and*BenchmarkConfig.xml
:<entityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</entityClass>
<entityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</entityClass>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow XStreamScoreConverter
andXStreamBendableScoreConverter
have moved package.Previously in
*.java
:import org.optaplanner.persistence.xstream.XStreamScoreConverter;
import org.optaplanner.persistence.xstream.XStreamScoreConverter;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:import org.optaplanner.persistence.xstream.impl.score.XStreamScoreConverter;
import org.optaplanner.persistence.xstream.impl.score.XStreamScoreConverter;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Previously in
*.java
:import org.optaplanner.persistence.xstream.XStreamBendableScoreConverter;
import org.optaplanner.persistence.xstream.XStreamBendableScoreConverter;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:import org.optaplanner.persistence.xstream.impl.score.XStreamBendableScoreConverter;
import org.optaplanner.persistence.xstream.impl.score.XStreamBendableScoreConverter;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you have a custom Move implementation, now extract
AbstractMove
.Previously in
*.java
:public class CloudComputerChangeMove implements Move {...}
public class CloudComputerChangeMove implements Move {...}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Now in
*.java
:public class CloudComputerChangeMove extends AbstractMove {...}
public class CloudComputerChangeMove extends AbstractMove {...}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
19.2. Planning Values and Value Ranges Copia collegamentoCollegamento copiato negli appunti!
19.2.1. ValueRangeProvider Copia collegamentoCollegamento copiato negli appunti!
If you have a @ValueRangeProvider
that returns a collection of numbers (for example List<Integer>
or List<BigDecimal>
), then you should switch to a ValueRange
, which uses less memory and offers additional opportunities.
For example:
Is changed to:
@ValueRangeProvider(id = "delayRange") public CountableValueRange<Integer> getDelayRange() { return ValueRangeFactory.createIntValueRange(0, 5000); }
@ValueRangeProvider(id = "delayRange")
public CountableValueRange<Integer> getDelayRange() {
return ValueRangeFactory.createIntValueRange(0, 5000);
}
The annotation @ValueRangeProvider
has been moved into another package, from:
import org.optaplanner.core.api.domain.value.ValueRangeProvider;
import org.optaplanner.core.api.domain.value.ValueRangeProvider;
to
import org.optaplanner.core.api.domain.valuerange.ValueRangeProvider;
import org.optaplanner.core.api.domain.valuerange.ValueRangeProvider;
19.2.2. Planning Variables Copia collegamentoCollegamento copiato negli appunti!
The interface PlanningVariableListener
has been renamed to VariableListener
.
Previously in *.java
:
public class VehicleUpdatingVariableListener implements PlanningVariableListener<Customer> {
public class VehicleUpdatingVariableListener implements PlanningVariableListener<Customer> {
Now in *.java
:
public class VehicleUpdatingVariableListener implements VariableListener<Customer> {
public class VehicleUpdatingVariableListener implements VariableListener<Customer> {
The class AbstractPlanningVariableListener has been removed.
Previously in *.java
:
public class VehicleUpdatingVariableListener extends AbstractPlanningVariableListener<Customer> {
public class VehicleUpdatingVariableListener extends AbstractPlanningVariableListener<Customer> {
Now in *.java
:
public class VehicleUpdatingVariableListener implements VariableListener<Customer> {
public class VehicleUpdatingVariableListener implements VariableListener<Customer> {
The VariableListener is now declared on the shadow side, instead of the @PlanningVariable
side. This way, Business Rules Planner recognizes the shadow variables, and all shadow variables are declared in a consistent matter. Furthermore, it allows a shadow variable to based on other shadow variable.
Previously in *.java
:
Now in *.java
:
There is now out-of-the-box support for a shadow variable representing the anchor of a chained variable. For example, in a VRP each Customer (= entity) needs to know to which Vehicle (= anchor) it belongs. This declarative support allows build-in selectors to reuse that knowledge without duplicating the calculation.
Previously in *.java
:
Now in *.java
:
To scale VRP cases, Nearby Selection is critical. It is now finally completely supported and documented.
19.3. Benchmark Copia collegamentoCollegamento copiato negli appunti!
The internals of Benchmark have been deeply refactored to support the new aggregator functionality.
- The phrase "time spend" has been renamed to "time spent". This includes the log output and the benchmark report.
The <warmUp*>
elements have been renamed:
- The element <warmUpTimeMillisSpend> has been renamed to <warmUpMillisecondsSpentLimit>
- The element <warmUpSecondsSpend> has been renamed to <warmUpSecondsSpentLimit>
- The element <warmUpMinutesSpend> has been renamed to <warmUpMinutesSpentLimit>
- The element <warmUpHoursSpend> has been renamed to <warmUpHoursSpentLimit>
Previously in *BenchmarkConfig.xml
Now in *BenchmarkConfig.xml
:
The class XmlPlannerBenchmarkFactory
has been removed and replaced by static methods on PlannerBenchmarkFactory
.
Previously in *.java
:
PlannerBenchmarkFactory plannerBenchmarkFactory = new XmlPlannerBenchmarkFactory(...);
PlannerBenchmarkFactory plannerBenchmarkFactory = new XmlPlannerBenchmarkFactory(...);
Now in *.java
:
PlannerBenchmarkFactory plannerBenchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource(...);
PlannerBenchmarkFactory plannerBenchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource(...);
If you used the method addXstreamAnnotations()
, take a look at the non-public API class XStreamXmlPlannerBenchmarkFactory
.
The element <xstreamAnnotatedClass>
has been renamed to <xStreamAnnotatedClass>
.
Previously in *BenchmarkConfig.xml
<problemBenchmarks> <xstreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xstreamAnnotatedClass> ... </problemBenchmarks>
<problemBenchmarks>
<xstreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xstreamAnnotatedClass>
...
</problemBenchmarks>
Now in *BenchmarkConfig.xml
:
<problemBenchmarks> <xStreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xStreamAnnotatedClass> ... </problemBenchmarks>
<problemBenchmarks>
<xStreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xStreamAnnotatedClass>
...
</problemBenchmarks>
19.3.1. SolutionFileIO Copia collegamentoCollegamento copiato negli appunti!
ProblemIO
has been renamed to SolutionFileIO
and moved package (into the public API).
Previously in *.java
:
import org.optaplanner.core.impl.solution.ProblemIO; public class MachineReassignmentFileIO implements ProblemIO { ... }
import org.optaplanner.core.impl.solution.ProblemIO;
public class MachineReassignmentFileIO implements ProblemIO {
...
}
Now in *.java
:
import org.optaplanner.persistence.common.api.domain.solution.SolutionFileIO; public class MachineReassignmentFileIO implements SolutionFileIO { ... }
import org.optaplanner.persistence.common.api.domain.solution.SolutionFileIO;
public class MachineReassignmentFileIO implements SolutionFileIO {
...
}
Now in *.java
:
Previously in *SolverConfig.xml
and *BenchmarckConfig.xml
:
<problemBenchmarks> <problemIOClass>...MachineReassignmentProblemIO</problemIOClass> ... </problemBenchmarks>
<problemBenchmarks>
<problemIOClass>...MachineReassignmentProblemIO</problemIOClass>
...
</problemBenchmarks>
Now in *SolverConfig.xml
and *BenchmarckConfig.xml
:
<problemBenchmarks> <solutionFileIOClass>...MachineReassignmentFileIO</solutionFileIOClass> ... </problemBenchmarks>
<problemBenchmarks>
<solutionFileIOClass>...MachineReassignmentFileIO</solutionFileIOClass>
...
</problemBenchmarks>
The method SolutionFileIO.getFileExtension()
has been split up in getInputFileExtension()
and getOutputFileExtension();
. It is still highly recommended to use the same input and output file extension.
Previously in *.java
:
public String getFileExtension() { return FILE_EXTENSION; }
public String getFileExtension() {
return FILE_EXTENSION;
}
Now in *.java
:
19.4. Solver Configuration Copia collegamentoCollegamento copiato negli appunti!
In Solver and BestSolutionChangedEvent, the method getTimeMillisSpend()
has been renamed to getTimeMillisSpent()
.
Previously in *.java
:
... = solver.getTimeMillisSpend();
... = solver.getTimeMillisSpend();
Now in *.java
:
... = solver.getTimeMillisSpent();
... = solver.getTimeMillisSpent();
Previously in *.java
:
public void bestSolutionChanged(BestSolutionChangedEvent event) { ... = event.getTimeMillisSpend(); }
public void bestSolutionChanged(BestSolutionChangedEvent event) {
... = event.getTimeMillisSpend();
}
Now in *.java
:
public void bestSolutionChanged(BestSolutionChangedEvent event) { ... = event.getTimeMillisSpent(); }
public void bestSolutionChanged(BestSolutionChangedEvent event) {
... = event.getTimeMillisSpent();
}
The solver phase <bruteForce>
has been replaced by <exhaustiveSearch>
's BRUTE_FORCE
type.
Previously in *SolverConfig.xml
and *BenchmarkConfig.xml
:
<bruteForce/>
<bruteForce/>
Now in *SolverConfig.xml
and *BenchmarkConfig.xml
:
<exhaustiveSearch> <exhaustiveSearchType>BRUTE_FORCE</exhaustiveSearchType> </exhaustiveSearch>
<exhaustiveSearch>
<exhaustiveSearchType>BRUTE_FORCE</exhaustiveSearchType>
</exhaustiveSearch>
The methods setPlanningProblem(Solution)
and solve()
have been merged as the method solve(Solution)
.
Previously in *.java
:
solver.setPlanningProblem(planningProblem); solver.solve();
solver.setPlanningProblem(planningProblem);
solver.solve();
Now in *.java
:
solver.solve(planningProblem);
solver.solve(planningProblem);
You still need to use solver.getBestSolution()
to retrieve the best solution. That is intentional due to real-time planning and to support pare to optimization in the future.
The class XmlSolverFactory
(which was not part of the public API) has been removed and replaced by static methods on SolverFactory
(which are part of the public API).
Previously in *.java
:
SolverFactory solverFactory = new XmlSolverFactory("...solverConfig.xml");
SolverFactory solverFactory = new XmlSolverFactory("...solverConfig.xml");
Now in *.java
:
SolverFactory solverFactory = SolverFactory.createFromXmlResource("...solverConfig.xml");
SolverFactory solverFactory = SolverFactory.createFromXmlResource("...solverConfig.xml");
Previously in *.java
:
SolverFactory solverFactory = new XmlSolverFactory().configure(inputStream);
SolverFactory solverFactory = new XmlSolverFactory().configure(inputStream);
Now in *.java
:
SolverFactory solverFactory = SolverFactory.createFromXmlInputStream(inputStream);
SolverFactory solverFactory = SolverFactory.createFromXmlInputStream(inputStream);
Previously in *.java
:
SolverFactory solverFactory = new XmlSolverFactory().configure(reader);
SolverFactory solverFactory = new XmlSolverFactory().configure(reader);
Now in *.java
:
SolverFactory solverFactory = SolverFactory.createFromXmlReader(reader);
SolverFactory solverFactory = SolverFactory.createFromXmlReader(reader);
If you used the method addXstreamAnnotations()
, take a look at the non-public API class XStreamXmlSolverFactory
.
The following changes have been made to the Custom SolverPhase:
-
The interface
CustomSolverPhaseCommand
has been renamed toCustomPhaseCommand
. -
The element
<customSolverPhase>
has been renamed to<customPhase>
. -
The element
<customSolverPhaseCommandClass>
has been renamed to>customPhaseCommandClass>
.
Previously in *.java
:
public class ToOriginalMachineSolutionInitializer implements CustomSolverPhaseCommand { ... }
public class ToOriginalMachineSolutionInitializer implements CustomSolverPhaseCommand {
...
}
Now in *.java
:
public class ToOriginalMachineSolutionInitializer implements CustomPhaseCommand { ... }
public class ToOriginalMachineSolutionInitializer implements CustomPhaseCommand {
...
}
Previously in *SolverConfig.xml
and *BenchmarkConfig.xml
:
<customSolverPhase> <customSolverPhaseCommandClass>...ToOriginalMachineSolutionInitializer</customSolverPhaseCommandClass> </customSolverPhase>
<customSolverPhase>
<customSolverPhaseCommandClass>...ToOriginalMachineSolutionInitializer</customSolverPhaseCommandClass>
</customSolverPhase>
Now in *SolverConfig.xml
and *BenchmarkConfig.xml
:
<customPhase> <customPhaseCommandClass>....ToOriginalMachineSolutionInitializer</customPhaseCommandClass> </customPhase>
<customPhase>
<customPhaseCommandClass>....ToOriginalMachineSolutionInitializer</customPhaseCommandClass>
</customPhase>
The method ScoreDefinition.getLevelCount()
has been renamed to ScoreDefinition.getLevelsSize()
.
19.5. Optimization Copia collegamentoCollegamento copiato negli appunti!
19.5.1. Termination Copia collegamentoCollegamento copiato negli appunti!
All child elements of <termination>
have been renamed:
-
The element
<maximumTimeMillisSpend>
has been renamed to<millisecondsSpentLimit>
-
The element
<maximumSecondsSpend>
has been renamed to<secondsSpentLimit>
-
The element
<maximumMinutesSpend>
has been renamed to<minutesSpentLimit>
-
The element
<maximumHoursSpend>
has been renamed to<hoursSpentLimit>
-
The element
<scoreAttained>
has been renamed to<bestScoreLimit>
-
The element
<maximumStepCount>
has been renamed to<stepCountLimit>
-
The element
<maximumUnimprovedStepCount>
has been renamed to<unimprovedStepCountLimit>
Configuration in *SolverConfig.xml
and *BenchmarkConfig.xml
has changed from:
to:
19.5.2. Events Copia collegamentoCollegamento copiato negli appunti!
Classes BestSolutionChangedEvent
and SolverEventListener
moved from package impl.event to api.solver.event
. They are now part of the public api.
Previously in *.java
:
import org.optaplanner.core.impl.event.BestSolutionChangedEvent; import org.optaplanner.core.impl.event.SolverEventListener;
import org.optaplanner.core.impl.event.BestSolutionChangedEvent;
import org.optaplanner.core.impl.event.SolverEventListener;
Now in *.java
:
import org.optaplanner.core.api.solver.event.BestSolutionChangedEvent; import org.optaplanner.core.api.solver.event.SolverEventListener;
import org.optaplanner.core.api.solver.event.BestSolutionChangedEvent;
import org.optaplanner.core.api.solver.event.SolverEventListener;
19.5.3. Score Trends Copia collegamentoCollegamento copiato negli appunti!
Specify an <initializingScoreTrend>
in the <scoreDirectorFactory>
to increase performance of some algorithms (Construction Heuristics and Exhaustive Search).
See the documentation section on InitializingScoreTrend
when to use ANY
, ONLY_UP
, or ONLY_DOWN
.
Previously in *SolverConfig.xml
and *BenchmarkConfig.xml
:
<scoreDirectorFactory> <scoreDefinitionType>HARD_SOFT</scoreDefinitionType> <scoreDrl>.../cloudBalancingScoreRules.drl</scoreDrl> </scoreDirectorFactory>
<scoreDirectorFactory>
<scoreDefinitionType>HARD_SOFT</scoreDefinitionType>
<scoreDrl>.../cloudBalancingScoreRules.drl</scoreDrl>
</scoreDirectorFactory>
Now in *SolverConfig.xml
and *BenchmarkConfig.xml
:
<scoreDirectorFactory> <scoreDefinitionType>HARD_SOFT</scoreDefinitionType> <scoreDrl>.../cloudBalancingScoreRules.drl</scoreDrl> <initializingScoreTrend>ONLY_DOWN</initializingScoreTrend> </scoreDirectorFactory>
<scoreDirectorFactory>
<scoreDefinitionType>HARD_SOFT</scoreDefinitionType>
<scoreDrl>.../cloudBalancingScoreRules.drl</scoreDrl>
<initializingScoreTrend>ONLY_DOWN</initializingScoreTrend>
</scoreDirectorFactory>
Replace <pickEarlyType>
FIRST_NON_DETERIORATING_SCORE
with <initializingScoreTrend>
ONLY_DOWN
. If the <initializingScoreTrend>
is specified, the <constructionHeuristic>
will automatically use the most appropriate <pickEarlyType>
.
Previously in *SolverConfig.xml
and *BenchmarkConfig.xml
:
Now in *SolverConfig.xml
and *BenchmarkConfig.xml
:
19.5.4. Score Calculator Copia collegamentoCollegamento copiato negli appunti!
The interface SimpleScoreCalculator
has been renamed to EasyScoreCalculator
to avoid confusion with SimpleScore
and SimpleScore:
it can return other Score types. The package name has also changed.
Previously in *.java
:
import org.optaplanner.core.impl.score.director.simple.SimpleScoreCalculator; public class CloudBalancingEasyScoreCalculator implements SimpleScoreCalculator<CloudBalance> { ... }
import org.optaplanner.core.impl.score.director.simple.SimpleScoreCalculator;
public class CloudBalancingEasyScoreCalculator implements SimpleScoreCalculator<CloudBalance> {
...
}
Now in *.java
:
import org.optaplanner.core.impl.score.director.easy.EasyScoreCalculator; public class CloudBalancingEasyScoreCalculator implements EasyScoreCalculator<CloudBalance> { ... }
import org.optaplanner.core.impl.score.director.easy.EasyScoreCalculator;
public class CloudBalancingEasyScoreCalculator implements EasyScoreCalculator<CloudBalance> {
...
}
Previously in *SolverConfig.xml
and *BenchmarkConfig.xml
:
<simpleScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.solver.score.CloudBalancingEasyScoreCalculator<simpleScoreCalculatorClass>
<simpleScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.solver.score.CloudBalancingEasyScoreCalculator<simpleScoreCalculatorClass>
Now in *SolverConfig.xml
and *BenchmarkConfig.xml
:
<easyScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.solver.score.CloudBalancingEasyScoreCalculator
<easyScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.solver.score.CloudBalancingEasyScoreCalculator
The BendableScore
configuration has changed: …LevelCount
has been renamed to …LevelsSize
.
Previously in *SolverConfig.xml
and *BenchmarkConfig.xml
:
Now in *SolverConfig.xml
and *BenchmarkConfig.xml
: