V - VariableT - Valuepublic class ParallelConstruction<V extends Variable<V,T>,T extends Value<V,T>> extends NeighbourSelectionWithContext<V,T,ParallelConstruction.ConstructionContext> implements SolutionListener<V,T>
ParallelSolver
during the construction phase. If the best ever found solution was found by a different
thread (Assignment.getIndex() does not match) and the current solution has
a smaller number of variables assigned for at least the given number of iterations
(parameter ParallelConstruction.MaxIdle, defaults to 100), start assigning unassigned variables
to their best values. Otherwise, pass the selection to the provided neighbourhood selection.| Modifier and Type | Class and Description |
|---|---|
class |
ParallelConstruction.ConstructionContext |
| Modifier and Type | Field and Description |
|---|---|
protected int |
iBestAssigned |
protected int |
iBestIndex |
protected Double |
iBestValue |
protected int |
iMaxIdle |
protected NeighbourSelection<V,T> |
iParent |
protected static org.apache.logging.log4j.Logger |
sLog |
iContextOverridesMaxSize| Constructor and Description |
|---|
ParallelConstruction(DataProperties config,
NeighbourSelection<V,T> parent) |
| Modifier and Type | Method and Description |
|---|---|
void |
bestCleared(Solution<V,T> solution)
Called by the solution when method
Solution.clearBest() is
called. |
void |
bestRestored(Solution<V,T> solution)
Called by the solution when method
Solution.restoreBest() is
called. |
void |
bestSaved(Solution<V,T> solution)
Called by the solution when method
Solution.saveBest() is called. |
ParallelConstruction.ConstructionContext |
createAssignmentContext(Assignment<V,T> assignment)
Create a new assignment context for the given assignment.
|
void |
getInfo(Solution<V,T> solution,
Map<String,String> info)
Called by the solution when it is asked to produce info table, see
Solution.getInfo(). |
void |
getInfo(Solution<V,T> solution,
Map<String,String> info,
Collection<V> variables)
Called by the solution when it is asked to produce info table, see
Solution.getInfo(). |
void |
init(Solver<V,T> solver)
Criterion initialization
|
Neighbour<V,T> |
selectNeighbour(Solution<V,T> solution)
select a neighbour of a given solution
|
void |
solutionUpdated(Solution<V,T> solution)
Called by the solution when it is updated, see
Solution.update(double). |
getAssignmentContextReference, getContext, getContext, hasContextOverride, isSingleContextSolver, setAssignmentContextReferenceprotected static org.apache.logging.log4j.Logger sLog
protected Double iBestValue
protected int iBestIndex
protected int iBestAssigned
protected int iMaxIdle
public ParallelConstruction(DataProperties config, NeighbourSelection<V,T> parent)
public void init(Solver<V,T> solver)
NeighbourSelectionpublic void solutionUpdated(Solution<V,T> solution)
SolutionListenerSolution.update(double).solutionUpdated in interface SolutionListener<V extends Variable<V,T>,T extends Value<V,T>>solution - source solutionpublic void getInfo(Solution<V,T> solution, Map<String,String> info)
SolutionListenerSolution.getInfo(). A listener can also add some its info into
this table.public void getInfo(Solution<V,T> solution, Map<String,String> info, Collection<V> variables)
SolutionListenerSolution.getInfo(). A listener can also add some its info into
this table.public void bestCleared(Solution<V,T> solution)
SolutionListenerSolution.clearBest() is
called.bestCleared in interface SolutionListener<V extends Variable<V,T>,T extends Value<V,T>>solution - source solutionpublic void bestSaved(Solution<V,T> solution)
SolutionListenerSolution.saveBest() is called.public void bestRestored(Solution<V,T> solution)
SolutionListenerSolution.restoreBest() is
called.bestRestored in interface SolutionListener<V extends Variable<V,T>,T extends Value<V,T>>solution - source solutionpublic Neighbour<V,T> selectNeighbour(Solution<V,T> solution)
NeighbourSelectionselectNeighbour in interface NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>solution - given solutionpublic ParallelConstruction.ConstructionContext createAssignmentContext(Assignment<V,T> assignment)
HasAssignmentContextcreateAssignmentContext in interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,ParallelConstruction.ConstructionContext>assignment - an assignment for which there needs to be an assignment context