public 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
|
Modifier and Type | Field and Description |
---|---|
protected BacktrackNeighbourSelection.BackTrackNeighbour |
iBackTrackNeighbour |
protected Solution<V,T> |
iSolution |
protected double |
iValue |
sLogger
Constructor and Description |
---|
BacktrackNeighbourSelection(DataProperties properties)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
backtrack(List<V> variables2resolve,
int idx,
int depth)
Backtracking
|
protected boolean |
canContinue(List<V> variables2resolve,
int idx,
int depth)
Check whether backtrack can continue
|
protected boolean |
canContinueEvaluation() |
protected boolean |
checkBound(List<V> variables2resolve,
int idx,
int depth,
T value,
Set<T> conflicts)
Check bound
|
int |
getDepth()
Return maximal depth
|
int |
getMaxIters()
Return maximal number of iterations
|
long |
getTime()
Time needed to find a neighbour (last call of selectNeighbour method)
|
int |
getTimeout()
Return time limit
|
void |
init(Solver<V,T> solver)
Solver initialization
|
boolean |
isMaxItersReached()
True, if the maximum number of iterations was reached by the last call of
selectNeighbour method
|
boolean |
isTimeoutReached()
True, if timeout was reached during the last call of selectNeighbour
method
|
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.
|
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(V variable)
List of values of the given variable that will be considered
|
getValueSelection, getVariableSelection, selectValue, selectVariable, setValueSelection, setVariableSelection
protected BacktrackNeighbourSelection.BackTrackNeighbour iBackTrackNeighbour
protected double iValue
public BacktrackNeighbourSelection(DataProperties properties) throws Exception
properties
- configurationException
public 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
).public long getTime()
public boolean isTimeoutReached()
public boolean isMaxItersReached()
protected Iterator<T> values(V variable)
protected boolean checkBound(List<V> variables2resolve, int idx, int depth, T value, Set<T> conflicts)
protected boolean canContinue(List<V> variables2resolve, int idx, int depth)
protected boolean canContinueEvaluation()
public int getDepth()
public void setDepth(int depth)
public int getTimeout()
public void setTimeout(int timeout)
public int getMaxIters()
public void setMaxIters(int maxIters)