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
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.10
-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionDeprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionIt returns the variables in a scope of the constraint.static Constraint
It constructs element constraint based on variables.static Constraint
It constructs element constraint based on variables.static Constraint
It constructs element constraint based on variables.static Constraint
It constructs element constraint based on variables.static Constraint
It constructs element constraint based on variables.static Constraint
It constructs element constraint based on variables.void
consistency
(Store store) It is a (most probably incomplete) consistency function which removes the values from variables domains.int
It retrieves the pruning event which causes reevaluation of the constraint.int
id()
It gives the id string of a constraint.void
It imposes the constraint in a given store.void
It increases the weight of the variables in the constraint scope.void
queueVariable
(int level, Var V) This is a function called to indicate which variable in a scope of constraint has changed.void
It removes the constraint by removing this constraint from all variables.toString()
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 Details
-
c
-
-
Constructor Details
-
Element
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.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.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.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.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.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 Details
-
arguments
Description copied from class:Constraint
It returns the variables in a scope of the constraint.- Overrides:
arguments
in classConstraint
- Returns:
- variables in a scope of the constraint.
-
consistency
Description copied from class:Constraint
It 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:
consistency
in classConstraint
- Parameters:
store
- constraint store within which the constraint consistency is being checked.
-
getConsistencyPruningEvent
Description copied from class:Constraint
It retrieves the pruning event which causes reevaluation of the constraint.- Overrides:
getConsistencyPruningEvent
in 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:
getDefaultConsistencyPruningEvent
in classConstraint
-
id
Description copied from class:Constraint
It gives the id string of a constraint.- Overrides:
id
in classConstraint
- Returns:
- string id of the constraint.
-
impose
Description copied from class:Constraint
It imposes the constraint in a given store.- Overrides:
impose
in classConstraint
- Parameters:
store
- the constraint store to which the constraint is imposed to.
-
queueVariable
Description copied from class:Constraint
This 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:
queueVariable
in 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:Constraint
It removes the constraint by removing this constraint from all variables.- Overrides:
removeConstraint
in classConstraint
-
toString
Description copied from class:Constraint
It produces a string representation of a constraint state.- Overrides:
toString
in classConstraint
-
increaseWeight
public void increaseWeight()Description copied from class:Constraint
It increases the weight of the variables in the constraint scope.- Overrides:
increaseWeight
in classConstraint
-
choose
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, 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
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
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
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
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.
-