19.4. Solver Configuration

In Solver and BestSolutionChangedEvent, the method getTimeMillisSpend() has been renamed to getTimeMillisSpent().

Previously in *.java:

... = solver.getTimeMillisSpend();

Now in *.java:

... = solver.getTimeMillisSpent();

Previously in *.java:

public void bestSolutionChanged(BestSolutionChangedEvent event) {
    ... = event.getTimeMillisSpend();
}

Now in *.java:

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/>

Now in *SolverConfig.xml and *BenchmarkConfig.xml :

<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();

Now in *.java:

solver.solve(planningProblem);
Note

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");

Now in *.java:

SolverFactory solverFactory = SolverFactory.createFromXmlResource("...solverConfig.xml");

Previously in *.java:

SolverFactory solverFactory = new XmlSolverFactory().configure(inputStream);

Now in *.java:

SolverFactory solverFactory = SolverFactory.createFromXmlInputStream(inputStream);

Previously in *.java:

SolverFactory solverFactory = new XmlSolverFactory().configure(reader);

Now in *.java:

SolverFactory solverFactory = SolverFactory.createFromXmlReader(reader);
Note

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 to CustomPhaseCommand.
  • The element <customSolverPhase> has been renamed to <customPhase>.
  • The element <customSolverPhaseCommandClass> has been renamed to >customPhaseCommandClass>.

Previously in *.java:

public class ToOriginalMachineSolutionInitializer implements CustomSolverPhaseCommand {
    ...
}

Now in *.java:

public class ToOriginalMachineSolutionInitializer implements CustomPhaseCommand {
    ...
}

Previously in *SolverConfig.xml and *BenchmarkConfig.xml :

<customSolverPhase>
  <customSolverPhaseCommandClass>...ToOriginalMachineSolutionInitializer</customSolverPhaseCommandClass>
</customSolverPhase>

Now in *SolverConfig.xml and *BenchmarkConfig.xml :

<customPhase>
  <customPhaseCommandClass>....ToOriginalMachineSolutionInitializer</customPhaseCommandClass>
</customPhase>

The method ScoreDefinition.getLevelCount() has been renamed to ScoreDefinition.getLevelsSize().