public class MacPropagation<V extends Variable<V,T>,T extends Value<V,T>> extends Extension<V,T>
afterAssigned(long, Value)
enforces arc consistency of
the solution with the selected assignment variable = value and the procedure
afterUnassigned(long, Value)
"undoes" the assignment
variable = value. It means that explanations of all values which were deleted
and which contain assignment variable = value in their explanations need to
be recomputed. This can be done via returning all these values into their
variables??? domains followed by arc consistency maintenance over their
variables. Parameter | Type | Comment |
---|---|---|
MacPropagation.JustForwardCheck | Boolean |
If true, only forward checking instead of full arc consistency is maintained during the search. |
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 |
---|
MacPropagation(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> |
goodValues(V variable)
good values of a variable (values not removed from variables domain)
|
boolean |
init(Solver<V,T> solver)
Initialization.
|
boolean |
isGood(T value)
is variable good
|
Set<T> |
noGood(T value)
variables explanation
|
protected void |
propagate(Queue<V> queue)
Propagation over the queue of variables.
|
protected void |
propagate(V variable)
Propagation over the given variable.
|
protected boolean |
propagate(V aVariable,
V anotherVariable) |
protected boolean |
propagate(V aVariable,
V anotherVariable,
List<T> adepts) |
protected void |
setGood(T value)
sets value to be good
|
void |
setNoGood(T value,
Set<T> reason)
sets value's explanation
|
void |
undoPropagate(V variable)
Propagation undo over the given 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 MacPropagation(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 init(Solver<V,T> solver)
public void undoPropagate(V variable)
public Set<T> goodValues(V variable)