Package org.jacop.constraints
Class Element
- java.lang.Object
-
- org.jacop.constraints.DecomposedConstraint<Constraint>
-
- org.jacop.constraints.Constraint
-
- org.jacop.constraints.Element
-
- All Implemented Interfaces:
UsesQueueVariable
public class Element extends Constraint implements UsesQueueVariable
Element constraint implements the element/4 constraint (both with integer list and variables list). It defines a following relation variables[index + shift] = value. The default shift value is equal to zero. The first index in the variables list is equal to 1.- Version:
- 4.8
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Constraintc-
Fields inherited from class org.jacop.constraints.Constraint
afcWeight, atomicExecution, consistencyPruningEvents, constraintScope, earlyTerminationOK, increaseWeight, numberId, scope, trace, watchedVariableGrounded
-
Fields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex
-
-
Constructor Summary
Constructors Constructor Description Element(IntVar index, int[] values, IntVar value)Deprecated.Element(IntVar index, int[] values, IntVar value, int shift)Deprecated.Element(IntVar index, java.util.List<? extends IntVar> variables, IntVar value)Deprecated.Element(IntVar index, java.util.List<? extends IntVar> variables, IntVar value, int shift)Deprecated.Element(IntVar index, IntVar[] variables, IntVar value)Deprecated.Element(IntVar index, IntVar[] variables, IntVar value, int shift)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<Var>arguments()It returns the variables in a scope of the constraint.static Constraintchoose(IntVar index, int[] values, IntVar value)It constructs element constraint based on variables.static Constraintchoose(IntVar index, int[] values, IntVar value, int shift)It constructs element constraint based on variables.static Constraintchoose(IntVar index, java.util.List<? extends IntVar> variables, IntVar value)It constructs element constraint based on variables.static Constraintchoose(IntVar index, java.util.List<? extends IntVar> variables, IntVar value, int shift)It constructs element constraint based on variables.static Constraintchoose(IntVar index, IntVar[] variables, IntVar value)It constructs element constraint based on variables.static Constraintchoose(IntVar index, IntVar[] variables, IntVar value, int shift)It constructs element constraint based on variables.voidconsistency(Store store)It is a (most probably incomplete) consistency function which removes the values from variables domains.intgetConsistencyPruningEvent(Var var)It retrieves the pruning event which causes reevaluation of the constraint.intgetDefaultConsistencyPruningEvent()java.lang.Stringid()It gives the id string of a constraint.voidimpose(Store store)It imposes the constraint in a given store.voidincreaseWeight()It increases the weight of the variables in the constraint scope.voidqueueVariable(int level, Var V)This is a function called to indicate which variable in a scope of constraint has changed.voidremoveConstraint()It removes the constraint by removing this constraint from all variables.java.lang.StringtoString()It produces a string representation of a constraint state.-
Methods inherited from class org.jacop.constraints.Constraint
afc, cleanAfterFailure, decompose, getGuideConstraint, getGuideValue, getGuideVariable, grounded, grounded, impose, imposeDecomposition, intArrayToString, long2int, numberArgs, requiresMonotonicity, setConsistencyPruningEvent, setConstraintScope, setScope, setScope, setScope, setScope, setScope, setWatchedVariableGrounded, supplyGuideFeedback, toInt, toInt, updateAFC, watchedVariableGrounded
-
Methods inherited from class org.jacop.constraints.DecomposedConstraint
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
-
-
-
-
Field Detail
-
c
Constraint c
-
-
Constructor Detail
-
Element
@Deprecated public Element(IntVar index, java.util.List<? extends IntVar> variables, IntVar value)
Deprecated.It constructs element constraint based on variables. The default shift value is equal 0.- Parameters:
index- index variable.variables- list of variables.value- variable to which index variable is equal to.
-
Element
@Deprecated public Element(IntVar index, java.util.List<? extends IntVar> variables, IntVar value, int shift)
Deprecated.It constructs element constraint based on variables.- Parameters:
index- index variable.variables- variables list.value- value variable.shift- shift by which the index value is moved to the left.
-
Element
@Deprecated public Element(IntVar index, int[] values, IntVar value)
Deprecated.It constructs element constraint based on variables. The default shift value is equal 0.- Parameters:
index- index variable.values- list of integers.value- variable to which index variable is equal to.
-
Element
@Deprecated public Element(IntVar index, int[] values, IntVar value, int shift)
Deprecated.It constructs element constraint based on variables.- Parameters:
index- index variable.values- integer list.value- value variable.shift- shift by which the index value is moved to the left.
-
Element
@Deprecated public Element(IntVar index, IntVar[] variables, IntVar value)
Deprecated.It constructs element constraint based on variables. The default shift value is equal 0.- Parameters:
index- index variable.variables- list of integers.value- variable to which index variable is equal to.
-
Element
@Deprecated public Element(IntVar index, IntVar[] variables, IntVar value, int shift)
Deprecated.It constructs element constraint based on variables.- Parameters:
index- index variable.variables- variables list.value- value variable.shift- shift by which the index value is moved to the left.
-
-
Method Detail
-
arguments
public java.util.Set<Var> arguments()
Description copied from class:ConstraintIt returns the variables in a scope of the constraint.- Overrides:
argumentsin classConstraint- Returns:
- variables in a scope of the constraint.
-
consistency
public void consistency(Store store)
Description copied from class:ConstraintIt is a (most probably incomplete) consistency function which removes the values from variables domains. Only values which do not have any support in a solution space are removed.- Specified by:
consistencyin classConstraint- Parameters:
store- constraint store within which the constraint consistency is being checked.
-
getConsistencyPruningEvent
public int getConsistencyPruningEvent(Var var)
Description copied from class:ConstraintIt retrieves the pruning event which causes reevaluation of the constraint.- Overrides:
getConsistencyPruningEventin classConstraint- Parameters:
var- variable for which pruning event is retrieved- Returns:
- it returns the int code of the pruning event (GROUND, BOUND, ANY, NONE)
-
getDefaultConsistencyPruningEvent
public int getDefaultConsistencyPruningEvent()
- Specified by:
getDefaultConsistencyPruningEventin classConstraint
-
id
public java.lang.String id()
Description copied from class:ConstraintIt gives the id string of a constraint.- Overrides:
idin classConstraint- Returns:
- string id of the constraint.
-
impose
public void impose(Store store)
Description copied from class:ConstraintIt imposes the constraint in a given store.- Overrides:
imposein classConstraint- Parameters:
store- the constraint store to which the constraint is imposed to.
-
queueVariable
public void queueVariable(int level, Var V)Description copied from class:ConstraintThis is a function called to indicate which variable in a scope of constraint has changed. It also indicates a store level at which the change has occurred.- Overrides:
queueVariablein classConstraint- Parameters:
level- the level of the store at which the change has occurred.V- variable which has changed.
-
removeConstraint
public void removeConstraint()
Description copied from class:ConstraintIt removes the constraint by removing this constraint from all variables.- Overrides:
removeConstraintin classConstraint
-
toString
public java.lang.String toString()
Description copied from class:ConstraintIt produces a string representation of a constraint state.- Overrides:
toStringin classConstraint
-
increaseWeight
public void increaseWeight()
Description copied from class:ConstraintIt increases the weight of the variables in the constraint scope.- Overrides:
increaseWeightin classConstraint
-
choose
public static Constraint choose(IntVar index, java.util.List<? extends IntVar> variables, IntVar value)
It constructs element constraint based on variables. The default shift value is equal 0.- Parameters:
index- index variable.variables- list of variables.value- variable to which index variable is equal to.- Returns:
- constraint that encodes the desired logic.
-
choose
public static Constraint choose(IntVar index, java.util.List<? extends IntVar> variables, IntVar value, int shift)
It constructs element constraint based on variables.- Parameters:
index- index variable.variables- variables list.value- value variable.shift- shift by which the index value is moved to the left.- Returns:
- constraint that encodes the desired logic.
-
choose
public static Constraint choose(IntVar index, int[] values, IntVar value)
It constructs element constraint based on variables. The default shift value is equal 0.- Parameters:
index- index variable.values- list of integers.value- variable to which index variable is equal to.- Returns:
- constraint that encodes the desired logic.
-
choose
public static Constraint choose(IntVar index, int[] values, IntVar value, int shift)
It constructs element constraint based on variables.- Parameters:
index- index variable.values- integer list.value- value variable.shift- shift by which the index value is moved to the left.- Returns:
- constraint that encodes the desired logic.
-
choose
public static Constraint choose(IntVar index, IntVar[] variables, IntVar value)
It constructs element constraint based on variables. The default shift value is equal 0.- Parameters:
index- index variable.variables- list of integers.value- variable to which index variable is equal to.- Returns:
- constraint that encodes the desired logic.
-
choose
public static Constraint choose(IntVar index, IntVar[] variables, IntVar value, int shift)
It constructs element constraint based on variables.- Parameters:
index- index variable.variables- variables list.value- value variable.shift- shift by which the index value is moved to the left.- Returns:
- constraint that encodes the desired logic.
-
-