public class MacRevised<V extends Variable<V,T>,T extends Value<V,T>> extends Extension<V,T>
MacPropagation
Modifier and Type | Field and Description |
---|---|
protected List<Constraint<V,T>> |
iConstraints
List of constraints on which arc-consistency is to be maintained
|
protected long |
iIteration
Current iteration
|
Constructor and Description |
---|
MacRevised(Solver<V,T> solver,
DataProperties properties)
Constructor
|
Modifier and Type | Method and Description |
---|---|
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) |
beforeUnassigned, constraintAdded, constraintRemoved, getModel, getProperties, getSolver, isRegistered, register, unregister, useValueExtra, useVariableExtra, variableAdded, variableRemoved
protected List<Constraint<V extends Variable<V,T>,T extends Value<V,T>>> iConstraints
protected long iIteration
public MacRevised(Solver<V,T> solver, DataProperties properties)
public void addConstraint(Constraint<V,T> constraint)
public boolean contains(Constraint<V,T> constraint)
public void beforeAssigned(long iteration, T value)
public void afterAssigned(long iteration, T value)
public void afterUnassigned(long iteration, T value)
Value.conflicts()
), propagation undo
over the unassigned variable takes place.public boolean revise(Constraint<V,T> constraint, T value)
public Set<T> explanation(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)
public Set<T> goodValues(V variable)