Modifier and Type | Field and Description |
---|---|
static IntervalDomain |
emptyDomain
An empty domain, so no constant creation of empty domains is required.
|
Interval[] |
intervals
The values of the domain are encoded as a list of intervals.
|
int |
size
It specifies number of intervals needed to encode the domain.
|
ANY, BOUND, BoundDomainID, emptyIntDomain, GROUND, IntervalDomainID, MaxInt, MinInt, previousDomain, SmallDenseDomainID
failException, modelConstraints, modelConstraintsToEvaluate, NOINFO, NONE, searchConstraints, searchConstraintsCloned, searchConstraintsToEvaluate, stamp
Constructor and Description |
---|
IntervalDomain()
Empty constructor, does not initialize anything.
|
IntervalDomain(int size)
It creates an empty domain, with at least specified number of places in
an array list for intervals.
|
IntervalDomain(int min,
int max)
It creates domain with all values between min and max.
|
Modifier and Type | Method and Description |
---|---|
void |
addDom(IntDomain domain)
It adds values as specified by the parameter to the domain.
|
void |
addLastElement(int i)
It adds a value to the domain.
|
String |
checkInvariants()
It is a function to check if the object is in consistent state.
|
void |
clear()
It removes all elements.
|
IntervalDomain |
clone()
It clones the domain object.
|
IntervalDomain |
cloneLight()
It clones the domain object, only data responsible for encoding domain
values is cloned.
|
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.
|
boolean |
contains(int min,
int max)
It checks if an interval min..max belongs to the domain.
|
int |
domainID()
It returns an unique identifier of the domain.
|
boolean |
eq(IntDomain domain)
It checks if the domain is equal to the supplied domain.
|
int |
getElementAt(int index)
It access the element at the specified position.
|
Interval |
getInterval(int position)
It returns required interval.
|
IntDomain |
getPreviousDomain()
It returns domain at earlier level at which the change has occurred.
|
int |
getRandomValue()
It returns a random value from the domain.
|
int |
getSize()
It returns the size of the domain.
|
void |
in(int storeLevel,
Var var,
IntDomain domain)
It updates the domain to have values only within the domain.
|
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.
|
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.
|
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.
|
IntDomain |
intersect(IntDomain domain)
It interesects current domain with the one given as a parameter.
|
IntDomain |
intersect(int min,
int max)
In intersects current domain with the domain min..max.
|
int |
intersectAdapt(IntDomain domain)
It computes an intersection with a given domain and stores it in this domain.
|
int |
intersectAdapt(int min,
int max)
It computes an intersection of this domain with an interval [min..max].
|
IntervalEnumeration |
intervalEnumeration()
It returns interval enumeration of the domain values.
|
int |
intervalNo(int value)
It specifies the position of the interval which contains specified value.
|
void |
inValue(int storeLevel,
IntVar var,
int value)
It updates the domain to have a single value within its domain.
|
boolean |
isEmpty()
It returns true if given domain is empty.
|
boolean |
isIntersecting(IntDomain domain)
Checks if two domains intersect.
|
boolean |
isIntersecting(int min,
int max)
It checks if interval min..max intersects with current domain.
|
boolean |
isNumeric()
It specifies if domain is a finite domain of numeric values (integers).
|
boolean |
isSparseRepresentation()
It specifies if the domain type is more suited to representing sparse
domain.
|
int |
leftElement(int intervalNo)
It returns the left most element of the given interval.
|
int |
max()
It returns the maximum value in a domain.
|
int |
min()
It returns the minimum value in a domain.
|
IntDomain |
multiply(int mul)
{1..4} * 6 = {6, 12, 18, 24}
|
int |
nextValue(int value)
It gives next value in the domain from the given value (lexigraphical
ordering).
|
int |
noIntervals()
It returns the number intervals into which this domain is split.
|
int |
previousValue(int value)
It gives previous value in the domain from the given one (lexigraphical
ordering).
|
IntDomain |
recentDomainPruning(int storeLevel)
It removes a constraint from a domain, it should only be called by
removeConstraint function of Variable object.
|
void |
removeInterval(int position)
It removes the counter-th interval from the domain.
|
void |
removeLevel(int level,
Var var)
It removes a level of a domain.
|
int |
rightElement(int intervalNo)
It returns the left most element of the given interval.
|
void |
setDomain(IntDomain domain)
It sets the domain to the specified domain.
|
void |
setDomain(int min,
int max)
It sets the domain to all values between min and max.
|
boolean |
singleton()
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 |
sizeConstraintsOriginal()
It returns all constraints which are associated with variable, even the
ones which are already satisfied.
|
int |
sizeOfIntersection(IntDomain domain)
It computes the size of the intersection between this domain and the domain
supplied as a parameter.
|
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.
|
IntervalDomain |
subtract(int min,
int max)
It subtracts min..max from current domain and returns the result.
|
void |
subtractAdapt(int value)
It removes value from the domain.
|
void |
subtractAdapt(int minValue,
int maxValue)
It removes all values between min and max to the domain.
|
String |
toString()
It returns string description of the domain (only values in the domain).
|
String |
toStringConstraints()
It returns string description of the constraints attached to the domain.
|
String |
toStringFull()
It returns complete string description containing all relevant
information.
|
IntDomain |
union(int value)
It computes union of dom1 and value and returns the result.
|
IntDomain |
union(IntDomain domain)
It computes union of dom1 from dom2 and returns the result.
|
IntDomain |
union(int min,
int max)
It computes union of current domain and an interval min..max;
|
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.
|
void |
unionAdapt(int min,
int max)
It adds all values between min and max to the domain.
|
ValueEnumeration |
valueEnumeration()
It returns value enumeration of the domain values.
|
addInt, divBounds, divIntBounds, divIntBounds, divRoundDown, divRoundDown, divRoundUp, divRoundUp, elementsSmallerThan, getEventsInclusion, in, lex, mulBounds, mulBounds, multiplyInt, noConstraints, putModelConstraint, putSearchConstraint, removeModelConstraint, removeSearchConstraint, removeSearchConstraint, singleton, squareBounds, subtractInt, toIntArray, value
constraints, noSearchConstraints, searchConstraints, setStamp, sizeConstraints, stamp
public Interval[] intervals
public int size
public static final IntervalDomain emptyDomain
public IntervalDomain()
public IntervalDomain(int size)
size
- defines the initial size of an array storing the intervals.public IntervalDomain(int min, int max)
min
- defines the left bound of a domain.max
- defines the right bound of a domain.public IntDomain getPreviousDomain()
IntDomain
getPreviousDomain
in class IntDomain
public void unionAdapt(Interval i)
unionAdapt
in class IntDomain
i
- Interval which needs to be added to the domain.public void addLastElement(int i)
i
- the element to be added as the lase element of the domainpublic void addDom(IntDomain domain)
public void unionAdapt(int min, int max)
unionAdapt
in class IntDomain
min
- the left bound of the interval being added.max
- the right bound of the interval being added.public boolean isIntersecting(IntDomain domain)
isIntersecting
in class IntDomain
domain
- the domain for which intersection is checked.public boolean isIntersecting(int min, int max)
IntDomain
isIntersecting
in class IntDomain
min
- the left bound of the interval.max
- the right bound of the interval.public IntervalDomain cloneLight()
cloneLight
in class IntDomain
public IntervalDomain clone()
public boolean contains(IntDomain domain)
public IntDomain complement()
complement
in class IntDomain
public boolean contains(int value)
public int nextValue(int value)
public ValueEnumeration valueEnumeration()
valueEnumeration
in class IntDomain
public IntervalEnumeration intervalEnumeration()
intervalEnumeration
in class IntDomain
public boolean eq(IntDomain domain)
public int getSize()
public IntDomain intersect(IntDomain domain)
public IntDomain intersect(int min, int max)
public IntDomain subtract(int value)
IntDomain
public boolean isEmpty()
public int max()
public int min()
public IntDomain multiply(int mul)
mul
- the multiplier constant.public void removeInterval(int position)
position
- it specifies the position of the removed interval.public void setDomain(IntDomain domain)
public void setDomain(int min, int max)
public boolean singleton()
public boolean singleton(int c)
public IntDomain subtract(IntDomain domain)
public IntervalDomain subtract(int min, int max)
public IntDomain union(IntDomain domain)
public IntDomain union(int min, int max)
public IntDomain union(int value)
public String toString()
public String toStringConstraints()
toStringConstraints
in class Domain
public String toStringFull()
toStringFull
in class Domain
public void inMin(int storeLevel, Var var, int min)
public void inMax(int storeLevel, Var var, int max)
public void in(int storeLevel, Var var, int min, int max)
public void inValue(int storeLevel, IntVar var, int value)
public void in(int storeLevel, Var var, IntDomain domain)
public int noIntervals()
noIntervals
in class IntDomain
public int intervalNo(int value)
value
- value for which an interval containing it is searched.public Interval getInterval(int position)
IntDomain
getInterval
in class IntDomain
position
- the position of the interval.public void inComplement(int storeLevel, Var var, int complement)
inComplement
in class IntDomain
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 void inComplement(int storeLevel, Var var, int min, int max)
IntDomain
inComplement
in class IntDomain
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 void inShift(int storeLevel, Var var, IntDomain domain, int shift)
public int domainID()
public boolean isSparseRepresentation()
isSparseRepresentation
in class Domain
public boolean isNumeric()
public int leftElement(int intervalNo)
leftElement
in class IntDomain
intervalNo
- the interval number.public int rightElement(int intervalNo)
rightElement
in class IntDomain
intervalNo
- the interval number.public void removeLevel(int level, Var var)
removeLevel
in class Domain
level
- the level which is being removed.var
- the variable to which this domain belonged to.public IntDomain recentDomainPruning(int storeLevel)
recentDomainPruning
in class IntDomain
storeLevel
- the current store level.public int sizeConstraintsOriginal()
sizeConstraintsOriginal
in class Domain
public int previousValue(int value)
IntDomain
previousValue
in class IntDomain
value
- before which a value is seeked for.public String checkInvariants()
checkInvariants
in class Domain
public void unionAdapt(int value)
IntDomain
unionAdapt
in class IntDomain
value
- value being added to the domain.public void subtractAdapt(int value)
IntDomain
subtractAdapt
in class IntDomain
value
- the value for which the complement is computedpublic void subtractAdapt(int minValue, int maxValue)
IntDomain
subtractAdapt
in class IntDomain
minValue
- the left bound of the interval being removed.maxValue
- the right bound of the interval being removed.public int intersectAdapt(IntDomain domain)
IntDomain
intersectAdapt
in class IntDomain
domain
- domain with which the intersection is being computed.public int unionAdapt(IntDomain union)
IntDomain
unionAdapt
in class IntDomain
union
- the domain with is used for the union operation with this domain.public int intersectAdapt(int min, int max)
IntDomain
intersectAdapt
in class IntDomain
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)
IntDomain
sizeOfIntersection
in class IntDomain
domain
- the domain with which the intersection is computed.public int getElementAt(int index)
IntDomain
getElementAt
in class IntDomain
index
- the position of the element, indexing starts from 0.public int getRandomValue()
IntDomain
getRandomValue
in class IntDomain
public boolean contains(int min, int max)
IntDomain
Copyright © 2022. All rights reserved.