public class SmallDenseDomain extends IntDomain
Modifier and Type | Field and Description |
---|---|
long |
bits
It stores information about presence of the elements in the domain.
|
static SmallDenseDomain |
emptyDomain
It is an empty domain returned by default when empty domain becomes a result of
any function.
|
int |
min
The minimal value present in this domain encoding.
|
IntDomain |
previousDomain
It specifies the previous domain which was used by this domain.
|
ANY, BOUND, BoundDomainID, emptyIntDomain, eventsInclusion, GROUND, IntervalDomainID, MaxInt, MinInt, SmallDenseDomainID
failException, modelConstraints, modelConstraintsToEvaluate, NOINFO, NONE, searchConstraints, searchConstraintsCloned, searchConstraintsToEvaluate, stamp
Constructor and Description |
---|
SmallDenseDomain()
It creates an empty domain.
|
SmallDenseDomain(int min,
int max)
It creates a domain with values between min and max inclusive.
|
SmallDenseDomain(int min,
long bits)
It creates a domain of type small dense.
|
Modifier and Type | Method and Description |
---|---|
void |
addDom(IntDomain domain)
It adds values as specified by the parameter to the domain.
|
String |
checkInvariants()
It checks if the domain has correct state.
|
void |
clear()
It removes all elements.
|
Domain |
clone()
It clones the domain object.
|
SmallDenseDomain |
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 specifies if the other int domain is equal to this one.
|
int |
getElementAt(int index)
It access the element at the specified position.
|
Interval |
getInterval(int position)
It returns required interval.
|
int |
getRandomValue()
It returns a random value from the domain.
|
int |
getSize()
It returns the size of the domain.
|
int |
getSize(long input)
It computes the number of 1's in the binary representation of the number given in the field input.
|
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 |
in(int storeLevel,
Var var,
long domain) |
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 minComplement,
int maxComplement)
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 intersects current domain with the one given as a parameter.
|
SmallDenseDomain |
intersect(IntervalDomain input,
int shift) |
IntDomain |
intersect(int min,
int max)
In intersects current domain with the interval 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.
|
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.
|
int |
nextValue(int value)
It gives next value in the domain from the given one (lexigraphical
ordering).
|
int |
noIntervals()
It returns number of intervals required to represent this domain.
|
IntDomain |
previousDomain()
It returns domain at earlier level at which the change has occurred.
|
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.
|
IntDomain |
recentDomainPruning(int storeLevel)
It returns the values which have been removed at current store level.
|
void |
removeLevel(int level,
Var var)
It removes the specified 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,
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.
|
void |
setDomain(IntDomain domain)
It sets the domain to the specified domain.
|
void |
setDomain(int min,
int max)
It sets this domain to contain exactly all values between min and max.
|
void |
shift(int shift)
It shifts the domain.
|
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.
|
IntDomain |
subtract(int min,
int max)
It subtracts interval min..max.
|
void |
subtractAdapt(int value)
It removes value from the domain.
|
void |
subtractAdapt(int min,
int max)
It removes all values between min and max to the domain.
|
IntervalDomain |
toIntervalDomain() |
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 about 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.
|
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.
|
divBounds, divIntBounds, elementsSmallerThan, getEventsInclusion, in, inValue, lex, mulBounds, multiply, noConstraints, singleton, toIntArray, unionAdapt, value
constraints, noSearchConstraints, searchConstraints, setStamp, sizeConstraints, stamp
public static final SmallDenseDomain emptyDomain
public int min
public long bits
public IntDomain previousDomain
public SmallDenseDomain()
public SmallDenseDomain(int min, long bits)
min
- the minimum value present in this domain.bits
- the bits representing presence of any value from the range [ min .. min + 63].public SmallDenseDomain(int min, int max)
min
- max
- public void addDom(IntDomain domain)
IntDomain
public IntDomain complement()
IntDomain
complement
in class IntDomain
public IntDomain previousDomain()
IntDomain
previousDomain
in class IntDomain
public boolean contains(IntDomain domain)
IntDomain
public boolean contains(int value)
IntDomain
public boolean eq(IntDomain domain)
IntDomain
public int getElementAt(int index)
IntDomain
getElementAt
in class IntDomain
index
- the position of the element, indexing starts from 0.public Interval getInterval(int position)
IntDomain
getInterval
in class IntDomain
position
- the position of the interval.public int getSize()
IntDomain
public int getSize(long input)
input
- the 64bits for which calculation of number of 1's takes place.public void in(int storeLevel, Var var, int min, int max)
public void in(int storeLevel, Var var, long domain)
public void in(int storeLevel, Var var, IntDomain domain)
IntDomain
public void inComplement(int storeLevel, Var var, int complement)
IntDomain
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 minComplement, int maxComplement)
IntDomain
inComplement
in class IntDomain
storeLevel
- level of the store at which the update occurs.var
- variable for which this domain is used.minComplement
- the left bound of the interval (inclusive).maxComplement
- the right bound of the interval (inclusive).public void inMax(int storeLevel, Var var, int max)
IntDomain
public void inMin(int storeLevel, Var var, int min)
IntDomain
public void inShift(int storeLevel, Var var, IntDomain domain, int shift)
IntDomain
public SmallDenseDomain intersect(IntervalDomain input, int shift)
public IntDomain intersect(IntDomain domain)
IntDomain
public IntDomain intersect(int min, int max)
IntDomain
public int intersectAdapt(IntDomain domain)
IntDomain
intersectAdapt
in class IntDomain
domain
- domain with which the intersection is being computed.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 IntervalEnumeration intervalEnumeration()
IntDomain
intervalEnumeration
in class IntDomain
public boolean isIntersecting(IntDomain domain)
IntDomain
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 int leftElement(int intervalNo)
IntDomain
leftElement
in class IntDomain
intervalNo
- the interval number.public int max()
IntDomain
public int min()
IntDomain
public int nextValue(int value)
IntDomain
public int noIntervals()
IntDomain
noIntervals
in class IntDomain
public int previousValue(int value)
IntDomain
previousValue
in class IntDomain
value
- before which a value is seeked for.public IntDomain recentDomainPruning(int storeLevel)
IntDomain
recentDomainPruning
in class IntDomain
storeLevel
- the current store level.public int rightElement(int intervalNo)
IntDomain
rightElement
in class IntDomain
intervalNo
- the interval number.public void setDomain(IntDomain domain)
IntDomain
public void setDomain(int min, int max)
IntDomain
public boolean singleton(int c)
IntDomain
public int sizeOfIntersection(IntDomain domain)
IntDomain
sizeOfIntersection
in class IntDomain
domain
- the domain with which the intersection is computed.public IntDomain subtract(int value)
IntDomain
public IntDomain subtract(IntDomain domain)
IntDomain
public void subtractAdapt(int min, int max)
IntDomain
subtractAdapt
in class IntDomain
min
- the left bound of the interval being removed.max
- the right bound of the interval being removed.public IntDomain subtract(int min, int max)
IntDomain
public void subtractAdapt(int value)
IntDomain
subtractAdapt
in class IntDomain
value
- the value for which the complement is computedpublic IntDomain union(IntDomain domain)
IntDomain
public IntDomain union(int min, int max)
IntDomain
public IntDomain union(int value)
IntDomain
public void unionAdapt(Interval i)
IntDomain
unionAdapt
in class IntDomain
i
- Interval which needs to be added to the domain.public void unionAdapt(int min, int max)
IntDomain
unionAdapt
in class IntDomain
min
- the left bound of the interval being added.max
- the right bound of the interval being added.public void unionAdapt(int value)
IntDomain
unionAdapt
in class IntDomain
value
- value being added to the domain.public ValueEnumeration valueEnumeration()
IntDomain
valueEnumeration
in class IntDomain
public String checkInvariants()
Domain
checkInvariants
in class Domain
public void clear()
Domain
public int domainID()
Domain
public boolean isEmpty()
Domain
public boolean isNumeric()
Domain
public boolean isSparseRepresentation()
Domain
isSparseRepresentation
in class Domain
public SmallDenseDomain cloneLight()
cloneLight
in class IntDomain
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 putSearchConstraint(int storeLevel, Var var, Constraint C)
Domain
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 removeLevel(int level, Var var)
Domain
removeLevel
in class Domain
level
- the level which is being removed.var
- the variable to which this domain belonged to.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 removeSearchConstraint(int storeLevel, Var var, int position, Constraint C)
Domain
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 boolean singleton()
Domain
public int sizeConstraintsOriginal()
Domain
sizeConstraintsOriginal
in class Domain
public String toString()
Domain
public String toStringConstraints()
Domain
toStringConstraints
in class Domain
public String toStringFull()
Domain
toStringFull
in class Domain
public int getRandomValue()
IntDomain
getRandomValue
in class IntDomain
public boolean contains(int min, int max)
IntDomain
public void shift(int shift)
shift
- how much should the domain be shifted.public IntervalDomain toIntervalDomain()
Copyright © 2015. All rights reserved.