public class IntVarImpl extends Object implements IntVar
SparseSetDomain.| Constructor and Description |
|---|
IntVarImpl(Solver cp,
int n)
Creates a variable with the elements {@code {0,...
|
IntVarImpl(Solver cp,
int min,
int max)
Creates a variable with the elements {@code {min,...
|
IntVarImpl(Solver cp,
Set<Integer> values)
Creates a variable with a given set of values as initial domain.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assign(int v)
Assigns the specified value
|
boolean |
contains(int v)
Returns true if the domain contains the specified value.
|
int |
fillArray(int[] dest)
Copies the values of the domain into an array.
|
Solver |
getSolver()
Returns the solver in which this variable was created.
|
boolean |
isBound()
Returns true if the domain of the variable has a single value.
|
int |
max()
Returns the maximum of the domain of the variable
|
int |
min()
Returns the minimum of the domain of the variable
|
void |
propagateOnBind(Constraint c)
Asks that
Constraint.propagate() is called whenever the domain
of this variable is reduced to a singleton. |
void |
propagateOnBoundChange(Constraint c)
Asks that
Constraint.propagate() is called whenever the
bound (maximum or minimum values) of the domain
of this variable is changes. |
void |
propagateOnDomainChange(Constraint c)
Asks that
Constraint.propagate() is called whenever the domain
of this variable changes. |
void |
remove(int v)
Removes the specified value.
|
void |
removeAbove(int v)
Remove all the values above a given value
|
void |
removeBelow(int v)
Remove all the values less than a given value
|
protected void |
scheduleAll(StateStack<Constraint> constraints) |
int |
size()
Returns the size of the domain of the variable
|
String |
toString() |
void |
whenBind(Procedure f)
Asks that the closure is called whenever the domain
of this variable is reduced to a single setValue
|
void |
whenBoundsChange(Procedure f)
Asks that the closure is called whenever
the max or min setValue of the domain of this variable changes
|
void |
whenDomainChange(Procedure f)
Asks that the closure is called whenever the domain change
of this variable changes
|
public IntVarImpl(Solver cp, int n)
{0,...,n-1}
as initial domain.cp - the solver in which the variable is createdn - the number of values with n > 0public IntVarImpl(Solver cp, int min, int max)
{min,...,max}
as initial domain.cp - the solver in which the variable is createdmin - the minimum value of the domainmax - the maximum value of the domain with max >= minpublic Solver getSolver()
IntVarpublic boolean isBound()
IntVarpublic void whenBind(Procedure f)
IntVarpublic void whenBoundsChange(Procedure f)
IntVarwhenBoundsChange in interface IntVarf - the closurepublic void whenDomainChange(Procedure f)
IntVarwhenDomainChange in interface IntVarf - the closurepublic void propagateOnDomainChange(Constraint c)
IntVarConstraint.propagate() is called whenever the domain
of this variable changes.
We say that a change event occurs.propagateOnDomainChange in interface IntVarc - the constraint for which the Constraint.propagate()
method should be called on change events of this variable.public void propagateOnBind(Constraint c)
IntVarConstraint.propagate() is called whenever the domain
of this variable is reduced to a singleton.
In such a state the variable is bind and we say that a bind event occurs.propagateOnBind in interface IntVarc - the constraint for which the Constraint.propagate()
method should be called on bind events of this variable.public void propagateOnBoundChange(Constraint c)
IntVarConstraint.propagate() is called whenever the
bound (maximum or minimum values) of the domain
of this variable is changes.
We say that a bound change event occurs in this case.propagateOnBoundChange in interface IntVarc - the constraint for which the Constraint.propagate()
method should be called on bound change events of this variable.protected void scheduleAll(StateStack<Constraint> constraints)
public int min()
IntVarpublic int max()
IntVarpublic int size()
IntVarpublic int fillArray(int[] dest)
IntVarpublic boolean contains(int v)
IntVarpublic void remove(int v)
IntVarpublic void assign(int v)
IntVarpublic void removeBelow(int v)
IntVarremoveBelow in interface IntVarv - the value such that all the values less than v are removedpublic void removeAbove(int v)
IntVarremoveAbove in interface IntVarv - the value such that all the values larger than v are removedCopyright © 2018 Laurent Michel, Pierre Schaus, Pascal Van Hentenryck. All rights reserved.