Skip to content

Commit

Permalink
Rename withTermination() to withTerminationConfig() + move endingNow(…
Browse files Browse the repository at this point in the history
…) up to parent + release notes
  • Loading branch information
ge0ffrey committed Apr 1, 2019
1 parent 1bbd99f commit 47e4667
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
Expand Up @@ -278,7 +278,7 @@ public SolverConfig withScoreDirectorFactory(ScoreDirectorFactoryConfig scoreDir
return this; return this;
} }


public SolverConfig withTermination(TerminationConfig terminationConfig) { public SolverConfig withTerminationConfig(TerminationConfig terminationConfig) {
this.terminationConfig = terminationConfig; this.terminationConfig = terminationConfig;
return this; return this;
} }
Expand Down
Expand Up @@ -135,7 +135,6 @@ public void solvingStarted(DefaultSolverScope<Solution_> solverScope) {
@Override @Override
public void solvingEnded(DefaultSolverScope<Solution_> solverScope) { public void solvingEnded(DefaultSolverScope<Solution_> solverScope) {
super.solvingEnded(solverScope); super.solvingEnded(solverScope);
solverScope.endingNow();
solverScope.getScoreDirector().close(); solverScope.getScoreDirector().close();
// TODO log? // TODO log?
} }
Expand Down
Expand Up @@ -100,6 +100,7 @@ public void solvingEnded(DefaultSolverScope<Solution_> solverScope) {
phaseLifecycleSupport.fireSolvingEnded(solverScope); phaseLifecycleSupport.fireSolvingEnded(solverScope);
termination.solvingEnded(solverScope); termination.solvingEnded(solverScope);
bestSolutionRecaller.solvingEnded(solverScope); bestSolutionRecaller.solvingEnded(solverScope);
solverScope.endingNow();
} }


// ************************************************************************ // ************************************************************************
Expand Down
Expand Up @@ -218,12 +218,6 @@ public void solvingStarted(DefaultSolverScope<Solution_> solverScope) {
(randomFactory != null ? randomFactory : "not fixed")); (randomFactory != null ? randomFactory : "not fixed"));
} }


@Override
public void solvingEnded(DefaultSolverScope<Solution_> solverScope) {
super.solvingEnded(solverScope);
solverScope.endingNow();
}

public void outerSolvingEnded(DefaultSolverScope<Solution_> solverScope) { public void outerSolvingEnded(DefaultSolverScope<Solution_> solverScope) {
// Must be kept open for doProblemFactChange // Must be kept open for doProblemFactChange
solverScope.getScoreDirector().close(); solverScope.getScoreDirector().close();
Expand Down
Expand Up @@ -123,16 +123,18 @@ For example, to change the running time based on user input, before building the
SolverFactory<NQueens> solverFactory = SolverFactory.createFromXmlResource( SolverFactory<NQueens> solverFactory = SolverFactory.createFromXmlResource(
"org/optaplanner/examples/nqueens/solver/nqueensSolverConfig.xml"); "org/optaplanner/examples/nqueens/solver/nqueensSolverConfig.xml");
TerminationConfig terminationConfig = new TerminationConfig(); solverFactory.getSolverConfig()
terminationConfig.setMinutesSpentLimit(userInput); .withTerminationConfig(new TerminationConfig()
solverFactory.getSolverConfig().setTerminationConfig(terminationConfig); .withMinutesSpentLimit(userInput));
Solver<NQueens> solver = solverFactory.buildSolver(); Solver<NQueens> solver = solverFactory.buildSolver();
---- ----


Every element in the solver configuration XML is available as a `$$*$$Config` class or a property on a `$$*$$Config` class in the package namespace ``org.optaplanner.core.config``. Every element in the solver configuration XML is available as a `$$*$$Config` class
or a property on a `$$*$$Config` class in the package namespace ``org.optaplanner.core.config``.
These `$$*$$Config` classes are the Java representation of the XML format. These `$$*$$Config` classes are the Java representation of the XML format.
They build the runtime components (of the package namespace ``org.optaplanner.core.impl``) and assemble them into an efficient ``Solver``. They build the runtime components (of the package namespace ``org.optaplanner.core.impl``)
and assemble them into an efficient ``Solver``.


[IMPORTANT] [IMPORTANT]
==== ====
Expand Down

0 comments on commit 47e4667

Please sign in to comment.