18.5. Optimization

18.5.1. Termination

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:
<termination>
    <maximumTimeMillisSpend>...</maximumTimeMillisSpend>
    <maximumSecondsSpend>...</maximumSecondsSpend>
    <maximumMinutesSpend>...</maximumMinutesSpend>
    <maximumHoursSpend>...</maximumHoursSpend>
    <scoreAttained>...</scoreAttained>
    <maximumStepCount>...</maximumStepCount>
    <maximumUnimprovedStepCount>...</maximumUnimprovedStepCount>
</termination>
to:
<termination>
    <millisecondsSpentLimit>...</millisecondsSpentLimit>
    <secondsSpentLimit>...</secondsSpentLimit>
    <minutesSpentLimit>...</minutesSpentLimit>
    <hoursSpentLimit>...</hoursSpentLimit>
    <bestScoreLimit>...</bestScoreLimit>
    <stepCountLimit>...</stepCountLimit>
    <unimprovedStepCountLimit>...</unimprovedStepCountLimit>
</termination>

18.5.2. Events

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;
Now in *.java:
import org.optaplanner.core.api.solver.event.BestSolutionChangedEvent;
import org.optaplanner.core.api.solver.event.SolverEventListener;

18.5.3. Score Trends

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>
Now in *SolverConfig.xml and *BenchmarkConfig.xml:
<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:
<scoreDirectorFactory>
    ...
</scoreDirectorFactory>
...
<constructionHeuristic>
    <constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
    <forager>
        <pickEarlyType>FIRST_NON_DETERIORATING_SCORE</pickEarlyType>
    </forager>
</constructionHeuristic>
Now in *SolverConfig.xml and *BenchmarkConfig.xml:
<scoreDirectorFactory>
    ...
    <initializingScoreTrend>ONLY_DOWN</initializingScoreTrend>
</scoreDirectorFactory>
...
<constructionHeuristic>
    <constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>

18.5.4. Score Calculator

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> {
...
}
Now in *.java:
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>
After in *SolverConfig.xml and *BenchmarkConfig.xml:
<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:
<scoreDirectorFactory>
	<scoreDefinitionType>BENDABLE</scoreDefinitionType>
	<bendableHardLevelCount>2</bendableHardLevelCount>
	<bendableSoftLevelCount>3</bendableSoftLevelCount>
	...
</scoreDirectorFactory>
After in *SolverConfig.xml and *BenchmarkConfig.xml:
<scoreDirectorFactory>
	<scoreDefinitionType>BENDABLE</scoreDefinitionType>
	<bendableHardLevelsSize>2</bendableHardLevelsSize>
	<bendableSoftLevelsSize>3</bendableSoftLevelsSize>
	...
</scoreDirectorFactory>