public class Sum extends AbstractConstraint
Constructor and Description |
---|
Sum(IntVar[] x)
Creates a sum constraint.
|
Sum(IntVar[] x,
int y)
Creates a sum constraint.
|
Sum(IntVar[] x,
IntVar y)
Creates a sum constraint.
|
Modifier and Type | Method and Description |
---|---|
void |
post()
Initializes the constraint when it is posted to the solver.
|
void |
propagate()
Propagates the constraint.
|
getSolver, isActive, isScheduled, setActive, setScheduled
public Sum(IntVar[] x, IntVar y)
This constraint holds iff
x[0]+x[1]+...+x[x.length-1] == y
.
x
- the non empty left hand side of the sumy
- the right hand side of the sumpublic Sum(IntVar[] x, int y)
This constraint holds iff
x[0]+x[1]+...+x[x.length-1] == y
.
x
- the non empty left hand side of the sumy
- the right hand side of the sumpublic Sum(IntVar[] x)
This constraint holds iff
x[0]+x[1]+...+x[x.length-1] == 0
.
x
- the non empty set of variables that should sum to zeropublic void post()
Constraint
post
in interface Constraint
post
in class AbstractConstraint
public void propagate()
Constraint
propagate
in interface Constraint
propagate
in class AbstractConstraint
Copyright © 2018 Laurent Michel, Pierre Schaus, Pascal Van Hentenryck. All rights reserved.