|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cpsolver.ifs.extension.Extension<V,T>
net.sf.cpsolver.ifs.extension.MacRevised<V,T>
public class MacRevised<V extends Variable<V,T>,T extends Value<V,T>>
Another implementation of MAC propagation.
MacPropagation
Field Summary | |
---|---|
protected List<Constraint<V,T>> |
iConstraints
List of constraints on which arc-consistency is to be maintained |
protected long |
iIteration
Current iteration |
Constructor Summary | |
---|---|
MacRevised(Solver<V,T> solver,
DataProperties properties)
Constructor |
Method Summary | |
---|---|
void |
addConstraint(Constraint<V,T> constraint)
Adds a constraint on which arc-consistency is to be maintained |
void |
afterAssigned(long iteration,
T value)
After a value is assigned: explanations of other values of the value's variable are reset (to contain only the assigned value), propagation over the assigned variable takes place. |
void |
afterUnassigned(long iteration,
T value)
After a value is unassigned: explanations of all values of unassigned variable are recomputed ( Value.conflicts() ), propagation undo
over the unassigned variable takes place. |
void |
beforeAssigned(long iteration,
T value)
Before a value is unassigned: until the value is inconsistent with the current solution, an assignment from its explanation is picked and unassigned. |
boolean |
contains(Constraint<V,T> constraint)
Returns true, if arc-consistency is to be maintained on the given constraint |
Set<T> |
explanation(Constraint<V,T> constraint,
T value,
V variable)
|
Set<T> |
goodValues(V variable)
good values of a variable (values not removed from variables domain) |
boolean |
hasSupport(Constraint<V,T> constraint,
T value,
V variable)
|
boolean |
init(Solver<V,T> solver)
Initialization. |
boolean |
isGood(T value)
is variable good |
Set<T> |
noGood(T value)
variables explanation |
void |
propagate(Constraint<V,T> constraint,
T noGoodValue,
List<T> queue)
|
void |
propagate(List<T> queue)
|
boolean |
revise(Constraint<V,T> constraint,
T value)
|
boolean |
revise(T value)
|
protected void |
setGood(T value)
sets value to be good |
void |
setNoGood(T value,
Set<T> reason)
sets value's explanation |
Set<T> |
supports(Constraint<V,T> constraint,
T value,
V variable)
|
Methods inherited from class net.sf.cpsolver.ifs.extension.Extension |
---|
beforeUnassigned, constraintAdded, constraintRemoved, getModel, getProperties, getSolver, isRegistered, register, unregister, useValueExtra, useVariableExtra, variableAdded, variableRemoved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<Constraint<V extends Variable<V,T>,T extends Value<V,T>>> iConstraints
protected long iIteration
Constructor Detail |
---|
public MacRevised(Solver<V,T> solver, DataProperties properties)
Method Detail |
---|
public void addConstraint(Constraint<V,T> constraint)
public boolean contains(Constraint<V,T> constraint)
public void beforeAssigned(long iteration, T value)
beforeAssigned
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
beforeAssigned
in class Extension<V extends Variable<V,T>,T extends Value<V,T>>
iteration
- current iterationvalue
- value to be assignedpublic void afterAssigned(long iteration, T value)
afterAssigned
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
afterAssigned
in class Extension<V extends Variable<V,T>,T extends Value<V,T>>
iteration
- current iterationvalue
- value to be assignedpublic void afterUnassigned(long iteration, T value)
Value.conflicts()
), propagation undo
over the unassigned variable takes place.
afterUnassigned
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
afterUnassigned
in class Extension<V extends Variable<V,T>,T extends Value<V,T>>
iteration
- current iterationvalue
- value to be unassignedpublic void propagate(List<T> queue)
public void propagate(Constraint<V,T> constraint, T noGoodValue, List<T> queue)
public boolean revise(T value)
public boolean revise(Constraint<V,T> constraint, T value)
public Set<T> explanation(Constraint<V,T> constraint, T value, V variable)
public Set<T> supports(Constraint<V,T> constraint, T value, V variable)
public boolean hasSupport(Constraint<V,T> constraint, T value, V variable)
public boolean init(Solver<V,T> solver)
init
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
init
in class Extension<V extends Variable<V,T>,T extends Value<V,T>>
solver
- IFS solverpublic Set<T> goodValues(V variable)
public Set<T> noGood(T value)
public boolean isGood(T value)
protected void setGood(T value)
public void setNoGood(T value, Set<T> reason)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |