Package org.jacop.constraints
Class LinearIntDom
- java.lang.Object
-
- org.jacop.constraints.DecomposedConstraint<Constraint>
-
- org.jacop.constraints.Constraint
-
- org.jacop.constraints.PrimitiveConstraint
-
- org.jacop.constraints.LinearInt
-
- org.jacop.constraints.LinearIntDom
-
- All Implemented Interfaces:
SatisfiedPresent
,StoreAware
public class LinearIntDom extends LinearInt
LinearIntDom constraint implements the weighted summation over several variables.sum(i in 1..N)(ai*xi) = b
It provides the weighted sum from all variables on the list. The weights are integers. Domain consistency is used.
- Version:
- 4.7
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int[]
assignments
Collects support (valid assignments) for variables(package private) static java.util.concurrent.atomic.AtomicInteger
idNumber
(package private) double
limitDomainPruning
Limit on the product of sizes of domains when domain consistency is carried out.(package private) IntervalDomain[]
support
Defines support (valid values) for each variable-
Fields inherited from class org.jacop.constraints.LinearInt
a, b, eq, ge, gt, I, l, le, lt, ne, negRel, pos, reified, relationType, store, sumMax, sumMin, x
-
Fields inherited from class org.jacop.constraints.PrimitiveConstraint
notConsistencyPruningEvents
-
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 LinearIntDom(java.util.List<? extends IntVar> variables, java.util.List<java.lang.Integer> weights, java.lang.String rel, int sum)
It constructs the constraint LinearIntDom.LinearIntDom(IntVar[] list, int[] weights, java.lang.String rel, int sum)
It constructs the constraint LinearIntDom.LinearIntDom(IntVar[] list, int[] weights, java.lang.String rel, IntVar sum)
It constructs the constraint LinearIntDom.LinearIntDom(Store store, java.util.List<? extends IntVar> variables, java.util.List<java.lang.Integer> weights, java.lang.String rel, int sum)
Deprecated.LinearIntDom constraint does not use Store parameter any longer.LinearIntDom(Store store, IntVar[] list, int[] weights, java.lang.String rel, int sum)
Deprecated.LinearIntDom constraint does not use Store parameter any longer.LinearIntDom(Store store, IntVar[] list, int[] weights, java.lang.String rel, IntVar sum)
Deprecated.LinearIntDom constraint does not use Store parameter any longer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
consistency(Store store)
It is a (most probably incomplete) consistency function which removes the values from variables domains.(package private) double
domainSize()
(package private) void
findSupport(int index, long sum)
(package private) void
findSupportNegative(int index, long partialSum)
(package private) void
findSupportPositive(int index, long partialSum)
int
getDefaultConsistencyPruningEvent()
protected int
getDefaultNestedConsistencyPruningEvent()
protected int
getDefaultNestedNotConsistencyPruningEvent()
protected int
getDefaultNotConsistencyPruningEvent()
void
notConsistency(Store store)
It makes pruning in such a way that constraint is notConsistent.void
propagate(int rel)
(package private) void
pruneEq()
(package private) void
pruneNeq()
java.lang.String
toString()
It produces a string representation of a constraint state.-
Methods inherited from class org.jacop.constraints.LinearInt
checkForOverflow, commonInitialization, computeInit, impose, notSatisfied, pruneGtEq, pruneLtEq, rel2String, relation, satisfied, satisfiedEq, satisfiedGtEq, satisfiedLtEq, satisfiedNeq
-
Methods inherited from class org.jacop.constraints.PrimitiveConstraint
getNestedPruningEvent, getNotConsistencyPruningEvent, include, setNotConsistencyPruningEvent
-
Methods inherited from class org.jacop.constraints.Constraint
afc, arguments, cleanAfterFailure, decompose, getConsistencyPruningEvent, getGuideConstraint, getGuideValue, getGuideVariable, grounded, grounded, id, impose, imposeDecomposition, increaseWeight, intArrayToString, long2int, numberArgs, queueVariable, removeConstraint, 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
-
idNumber
static java.util.concurrent.atomic.AtomicInteger idNumber
-
support
IntervalDomain[] support
Defines support (valid values) for each variable
-
assignments
int[] assignments
Collects support (valid assignments) for variables
-
limitDomainPruning
double limitDomainPruning
Limit on the product of sizes of domains when domain consistency is carried out.
-
-
Constructor Detail
-
LinearIntDom
@Deprecated public LinearIntDom(Store store, IntVar[] list, int[] weights, java.lang.String rel, int sum)
Deprecated.LinearIntDom constraint does not use Store parameter any longer.It constructs the constraint LinearIntDom.- Parameters:
store
- current storelist
- variables which are being multiplied by weights.weights
- weight for each variable.rel
- the relation, one of "==", "<", ">", "<=", ">=", "!="sum
- the sum of weighted variables.
-
LinearIntDom
@Deprecated public LinearIntDom(Store store, IntVar[] list, int[] weights, java.lang.String rel, IntVar sum)
Deprecated.LinearIntDom constraint does not use Store parameter any longer.It constructs the constraint LinearIntDom.- Parameters:
store
- current storelist
- variables which are being multiplied by weights.weights
- weight for each variable.rel
- the relation, one of "==", "<", ">", "<=", ">=", "!="sum
- variable containing the sum of weighted variables.
-
LinearIntDom
@Deprecated public LinearIntDom(Store store, java.util.List<? extends IntVar> variables, java.util.List<java.lang.Integer> weights, java.lang.String rel, int sum)
Deprecated.LinearIntDom constraint does not use Store parameter any longer.It constructs the constraint LinearIntDom.- Parameters:
store
- current storevariables
- variables which are being multiplied by weights.weights
- weight for each variable.rel
- the relation, one of "==", "<", ">", "<=", ">=", "!="sum
- variable containing the sum of weighted variables.
-
LinearIntDom
public LinearIntDom(IntVar[] list, int[] weights, java.lang.String rel, int sum)
It constructs the constraint LinearIntDom.- Parameters:
list
- variables which are being multiplied by weights.weights
- weight for each variable.rel
- the relation, one of "==", "<", ">", "<=", ">=", "!="sum
- the sum of weighted variables.
-
LinearIntDom
public LinearIntDom(IntVar[] list, int[] weights, java.lang.String rel, IntVar sum)
It constructs the constraint LinearIntDom.- Parameters:
list
- variables which are being multiplied by weights.weights
- weight for each variable.rel
- the relation, one of "==", "<", ">", "<=", ">=", "!="sum
- variable containing the sum of weighted variables.
-
LinearIntDom
public LinearIntDom(java.util.List<? extends IntVar> variables, java.util.List<java.lang.Integer> weights, java.lang.String rel, int sum)
It constructs the constraint LinearIntDom.- Parameters:
variables
- variables which are being multiplied by weights.weights
- weight for each variable.rel
- the relation, one of "==", "<", ">", "<=", ">=", "!="sum
- variable containing the sum of weighted variables.
-
-
Method Detail
-
consistency
public void consistency(Store store)
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.- Overrides:
consistency
in classLinearInt
- Parameters:
store
- constraint store within which the constraint consistency is being checked.
-
notConsistency
public void notConsistency(Store store)
Description copied from class:PrimitiveConstraint
It makes pruning in such a way that constraint is notConsistent. It removes values which always belong to a solution.- Overrides:
notConsistency
in classLinearInt
- Parameters:
store
- the constraint store in which context the notConsistency technique is evaluated.
-
domainSize
double domainSize()
-
pruneEq
void pruneEq()
-
findSupport
void findSupport(int index, long sum)
-
findSupportPositive
void findSupportPositive(int index, long partialSum)
-
findSupportNegative
void findSupportNegative(int index, long partialSum)
-
getDefaultNestedConsistencyPruningEvent
protected int getDefaultNestedConsistencyPruningEvent()
- Overrides:
getDefaultNestedConsistencyPruningEvent
in classLinearInt
-
getDefaultNestedNotConsistencyPruningEvent
protected int getDefaultNestedNotConsistencyPruningEvent()
- Overrides:
getDefaultNestedNotConsistencyPruningEvent
in classLinearInt
-
getDefaultConsistencyPruningEvent
public int getDefaultConsistencyPruningEvent()
- Overrides:
getDefaultConsistencyPruningEvent
in classLinearInt
-
getDefaultNotConsistencyPruningEvent
protected int getDefaultNotConsistencyPruningEvent()
- Overrides:
getDefaultNotConsistencyPruningEvent
in classLinearInt
-
toString
public java.lang.String toString()
Description copied from class:Constraint
It produces a string representation of a constraint state.
-
-