|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cpsolver.ifs.model.Neighbour<V,T>
net.sf.cpsolver.ifs.model.LazyNeighbour<V,T>
public abstract class LazyNeighbour<V extends Variable<V,T>,T extends Value<V,T>>
Lazy neigbour (a change of the overall solution value is unknown before
the neighbour is assigned, it is possible to undo the neighbour instead).
This neighbour is useful when it is
two expensive to compute change of overall solution value before the
variable is reassigned. It is possible to undo the neighbour instead.
Search strategy has to implement LazyNeighbour.LazyNeighbourAcceptanceCriterion
.
Nested Class Summary | |
---|---|
static interface |
LazyNeighbour.LazyNeighbourAcceptanceCriterion<V extends Variable<V,T>,T extends Value<V,T>>
Neighbour acceptance criterion interface (to be implemented by search strategies that are using LazyNeighbour . |
Constructor Summary | |
---|---|
LazyNeighbour()
|
Method Summary | |
---|---|
void |
assign(long iteration)
Assign neighbour, check given acceptance criterion, and undo assignment if the change is not accepted. |
protected abstract void |
doAssign(long iteration)
Perform assignment |
abstract Model<V,T> |
getModel()
Return problem model (it is needed in order to be able to get overall solution value before and after the assignment of this neighbour) |
void |
setAcceptanceCriterion(LazyNeighbour.LazyNeighbourAcceptanceCriterion<V,T> criterion)
Set acceptance criterion (to be used by a search strategy before the neighbour is accepted, so that it can be undone if desired) |
protected abstract void |
undoAssign(long iteration)
Undo assignment |
double |
value()
Return -1 (neighbour is always accepted). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LazyNeighbour()
Method Detail |
---|
public void setAcceptanceCriterion(LazyNeighbour.LazyNeighbourAcceptanceCriterion<V,T> criterion)
public void assign(long iteration)
assign
in class Neighbour<V extends Variable<V,T>,T extends Value<V,T>>
public double value()
LazyNeighbour.LazyNeighbourAcceptanceCriterion
.
value
in class Neighbour<V extends Variable<V,T>,T extends Value<V,T>>
protected abstract void doAssign(long iteration)
protected abstract void undoAssign(long iteration)
public abstract Model<V,T> getModel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |