public abstract class IntDomain extends Domain
Modifier and Type | Field and Description |
---|---|
static int |
ANY
It specifies the constant for ANY event.
|
static int |
BOUND
It specifies the constant for BOUND event.
|
static int |
BoundDomainID
Unique identifier for a bound domain type.
|
static IntDomain |
emptyIntDomain
It specifies an empty integer domain.
|
static int |
GROUND
It specifies the constant for GROUND event.
|
static int |
IntervalDomainID
Unique identifier for an interval domain type.
|
static int |
MaxInt
It specifies the maximum element in the domain.
|
static int |
MinInt
It specifies the minimum element in the domain.
|
IntDomain |
previousDomain
It specifies the previous domain which was used by this domain.
|
static int |
SmallDenseDomainID
Unique identifier for a small dense domain type.
|
failException, modelConstraints, modelConstraintsToEvaluate, NOINFO, NONE, searchConstraints, searchConstraintsCloned, searchConstraintsToEvaluate, stamp
Constructor and Description |
---|
IntDomain() |
Modifier and Type | Method and Description |
---|---|
void |
addDom(IntDomain domain)
It adds values as specified by the parameter to the domain.
|
static int |
addInt(int x,
int y)
Returns the sum of its arguments,
if the result overflows MaxInt or MinInt is returned.
|
abstract IntDomain |
clone()
It clones the domain object.
|
abstract IntDomain |
cloneLight()
It clones the domain object, only data responsible for encoding domain
values is cloned.
|
abstract IntDomain |
complement()
It creates a complement of a domain.
|
boolean |
contains(int value)
It checks if value belongs to the domain.
|
boolean |
contains(IntDomain domain)
It specifies if the current domain contains the domain given as a
parameter.
|
abstract boolean |
contains(int min,
int max)
It checks if an interval min..max belongs to the domain.
|
static Interval |
divBounds(int a,
int b,
int c,
int d) |
static Interval |
divIntBounds(int a,
int b,
int c) |
static Interval |
divIntBounds(int a,
int b,
int c,
int d) |
static int |
divRoundDown(int a,
int b) |
static long |
divRoundDown(long a,
long b) |
static int |
divRoundUp(int a,
int b) |
static long |
divRoundUp(long a,
long b) |
int |
elementsSmallerThan(int el)
It returns the number of elements smaller than el.
|
boolean |
eq(IntDomain domain)
It specifies if the other int domain is equal to this one.
|
abstract int |
getElementAt(int index)
It access the element at the specified position.
|
int[] |
getEventsInclusion(int pruningEvent)
It helps to specify what events should be executed if a given event occurs.
|
abstract Interval |
getInterval(int position)
It returns required interval.
|
abstract IntDomain |
getPreviousDomain()
It returns domain at earlier level at which the change has occurred.
|
int |
getRandomValue()
It returns a random value from the domain.
|
abstract int |
getSize()
It returns the size of the domain.
|
void |
in(int level,
Var var,
Domain domain)
It enforces that this domain is included within the specified domain.
|
void |
in(int storeLevel,
Var var,
IntDomain domain)
It updates the domain to have values only within the domain.
|
abstract void |
in(int storeLevel,
Var var,
int min,
int max)
It updates the domain to have values only within the interval min..max.
|
void |
inComplement(int storeLevel,
Var var,
int complement)
It updates the domain to not contain the value complement.
|
abstract void |
inComplement(int storeLevel,
Var var,
int min,
int max)
It updates the domain so it does not contain the supplied interval.
|
void |
inMax(int storeLevel,
Var var,
int max)
It updates the domain according to the maximum value and stamp value.
|
void |
inMin(int storeLevel,
Var var,
int min)
It updates the domain according to the minimum value and stamp value.
|
abstract void |
inShift(int storeLevel,
Var var,
IntDomain domain,
int shift)
It updates the domain to contain the elements as specifed by the domain,
which is shifted.
|
abstract IntDomain |
intersect(IntDomain dom)
It intersects current domain with the one given as a parameter.
|
abstract IntDomain |
intersect(int min,
int max)
In intersects current domain with the interval min..max.
|
abstract int |
intersectAdapt(IntDomain intersect)
It computes an intersection with a given domain and stores it in this domain.
|
abstract int |
intersectAdapt(int min,
int max)
It computes an intersection of this domain with an interval [min..max].
|
abstract IntervalEnumeration |
intervalEnumeration()
It returns interval enumeration of the domain values.
|
void |
inValue(int level,
IntVar var,
int value)
It reduces domain to a single value.
|
boolean |
isIntersecting(IntDomain domain)
Checks if two domains intersect.
|
abstract boolean |
isIntersecting(int min,
int max)
It checks if interval min..max intersects with current domain.
|
int |
leftElement(int intervalNo)
It returns the left most element of the given interval.
|
int |
lex(IntDomain domain) |
abstract int |
max()
It returns the maximum value in a domain.
|
abstract int |
min()
It returns the minimum value in a domain.
|
static Interval |
mulBounds(int a,
int b,
int c) |
static Interval |
mulBounds(int a,
int b,
int c,
int d) |
static int |
multiplyInt(int x,
int y)
Returns the product of the arguments,
if the result overflows MaxInt or MinInt is returned.
|
abstract int |
nextValue(int value)
It gives next value in the domain from the given one (lexigraphical
ordering).
|
int |
noConstraints()
It returns the number of constraints
|
abstract int |
noIntervals()
It returns number of intervals required to represent this domain.
|
abstract int |
previousValue(int value)
It gives previous value in the domain from the given one (lexigraphical
ordering).
|
void |
putModelConstraint(int storeLevel,
Var var,
Constraint c,
int pruningEvent)
It adds a constraint to a domain, it should only be called by
putConstraint function of Variable object.
|
void |
putSearchConstraint(int storeLevel,
Var var,
Constraint c)
It adds a constraint to a domain, it should only be called by
putConstraint function of Variable object.
|
abstract IntDomain |
recentDomainPruning(int currentStoreLevel)
It returns the values which have been removed at current store level.
|
void |
removeModelConstraint(int storeLevel,
Var var,
Constraint c)
It removes a constraint from a domain, it should only be called by
removeConstraint function of Variable object.
|
void |
removeSearchConstraint(int storeLevel,
Var var,
Constraint c)
It removes a constraint from a domain, it should only be called by
removeConstraint function of Variable object.
|
void |
removeSearchConstraint(int storeLevel,
Var var,
int position,
Constraint c)
It removes a constraint from a domain, it should only be called by
removeConstraint function of Variable object.
|
int |
rightElement(int intervalNo)
It returns the right most element of the given interval.
|
abstract void |
setDomain(IntDomain domain)
It sets the domain to the specified domain.
|
abstract void |
setDomain(int min,
int max)
It sets this domain to contain exactly all values between min and max.
|
boolean |
singleton(Domain value)
It returns true if given domain has only one element.
|
boolean |
singleton(int c)
It returns true if given domain has only one element equal c.
|
int |
sizeOfIntersection(IntDomain domain)
It computes the size of the intersection between this domain and the domain
supplied as a parameter.
|
static Interval |
squareBounds(int a,
int b) |
IntDomain |
subtract(int value)
It intersects with the domain which is a complement of value.
|
IntDomain |
subtract(IntDomain domain)
It subtracts domain from current domain and returns the result.
|
abstract IntDomain |
subtract(int min,
int max)
It subtracts interval min..max.
|
abstract void |
subtractAdapt(int value)
It removes value from the domain.
|
abstract void |
subtractAdapt(int min,
int max)
It removes all values between min and max to the domain.
|
static int |
subtractInt(int x,
int y)
Returns the difference of the arguments,
if the result overflows MaxInt or MinInt is returned.
|
int[] |
toIntArray()
It constructs and int array containing all elements in the domain.
|
IntDomain |
union(int value)
It computes union of this domain and value.
|
IntDomain |
union(IntDomain domain)
It computes union of the supplied domain with this domain.
|
IntDomain |
union(int min,
int max)
It computes union of this domain and the interval.
|
void |
unionAdapt(int value)
It adds a values to the domain.
|
int |
unionAdapt(IntDomain union)
It computes a union between this domain and the domain provided as a parameter.
|
void |
unionAdapt(Interval i)
It adds interval of values to the domain.
|
abstract void |
unionAdapt(int min,
int max)
It adds all values between min and max to the domain.
|
int |
value()
It returns the value to which this domain is grounded.
|
abstract ValueEnumeration |
valueEnumeration()
It returns value enumeration of the domain values.
|
checkInvariants, clear, constraints, domainID, isEmpty, isNumeric, isSparseRepresentation, noSearchConstraints, removeLevel, searchConstraints, setStamp, singleton, sizeConstraints, sizeConstraintsOriginal, stamp, toString, toStringConstraints, toStringFull
public static final int MinInt
public static final int MaxInt
public static final int GROUND
public static final int BOUND
public static final int ANY
public static final int IntervalDomainID
public static final int BoundDomainID
public static final int SmallDenseDomainID
public static final IntDomain emptyIntDomain
public IntDomain previousDomain
public int[] getEventsInclusion(int pruningEvent)
getEventsInclusion
in class Domain
pruningEvent
- the pruning event for which we want to know what events it encompasses.public void unionAdapt(Interval i)
i
- Interval which needs to be added to the domain.public void addDom(IntDomain domain)
domain
- Domain which needs to be added to the domain.public abstract void unionAdapt(int min, int max)
min
- the left bound of the interval being added.max
- the right bound of the interval being added.public void unionAdapt(int value)
value
- value being added to the domain.public boolean isIntersecting(IntDomain domain)
domain
- the domain for which intersection is checked.public abstract boolean isIntersecting(int min, int max)
min
- the left bound of the interval.max
- the right bound of the interval.public boolean contains(IntDomain domain)
domain
- for which we check if it is contained in the current domain.public abstract boolean contains(int min, int max)
min
- the minimum value of the interval being checkedmax
- the maximum value of the interval being checkedpublic abstract IntDomain complement()
public boolean contains(int value)
value
- which is checked if it exists in the domain.public abstract int nextValue(int value)
value
- it specifies the value after which a next value has to be found.public abstract int previousValue(int value)
value
- before which a value is seeked for.public abstract ValueEnumeration valueEnumeration()
valueEnumeration
in class Domain
public abstract IntervalEnumeration intervalEnumeration()
public abstract int getSize()
public abstract IntDomain intersect(IntDomain dom)
dom
- domain with which the intersection needs to be computed.public abstract IntDomain intersect(int min, int max)
min
- the left bound of the interval (inclusive)max
- the right bound of the interval (inclusive)public IntDomain subtract(int value)
value
- the value for which the complement is computedpublic abstract void subtractAdapt(int value)
value
- the value for which the complement is computedpublic abstract void subtractAdapt(int min, int max)
min
- the left bound of the interval being removed.max
- the right bound of the interval being removed.public abstract int max()
public abstract int min()
public abstract void setDomain(IntDomain domain)
domain
- the domain from which this domain takes all elements.public abstract void setDomain(int min, int max)
min
- the left bound of the interval (inclusive).max
- the right bound of the interval (inclusive).public boolean singleton(int c)
c
- the value to which the only element should be equal to.public IntDomain subtract(IntDomain domain)
domain
- the domain which is subtracted from this domain.public abstract IntDomain subtract(int min, int max)
min
- the left bound of the interval (inclusive).max
- the right bound of the interval (inclusive).public IntDomain union(IntDomain domain)
domain
- the domain for which the union is computed.public IntDomain union(int min, int max)
min
- the left bound of the interval (inclusive).max
- the right bound of the interval (inclusive).public IntDomain union(int value)
value
- it specifies the value which is being added.public void inMin(int storeLevel, Var var, int min)
storeLevel
- level of the store at which the update occurs.var
- variable for which this domain is used.min
- the minimum value to which the domain is updated.public void inMax(int storeLevel, Var var, int max)
storeLevel
- level of the store at which the update occurs.var
- variable for which this domain is used.max
- the maximum value to which the domain is updated.public abstract void in(int storeLevel, Var var, int min, int max)
storeLevel
- level of the store at which the update occurs.var
- variable for which this domain is used.min
- the minimum value to which the domain is updated.max
- the maximum value to which the domain is updated.public void inValue(int level, IntVar var, int value)
level
- level of the store at which the update occurs.var
- variable for which this domain is used.value
- the value according to which the domain is updated.public void in(int storeLevel, Var var, IntDomain domain)
storeLevel
- level of the store at which the update occurs.var
- variable for which this domain is used.domain
- the domain according to which the domain is updated.public void inComplement(int storeLevel, Var var, int complement)
storeLevel
- level of the store at which the update occurs.var
- variable for which this domain is used.complement
- value which is removed from the domain if it belonged to the domain.public abstract void inComplement(int storeLevel, Var var, int min, int max)
storeLevel
- level of the store at which the update occurs.var
- variable for which this domain is used.min
- the left bound of the interval (inclusive).max
- the right bound of the interval (inclusive).public abstract int noIntervals()
public abstract Interval getInterval(int position)
position
- the position of the interval.public abstract void inShift(int storeLevel, Var var, IntDomain domain, int shift)
storeLevel
- level of the store at which the update occurs.var
- variable for which this domain is used.domain
- the domain according to which the domain is updated.shift
- the shift which is used to shift the domain supplied as argument.public int leftElement(int intervalNo)
intervalNo
- the interval number.public int rightElement(int intervalNo)
intervalNo
- the interval number.public abstract IntDomain recentDomainPruning(int currentStoreLevel)
currentStoreLevel
- the current store level.public abstract IntDomain getPreviousDomain()
public boolean eq(IntDomain domain)
domain
- the domain which is compared to this domain.public void in(int level, Var var, Domain domain)
Domain
public boolean singleton(Domain value)
Domain
public int noConstraints()
Domain
noConstraints
in class Domain
public void putModelConstraint(int storeLevel, Var var, Constraint c, int pruningEvent)
putModelConstraint
in class Domain
storeLevel
- the level at which the model constraint is to be added.var
- variable to which the constraint is attached to.c
- the constraint which is being attached to a variable.pruningEvent
- the type of the prunning event required to check the consistency of the attached constraint.public void removeModelConstraint(int storeLevel, Var var, Constraint c)
Domain
removeModelConstraint
in class Domain
storeLevel
- specifies the current level of the store, from which it should be removed.var
- specifies variable for which the constraint is being removed.c
- the constraint which is being removed.public void putSearchConstraint(int storeLevel, Var var, Constraint c)
putSearchConstraint
in class Domain
storeLevel
- the level at which the search constraint is to be added.var
- variable to which the constraint is attached to.c
- the constraint which is being attached to a variable.public void removeSearchConstraint(int storeLevel, Var var, Constraint c)
storeLevel
- the current level of the store.var
- the variable for which the constraint is being removed.c
- the constraint being removed.public void removeSearchConstraint(int storeLevel, Var var, int position, Constraint c)
removeSearchConstraint
in class Domain
storeLevel
- specifies the current level of the store, from which it should be removed.var
- specifies variable for which the constraint is being removed.position
- specifies the position of the removed constraint.c
- the constraint which is being removed.public abstract IntDomain clone()
Domain
public abstract IntDomain cloneLight()
Domain
cloneLight
in class Domain
public int lex(IntDomain domain)
public int elementsSmallerThan(int el)
el
- the element from which counted elements must be smaller than.public abstract int intersectAdapt(IntDomain intersect)
intersect
- domain with which the intersection is being computed.public int unionAdapt(IntDomain union)
union
- the domain with is used for the union operation with this domain.public abstract int intersectAdapt(int min, int max)
min
- the minimum value of the interval used in the intersection computation.max
- the maximum value of the interval used in the intersection computation.public int sizeOfIntersection(IntDomain domain)
domain
- the domain with which the intersection is computed.public abstract int getElementAt(int index)
index
- the position of the element, indexing starts from 0.public int[] toIntArray()
public int value()
public int getRandomValue()
public static final Interval mulBounds(int a, int b, int c, int d)
public static final Interval mulBounds(int a, int b, int c)
public static final Interval squareBounds(int a, int b)
public static final Interval divBounds(int a, int b, int c, int d)
public static final Interval divIntBounds(int a, int b, int c, int d)
public static final Interval divIntBounds(int a, int b, int c)
public static long divRoundDown(long a, long b)
public static long divRoundUp(long a, long b)
public static int divRoundDown(int a, int b)
public static int divRoundUp(int a, int b)
public static int multiplyInt(int x, int y)
x
- the first valuey
- the second valuepublic static int addInt(int x, int y)
x
- the first valuey
- the second valuepublic static int subtractInt(int x, int y)
x
- the first valuey
- the second value to subtract from the firstCopyright © 2022. All rights reserved.