V
 VariableT
 Valuepublic class MacPropagation<V extends Variable<V,T>,T extends Value<V,T>> extends ExtensionWithContext<V,T,MacPropagation.NoGood>
afterAssigned(Assignment, long, Value)
enforces arc consistency of
the solution with the selected assignment variable = value and the procedure
afterUnassigned(Assignment, 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  Class and Description 

class 
MacPropagation.NoGood
Assignment context

Modifier and Type  Field and Description 

protected List<Constraint<V,T>> 
iConstraints
List of constraints on which arcconsistency is to be maintained

protected long 
iIteration
Current iteration

sMaxSize
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 arcconsistency is to be maintained

void 
afterAssigned(Assignment<V,T> assignment,
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(Assignment<V,T> assignment,
long iteration,
T value)
After a value is unassigned: explanations of all values of unassigned
variable are recomputed (
Value.conflicts(Assignment) ), propagation undo
over the unassigned variable takes place. 
void 
beforeAssigned(Assignment<V,T> assignment,
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 arcconsistency is to be maintained on the given
constraint

MacPropagation.NoGood 
createAssignmentContext(Assignment<V,T> assignment)
Create a new assignment context for the given assignment.

Set<T> 
goodValues(Assignment<V,T> assignment,
V variable)
good values of a variable (values not removed from variables domain)

boolean 
isGood(Assignment<V,T> assignment,
T value)
is variable good

Set<T> 
noGood(Assignment<V,T> assignment,
T value)
variables explanation

protected void 
propagate(Assignment<V,T> assignment,
V variable)
Propagation over the given variable.

protected void 
setGood(Assignment<V,T> assignment,
T value)
sets value to be good

void 
setNoGood(Assignment<V,T> assignment,
T value,
Set<T> reason)
sets value's explanation

void 
undoPropagate(Assignment<V,T> assignment,
V variable)
Propagation undo over the given variable.

getAssignmentContextReference, getContext, getContext, init, setAssignmentContextReference, unregister
beforeUnassigned, constraintAdded, constraintRemoved, getModel, getProperties, getSolver, isRegistered, register, 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)
solver
 current solverproperties
 solver configurationpublic void addConstraint(Constraint<V,T> constraint)
constraint
 a hard constraintpublic boolean contains(Constraint<V,T> constraint)
constraint
 a constraintpublic void beforeAssigned(Assignment<V,T> assignment, long iteration, T value)
public void afterAssigned(Assignment<V,T> assignment, long iteration, T value)
public void afterUnassigned(Assignment<V,T> assignment, long iteration, T value)
Value.conflicts(Assignment)
), propagation undo
over the unassigned variable takes place.public Set<T> goodValues(Assignment<V,T> assignment, V variable)
assignment
 current assignmentvariable
 given variablepublic Set<T> noGood(Assignment<V,T> assignment, T value)
assignment
 current assignmentvalue
 given valuepublic boolean isGood(Assignment<V,T> assignment, T value)
assignment
 current assignmentvalue
 given valueprotected void setGood(Assignment<V,T> assignment, T value)
assignment
 current assignmentvalue
 given valuepublic void setNoGood(Assignment<V,T> assignment, T value, Set<T> reason)
assignment
 current assignmentvalue
 given valuereason
 nogood set for the valuepublic MacPropagation.NoGood createAssignmentContext(Assignment<V,T> assignment)
HasAssignmentContext
assignment
 an assignment for which there needs to be an assignment contextprotected void propagate(Assignment<V,T> assignment, V variable)
assignment
 current assignmentvariable
 given variablepublic void undoPropagate(Assignment<V,T> assignment, V variable)
assignment
 current assignmentvariable
 given variable