19.3. Benchmark

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

<plannerBenchmark>
  <warmUpTimeMillisSpend>...</warmUpTimeMillisSpend>
  <warmUpSecondsSpend>...</warmUpSecondsSpend>
  <warmUpMinutesSpend>...</warmUpMinutesSpend>
  <warmUpHoursSpend>...</warmUpHoursSpend>
  ...
</plannerBenchmark>

Now in *BenchmarkConfig.xml :

<plannerBenchmark>
  <warmUpMillisecondsSpentLimit>...</warmUpMillisecondsSpentLimit>
  <warmUpSecondsSpentLimit>...</warmUpSecondsSpentLimit>
  <warmUpMinutesSpentLimit>...</warmUpMinutesSpentLimit>
  <warmUpHoursSpentLimit>...</warmUpHoursSpentLimit>
  ...
</plannerBenchmark>

The class XmlPlannerBenchmarkFactory has been removed and replaced by static methods on PlannerBenchmarkFactory.

Previously in *.java :

PlannerBenchmarkFactory plannerBenchmarkFactory = new XmlPlannerBenchmarkFactory(...);

Now in *.java :

PlannerBenchmarkFactory plannerBenchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource(...);
Note

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>

Now in *BenchmarkConfig.xml :

<problemBenchmarks>
  <xStreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xStreamAnnotatedClass>
  ...
</problemBenchmarks>

19.3.1. SolutionFileIO

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 {
    ...
}

Now in *.java :

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>

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

<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;
}

Now in *.java :

public String getInputFileExtension() {
    return FILE_EXTENSION;
}
public String getOutputFileExtension() {
    return FILE_EXTENSION;
}