V
- VariableT
- Valuepublic class BacktrackNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>> extends StandardNeighbourSelection<V,T>
Parameter | Type | Comment |
---|---|---|
Neighbour.BackTrackTimeout | Integer |
Timeout for each neighbour selection (in milliseconds). |
Neighbour.BackTrackDepth | Integer |
Limit of search depth. |
Modifier and Type | Class and Description |
---|---|
class |
BacktrackNeighbourSelection.BackTrackNeighbour
Backtracking neighbour
|
class |
BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext |
Modifier and Type | Field and Description |
---|---|
protected BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext |
iContext |
iSolver, sLogger
Constructor and Description |
---|
BacktrackNeighbourSelection(DataProperties properties)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
backtrack(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context,
List<V> variables2resolve,
int idx,
int depth)
Backtracking
|
protected boolean |
canContinue(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context,
List<V> variables2resolve,
int idx,
int depth)
Check whether backtrack can continue
|
protected boolean |
canContinueEvaluation(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context) |
protected boolean |
checkBound(List<V> variables2resolve,
int idx,
int depth,
T value,
Set<T> conflicts)
Check bound
|
BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext |
getContext() |
int |
getDepth()
Return maximal depth
|
int |
getMaxIters()
Return maximal number of iterations
|
int |
getTimeout()
Return time limit
|
void |
init(Solver<V,T> solver)
Solver initialization
|
Neighbour<V,T> |
selectNeighbour(Solution<V,T> solution)
Select neighbour.
|
Neighbour<V,T> |
selectNeighbour(Solution<V,T> solution,
V variable)
Select neighbour -- starts from the provided variable.
|
protected void |
selectNeighbour(Solution<V,T> solution,
V variable,
BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context) |
void |
setDepth(int depth)
Set maximal depth
|
void |
setMaxIters(int maxIters)
Set maximal number of iterations
|
void |
setTimeout(int timeout)
Set time limit
|
protected Iterator<T> |
values(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context,
V variable)
List of values of the given variable that will be considered
|
getValueSelection, getVariableSelection, selectValue, selectVariable, setValueSelection, setVariableSelection
protected BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext iContext
public BacktrackNeighbourSelection(DataProperties properties) throws Exception
properties
- configurationException
- thrown when initialization failspublic Neighbour<V,T> selectNeighbour(Solution<V,T> solution)
StandardNeighbourSelection.getVariableSelection()
) is used to
select a variable. A backtracking of a limited depth is than employed
from this variable. The best assignment found is returned (see
BacktrackNeighbourSelection.BackTrackNeighbour
).selectNeighbour
in interface NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
selectNeighbour
in class StandardNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
solution
- given solutionpublic Neighbour<V,T> selectNeighbour(Solution<V,T> solution, V variable)
BacktrackNeighbourSelection.BackTrackNeighbour
).solution
- current solutionvariable
- selected variableprotected void selectNeighbour(Solution<V,T> solution, V variable, BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context)
public BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext getContext()
protected Iterator<T> values(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context, V variable)
context
- assignment contextvariable
- given variableprotected boolean checkBound(List<V> variables2resolve, int idx, int depth, T value, Set<T> conflicts)
variables2resolve
- unassigned variables that are in conflict with the current solutionidx
- position in variables2resolvedepth
- current depthvalue
- value to checkconflicts
- conflicting valuesprotected boolean canContinue(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context, List<V> variables2resolve, int idx, int depth)
context
- assignment contextvariables2resolve
- unassigned variables that are in conflict with the current solutionidx
- position in variables2resolvedepth
- current depthprotected boolean canContinueEvaluation(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context)
protected void backtrack(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context, List<V> variables2resolve, int idx, int depth)
context
- assignment contextvariables2resolve
- unassigned variables that are in conflict with the current solutionidx
- position in variables2resolvedepth
- current depthpublic int getDepth()
public void setDepth(int depth)
depth
- maximal search depthpublic int getTimeout()
public void setTimeout(int timeout)
timeout
- time limitpublic int getMaxIters()
public void setMaxIters(int maxIters)
maxIters
- maximal number of iterations