public abstract class MultiConstraintSolver extends ConstraintSolver
ConstraintSolver class providing functionality
to deal with MultiVariables and MultiConstraints. It should be extended
to create new MultiConstraintSolvers. In doing so, the designer should define
how variables are created (methods createVariableSub() and createVariablesSub()), how to
create internal constraint solvers underlying this MultiConstraintSolver (method
createConstraintSolvers()) and how propagation should occur (method propagate()). Note that
if propagation occurs by means of the underlying constraint solvers, the propagate() method can
left empty (return true).| Modifier and Type | Class and Description |
|---|---|
static class |
MultiConstraintSolver.OPTIONS
These are options used by the
ConstraintSolver class to determine
whether inconsistencies should be allowed in the constraitn networks of the
underlying constraint solvers. |
| Modifier and Type | Field and Description |
|---|---|
protected ConstraintSolver[] |
constraintSolvers |
protected int[] |
ingredients |
autoprop, components, constraintTypes, IDs, logger, name, nesting, noPropOnVarCreation, numcalls, skipPropagation, spacing, theNetwork, variableType| Modifier | Constructor and Description |
|---|---|
protected |
MultiConstraintSolver(java.lang.Class<?>[] constraintTypes,
java.lang.Class<?> variableType,
ConstraintSolver[] internalSolvers,
int[] ingredients)
The constructor of a extending class must call this constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
addConstraintsSub(Constraint[] c)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
protected Variable[] |
createVariablesSub(int num)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
protected Variable[] |
createVariablesSub(int[] ingredients,
int num,
java.lang.String component)
This method creates
num MultiVariables. |
protected Variable[] |
createVariablesSub(int num,
java.lang.String component)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
static void |
drawConstraintNetworkHierarchy(edu.uci.ics.jung.graph.DelegateTree<ConstraintNetwork,java.lang.String> tree)
Draw a hierarchy of
ConstraintNetworks. |
static void |
drawConstraintSolverHierarchy(edu.uci.ics.jung.graph.DelegateTree<ConstraintSolver,java.lang.String> tree)
Draw a hierarchy of
ConstraintSolvers. |
void |
failurePruning(int failure_time) |
edu.uci.ics.jung.graph.DelegateTree<ConstraintNetwork,java.lang.String> |
getConstraintNetworkHierarchy()
Get a tree whose nodes are the constraint networks managed by the hierarchy of
ConstraintSolvers underlying this MultiConstraintSolver. |
ConstraintNetwork[] |
getConstraintNetworksFromSolverHierarchy(java.lang.Class<?> cl)
Get all
ConstraintNetworks underlying ConstraintSolvers of a given type in
this MultiConstraintSolver's hierarchy of solvers. |
static ConstraintSolver |
getConstraintSolver(ConstraintSolver cs,
java.lang.Class<?> constraintSolverClass) |
edu.uci.ics.jung.graph.DelegateTree<ConstraintSolver,java.lang.String> |
getConstraintSolverHierarchy()
Get the hierarchy of
ConstraintSolvers rooted in this MultiConstraintSolver. |
ConstraintSolver[] |
getConstraintSolvers()
Get the
ConstraintSolvers underlying this MultiConstraintSolver. |
ConstraintSolver[] |
getConstraintSolversFromConstraintSolverHierarchy(java.lang.Class<?> cl)
Get the
ConstraintSolvers of a given type from this MultiConstraintSolver's
hierarchy of ConstraintSolvers. |
java.lang.String |
getDescription()
Gets a description of this
ConstraintSolver stating which variable and constraint types it supports. |
boolean |
getOption(MultiConstraintSolver.OPTIONS op)
Method to get options of this
MultiConstraintSolver (see MultiConstraintSolver.OPTIONS). |
abstract boolean |
propagate()
Propagate the constraint network.
|
void |
registerValueChoiceFunctions() |
protected void |
removeConstraintsSub(Constraint[] c)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
protected void |
removeVariablesSub(Variable[] v)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
void |
setConstraintSolver(int i,
ConstraintSolver cSolver) |
void |
setIngredients(int[] ingredients)
Set the number of internal variables of different types that are to be created when
calling the method createVariables().
|
void |
setOptions(MultiConstraintSolver.OPTIONS... ops)
Method to set the options for this
MultiConstraintSolver (see MultiConstraintSolver.OPTIONS). |
addConstraint, addConstraintNoPropagation, addConstraints, addConstraintsDebug, addConstraintsNoPropagation, containsVariable, createVariable, createVariable, createVariables, createVariables, deplenish, getComponent, getComponents, getConstraintNetwork, getConstraints, getConstraints, getID, getOption, getVariable, getVariables, getVariables, getVariables, isCompatible, maskConstraints, removeConstraint, removeConstraints, removeVariable, removeVariables, setComponent, setComponents, setConstraintNetwork, setName, setOptions, toString, unmaskConstraintsprotected ConstraintSolver[] constraintSolvers
protected int[] ingredients
protected MultiConstraintSolver(java.lang.Class<?>[] constraintTypes,
java.lang.Class<?> variableType,
ConstraintSolver[] internalSolvers,
int[] ingredients)
constraintTypes - internalSolvers - public static ConstraintSolver getConstraintSolver(ConstraintSolver cs, java.lang.Class<?> constraintSolverClass)
public void setOptions(MultiConstraintSolver.OPTIONS... ops)
MultiConstraintSolver (see MultiConstraintSolver.OPTIONS).ops - Options to set (see MultiConstraintSolver.OPTIONS).public boolean getOption(MultiConstraintSolver.OPTIONS op)
MultiConstraintSolver (see MultiConstraintSolver.OPTIONS).op - The option that should be checkedtrue iff the given option was setpublic void setIngredients(int[] ingredients)
ingredients - The number of internal variables, oen number for each type, that are to
be created.protected final boolean addConstraintsSub(Constraint[] c)
ConstraintSolverConstraintSolver
class. It should implement all operations necessary to add multiple constraints, and should return
true upon success, false otherwise.addConstraintsSub in class ConstraintSolverc - The constraints to add.true iff the constraints were added to the ConstraintNetwork.protected final void removeVariablesSub(Variable[] v)
ConstraintSolverConstraintSolver
class. It should implement all operations necessary to remove a batch of variables for
the specific type of ConstraintSolver.removeVariablesSub in class ConstraintSolverv - The Variables to remove.protected Variable[] createVariablesSub(int[] ingredients, int num, java.lang.String component)
num MultiVariables. The creation of internal variables is
taken care of automatically, given a specification of the number of internal variables to create
for each internal solver.ingredients - The number of internal variables to create for each internal solver.num - The number of MultiVariables for which internal variables are to be created.component - The label (component) the created variables should be associated with.Variables for num MultiVariables.protected final Variable[] createVariablesSub(int num)
ConstraintSolverConstraintSolver
class. It should implement all operations necessary to create a batch of variable for the specific
type of ConstraintSolver.createVariablesSub in class ConstraintSolvernum - The number of variables to create.Variable for this ConstraintSolver.protected final Variable[] createVariablesSub(int num, java.lang.String component)
ConstraintSolverConstraintSolver
class. It should implement all operations necessary to create a batch of variable for the specific
type of ConstraintSolver.createVariablesSub in class ConstraintSolvernum - The number of Variables to create.component - The component label to associate to the new Variables.Variable for this ConstraintSolver.public abstract boolean propagate()
ConstraintSolverpropagate in class ConstraintSolverprotected final void removeConstraintsSub(Constraint[] c)
ConstraintSolverConstraintSolver
class. Should implement all operations necessary to remove a batch of constraints.removeConstraintsSub in class ConstraintSolverc - The constraints to remove.public ConstraintSolver[] getConstraintSolvers()
ConstraintSolvers underlying this MultiConstraintSolver.ConstraintSolvers underlying this MultiConstraintSolver.public void setConstraintSolver(int i,
ConstraintSolver cSolver)
public java.lang.String getDescription()
ConstraintSolverConstraintSolver stating which variable and constraint types it supports.getDescription in class ConstraintSolverConstraintSolver stating which variable and constraint types it supports.public edu.uci.ics.jung.graph.DelegateTree<ConstraintSolver,java.lang.String> getConstraintSolverHierarchy()
ConstraintSolvers rooted in this MultiConstraintSolver.ConstraintSolvers rooted in this MultiConstraintSolver.public ConstraintSolver[] getConstraintSolversFromConstraintSolverHierarchy(java.lang.Class<?> cl)
ConstraintSolvers of a given type from this MultiConstraintSolver's
hierarchy of ConstraintSolvers.cl - The type of ConstraintSolvers to get.ConstraintSolvers of the given type in this MultiConstraintSolver's
hierarchy of ConstraintSolvers.public ConstraintNetwork[] getConstraintNetworksFromSolverHierarchy(java.lang.Class<?> cl)
ConstraintNetworks underlying ConstraintSolvers of a given type in
this MultiConstraintSolver's hierarchy of solvers.cl - The type of ConstraintNetwork to get.ConstraintNetworks underlying ConstraintSolvers of a given type in
this MultiConstraintSolver's hierarchy of solvers.public edu.uci.ics.jung.graph.DelegateTree<ConstraintNetwork,java.lang.String> getConstraintNetworkHierarchy()
ConstraintSolvers underlying this MultiConstraintSolver.ConstraintSolvers underlying this MultiConstraintSolver.public void failurePruning(int failure_time)
public void registerValueChoiceFunctions()
registerValueChoiceFunctions in class ConstraintSolverpublic static void drawConstraintNetworkHierarchy(edu.uci.ics.jung.graph.DelegateTree<ConstraintNetwork,java.lang.String> tree)
ConstraintNetworks.tree - The hierarchy of ConstraintNetworks to draw.public static void drawConstraintSolverHierarchy(edu.uci.ics.jung.graph.DelegateTree<ConstraintSolver,java.lang.String> tree)
ConstraintSolvers.tree - The hierarchy of ConstraintSolvers to draw.