public abstract class MultiVariable extends Variable
Variables.
This class is used by MultiConstraintSolvers along with MultiConstraints to
maintain and propagate multiple CSPs defined by aggregations of variables and constraints.
An example is the AllenInterval, an aggregation of two TimePoints, which can be
bound by MultiConstraints of the type AllenIntervalConstraint and reasoned upon
by an AllenIntervalNetworkSolver.
Defining a MultiVariable is reduced to creating the internal lower-level Variables
(method createVariablesSub(int num)). Also, a MultiVariable may have "implementing constraints".
This is the case, e.g., in the AllenInterval, which, in addition to the two TimePoints,
also possesses a AllenIntervalConstraint of type Duration. For this reason, the designer of a
MultiVariable must also define the createInternalConstraints() method.| Modifier and Type | Field and Description |
|---|---|
static java.util.HashMap<org.metacsp.framework.multi.MultiVariable.FieldOfObject,java.lang.Object> |
backupForSerialization |
protected Constraint[] |
constraints |
protected ConstraintSolver[] |
internalSolvers |
protected Variable[] |
variables |
attributes, dependentVariables, id, logger, solver| Modifier | Constructor and Description |
|---|---|
protected |
MultiVariable(ConstraintSolver cs,
int id,
ConstraintSolver[] internalSolvers,
Variable[] internalVars)
The constructor of an extensions to
MultiVariable must call this constructor. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Constraint[] |
createInternalConstraints(Variable[] variables)
This method must be implemented to define the internal lower-level
Constraints of this
MultiVariable. |
static void |
drawVariableHierarchy(edu.uci.ics.jung.graph.DelegateTree<Variable,java.lang.String> tree)
Draw the
Variable hierarchy underlying this MultiVariable. |
java.lang.String |
getDescription()
Get the description of this
Variable's type. |
MultiDomain |
getDomain()
Get the domain of this Variable.
|
Constraint[] |
getInternalConstraints()
Get the internal
Constraints of this MultiVariable. |
ConstraintSolver[] |
getInternalConstraintSolvers()
Get the internal
ConstraintSolvers of this MultiVariable. |
Variable[] |
getInternalVariables()
Get the internal
Variables of this MultiVariable. |
edu.uci.ics.jung.graph.DelegateTree<Variable,java.lang.String> |
getVariableHierarchy()
Get the hierarchy of
Variables underlying this MultiVariable. |
Variable[] |
getVariablesFromVariableHierarchy(java.lang.Class<?> cl)
Get the
Variables of a given type in this MultiVariable's variable hierarchy. |
void |
setComponent(java.lang.String component)
Set this
Variable's component. |
addDependentVariables, dependsOn, equals, getAncestorVariable, getAttributes, getColor, getComponent, getConstraintSolver, getDependentVariables, getID, getMarking, getOwner, getParentVariable, getRecursivelyDependentVariables, getRootVariable, hashCode, isDependentVariable, removeDependentVariables, setAttributes, setColor, setDependentVariables, setDomain, setMarking, setOwner, setParentVariable, toStringpublic static java.util.HashMap<org.metacsp.framework.multi.MultiVariable.FieldOfObject,java.lang.Object> backupForSerialization
protected ConstraintSolver[] internalSolvers
protected Variable[] variables
protected Constraint[] constraints
protected MultiVariable(ConstraintSolver cs, int id, ConstraintSolver[] internalSolvers, Variable[] internalVars)
MultiVariable must call this constructor.cs - The ConstraintSolver of the MultiVariable.id - The MultiVariable's ID.internalSolvers - The internal solvers of this MultiVariable (to which theinternalVars - The internal Variables implementing this MultiVariable.protected abstract Constraint[] createInternalConstraints(Variable[] variables)
Constraints of this
MultiVariable.variables - The internal variables among which the Constraints should be defined.Constraints of this
MultiVariable.public Variable[] getInternalVariables()
Variables of this MultiVariable.Variables of this MultiVariable.public Constraint[] getInternalConstraints()
Constraints of this MultiVariable.Constraints of this MultiVariable.public ConstraintSolver[] getInternalConstraintSolvers()
ConstraintSolvers of this MultiVariable.ConstraintSolvers of this MultiVariable.public MultiDomain getDomain()
Variablepublic edu.uci.ics.jung.graph.DelegateTree<Variable,java.lang.String> getVariableHierarchy()
Variables underlying this MultiVariable.Variables underlying this MultiVariable.public static void drawVariableHierarchy(edu.uci.ics.jung.graph.DelegateTree<Variable,java.lang.String> tree)
Variable hierarchy underlying this MultiVariable.tree - The Variable hierarchy to draw.public Variable[] getVariablesFromVariableHierarchy(java.lang.Class<?> cl)
Variables of a given type in this MultiVariable's variable hierarchy.cl - The type of Variables to fetch.Variables of the given type in this MultiVariable's variable hierarchy.public java.lang.String getDescription()
VariableVariable's type.getDescription in class VariableVariable's type.public void setComponent(java.lang.String component)
VariableVariable's component.setComponent in class Variablecomponent - This Variable's component.