public class Extension<V extends Variable<V,T>,T extends Value<V,T>> extends Object implements ModelListener<V,T>
Variable.setExtra(Object)
, Variable.getExtra()
,
Value.setExtra(Object)
, Value.getExtra()
) but there can be
only one extension using these extra objects used during the search. For
instance, MacPropagation
is using these extra objects to memorize
explanations.Constructor and Description |
---|
Extension(Solver<V,T> solver,
DataProperties properties)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
afterAssigned(long iteration,
T value)
Called after a value is assigned to a variable
|
void |
afterUnassigned(long iteration,
T value)
Called after a value is unassigned from a variable
|
void |
beforeAssigned(long iteration,
T value)
Called before a value is assigned to a variable
|
void |
beforeUnassigned(long iteration,
T value)
Called after a value is unassigned from a variable
|
void |
constraintAdded(Constraint<V,T> constraint)
Called when a constraint is added to the model
|
void |
constraintRemoved(Constraint<V,T> constraint)
Called when a constraint is removed from the model
|
Model<V,T> |
getModel()
Returns the model
|
DataProperties |
getProperties()
Returns input configuration
|
Solver<V,T> |
getSolver()
Returns the solver
|
boolean |
init(Solver<V,T> solver)
Initialization -- called before the solver is started
|
boolean |
isRegistered()
Returns true if there is a model registered to this extension, i.e., when
extension is registered.
|
void |
register(Model<V,T> model)
Registration of a model.
|
void |
unregister(Model<V,T> model)
Unregistration of a model.
|
boolean |
useValueExtra()
Should return true when
Value.setExtra(Object) ,
Value.getExtra() are used by the extension |
boolean |
useVariableExtra()
Should return true when
Variable.setExtra(Object) ,
Variable.getExtra() are used by the extension |
void |
variableAdded(V variable)
Called when a variable is added to the model
|
void |
variableRemoved(V variable)
Called when a variable is removed from the model
|
public Extension(Solver<V,T> solver, DataProperties properties)
solver
- IFS solverproperties
- input configurationpublic void register(Model<V,T> model)
public void unregister(Model<V,T> model)
public boolean isRegistered()
public DataProperties getProperties()
public void afterAssigned(long iteration, T value)
afterAssigned
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
iteration
- current iterationvalue
- value to be assignedpublic void afterUnassigned(long iteration, T value)
afterUnassigned
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
iteration
- current iterationvalue
- value to be unassignedpublic void beforeAssigned(long iteration, T value)
beforeAssigned
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
iteration
- current iterationvalue
- value to be assignedpublic void beforeUnassigned(long iteration, T value)
beforeUnassigned
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
iteration
- current iterationvalue
- value to be unassignedpublic void constraintAdded(Constraint<V,T> constraint)
constraintAdded
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
constraint
- added constraintpublic void constraintRemoved(Constraint<V,T> constraint)
constraintRemoved
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
constraint
- removed constraintpublic void variableAdded(V variable)
variableAdded
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
variable
- added variablepublic void variableRemoved(V variable)
variableRemoved
in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>
variable
- removed variablepublic boolean useValueExtra()
Value.setExtra(Object)
,
Value.getExtra()
are used by the extensionpublic boolean useVariableExtra()
Variable.setExtra(Object)
,
Variable.getExtra()
are used by the extension