public class Sum extends Constraint implements SatisfiedPresent
Modifier and Type | Field and Description |
---|---|
IntVar[] |
list
It specifies the variables to be summed.
|
IntVar |
sum
It specifies variable sum to store the overall sum of the variables being summed up.
|
atomicExecution, consistencyPruningEvents, constraintScope, earlyTerminationOK, increaseWeight, numberId, scope, trace
queueIndex
Constructor and Description |
---|
Sum(IntVar[] list,
IntVar sum)
It constructs sum constraint which sums all variables and makes it equal to variable sum.
|
Sum(List<? extends IntVar> list,
IntVar sum)
It creates a sum constraints which sums all variables and makes it equal to variable sum.
|
Modifier and Type | Method and Description |
---|---|
void |
consistency(Store store)
It is a (most probably incomplete) consistency function which removes the
values from variables domains.
|
int |
getDefaultConsistencyPruningEvent() |
Constraint |
getGuideConstraint()
It specifies a constraint which if imposed by search will enhance
propagation of this constraint.
|
int |
getGuideValue()
This function provides a value which if assigned to a variable returned
by getGuideVariable() will enhance propagation of this constraint.
|
Var |
getGuideVariable()
This function provides a variable which assigned a value returned
by will enhance propagation of this constraint.
|
void |
impose(Store store)
It imposes the constraint in a given store.
|
boolean |
satisfied()
It checks if the constraint is satisfied.
|
void |
supplyGuideFeedback(boolean feedback)
This function allows to provide a guide feedback.
|
String |
toString()
It produces a string representation of a constraint state.
|
afc, arguments, cleanAfterFailure, decompose, getConsistencyPruningEvent, grounded, grounded, id, impose, imposeDecomposition, increaseWeight, intArrayToString, long2int, numberArgs, queueVariable, removeConstraint, requiresMonotonicity, setConsistencyPruningEvent, setConstraintScope, setScope, setScope, setScope, setScope, setScope, setWatchedVariableGrounded, updateAFC, watchedVariableGrounded
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
public IntVar[] list
public IntVar sum
public Sum(IntVar[] list, IntVar sum)
list
- list of variables to be addedsum
- the resulting sumpublic void consistency(Store store)
Constraint
consistency
in class Constraint
store
- constraint store within which the constraint consistency is being checked.public int getDefaultConsistencyPruningEvent()
getDefaultConsistencyPruningEvent
in class Constraint
public void impose(Store store)
Constraint
impose
in class Constraint
store
- the constraint store to which the constraint is imposed to.public boolean satisfied()
SatisfiedPresent
Implementations of this interface for constraints that are not PrimitiveConstraint may require constraint imposition and consistency check as a requirement to work correctly.
satisfied
in interface SatisfiedPresent
public String toString()
Constraint
toString
in class Constraint
public Constraint getGuideConstraint()
Constraint
getGuideConstraint
in class Constraint
public int getGuideValue()
Constraint
getGuideValue
in class Constraint
public Var getGuideVariable()
Constraint
getGuideVariable
in class Constraint
public void supplyGuideFeedback(boolean feedback)
Constraint
supplyGuideFeedback
in class Constraint
feedback
- true if the guide was useful, false otherwise.Copyright © 2022. All rights reserved.