Package org.jacop.set.core
Class BoundSetDomain
java.lang.Object
org.jacop.core.Domain
org.jacop.set.core.SetDomain
org.jacop.set.core.BoundSetDomain
- All Implemented Interfaces:
Cloneable
Defines a set interval determined by a least upper bound(lub) and a
greatest lower bound(glb). The domain consist of zero, one or several sets.
- Version:
- 4.10
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe cardinality of the set.The greatest lower bound of the domain.The least upper bound of the domain.Fields inherited from class org.jacop.set.core.SetDomain
ANY, BOUND, CARDINALITY, emptyDomain, eventsInclusion, GLB, GROUND, LUB, MaxElement, MinElement, previousDomain, SetDomainIDFields inherited from class org.jacop.core.Domain
failException, modelConstraints, modelConstraintsToEvaluate, NOINFO, NONE, searchConstraints, searchConstraintsCloned, searchConstraintsToEvaluate, stamp -
Constructor Summary
ConstructorsConstructorDescriptionIt is a constructor which will create an empty SetDomain.BoundSetDomain(int e1, int e2) It creates a new instance of SetDomain with glb empty and lub={e1..e2}BoundSetDomain(IntDomain glb, IntDomain lub) Creates a new instance of SetDomain.BoundSetDomain(IntDomain glb, IntDomain lub, IntDomain cardinality) Creates BoundSetDomain object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDom(int min, int max) Adds an interval [min..max] to the domain.voidAdds a set of value to the possible values used within this set domain.voidAdds an interval to the lub.voidAdds a set to the domain.card()Returns the cardinality of the setDomain as [glb.card(), lub.card()]It checks if the domain has correct state.voidclear()Sets the domain to an empty SetDomain.clone()Clones the domain.It clones the domain object, only data responsible for encoding domain values is cloned.It creates a complement of a domain.booleancontains(int value) It checks if value belongs to the domain.booleanIt checks if the supplied set or setDomain is a subset of this domain.booleanIt checks if the supplied set domain is a subset of this domain.intdomainID()It returns an unique identifier of the domain.booleanIt checks if the domain is equal to the supplied domain.intgetSize()Returns the number of elements in the domain.glb()It returns the greatest lower bound of the domain.voidThis function is equivalent to in(int storeLevel, Variable var, int min, int max).voidIt updates the domain to have values only within the domain.voidinCardinality(int level, SetVar var, int min, int max) It restricts the possible cardinality of the set domain.voidIt adds if necessary an element to glb.voidIt specifies what elements must be in GLB.voidIt specifies what elements can be in LUB.voidinLUBComplement(int level, SetVar var, int element) It removes if necessary an element from lub.It intersects current domain with the one given as a parameter.It intersects current domain with the one given as a parameter.voidIt assigns a set variable to the specified value.voidinValueGLB(int level, SetVar var) It assigns a set variable to glb of its current domain.voidinValueLUB(int level, SetVar var) It assigns a set variable to lub of its current domain.booleanisEmpty()It returns true if given domain is empty.booleanisIntersecting(int min, int max) In intersects current domain with the interval min..max.booleanisIntersecting(SetDomain domain) It returns true if given domain intersects this domain.booleanA set is never numericbooleanA set is not sparselub()It returns the least upper bound of the domain.voidsetDomain(int min, int max) It sets the domain to the the set {min..max}.voidIt sets the domain to the specified domain.booleanIt returns true if given domain has only one set-element.booleanIt returns true if given domain has only one element.booleanIt returns true if given domain has only one set-element and this set-element only contains c.subtract(int value) It subtracts the set {value}.subtract(int min, int max) It subtracts the elements of the set {min..max}.It subtracts domain from current domain and returns the result.toString()It returns string description of the domain.union(int value) It computes union of this domain and value.union(int min, int max) It computes union of this domain and the interval.It computes union of the supplied domain with this domain.It returns value enumeration of the domain values.Methods inherited from class org.jacop.set.core.SetDomain
getEventsInclusion, in, noConstraints, putModelConstraint, putSearchConstraint, recentDomainPruning, removeLevel, removeModelConstraint, removeSearchConstraint, sizeConstraintsOriginal, toStringConstraints, toStringFullMethods inherited from class org.jacop.core.Domain
constraints, noSearchConstraints, searchConstraints, setStamp, sizeConstraints, stamp
-
Field Details
-
glb
The greatest lower bound of the domain. -
lub
The least upper bound of the domain. -
cardinality
The cardinality of the set.
-
-
Constructor Details
-
BoundSetDomain
Creates BoundSetDomain object. It requires glb to be a subset of lub.- Parameters:
glb- it specifies the left bound of the SetDomain (inclusive).lub- it specifies the right bound of the setDomain (inclusive).cardinality- it specifies the allowed cardinality of the assigned set.
-
BoundSetDomain
Creates a new instance of SetDomain. It requires glb to be a subset of lub.- Parameters:
glb- it specifies the left bound of the SetDomain (inclusive).lub- it specifies the right bound of the setDomain (inclusive).
-
BoundSetDomain
public BoundSetDomain()It is a constructor which will create an empty SetDomain. An empty SetDomain has a glb and a lub that is empty. -
BoundSetDomain
public BoundSetDomain(int e1, int e2) It creates a new instance of SetDomain with glb empty and lub={e1..e2}- Parameters:
e1- the minimum element of lub.e2- the maximum element of lub.
-
-
Method Details
-
addDom
Adds a set of value to the possible values used within this set domain. It changes the cardinality too to avoid cardinality constraining the domain. -
addDom
Adds a set to the domain. -
addDom
public void addDom(int min, int max) Adds an interval [min..max] to the domain. -
card
Returns the cardinality of the setDomain as [glb.card(), lub.card()] -
clear
public void clear()Sets the domain to an empty SetDomain. -
clone
Clones the domain. -
cloneLight
It clones the domain object, only data responsible for encoding domain values is cloned. All other fields must be set separately.- Specified by:
cloneLightin classSetDomain- Returns:
- return a clone of the domain. It aims at getting domain of the proper class type.
-
complement
It creates a complement of a domain.- Returns:
- it returns the complement of this domain.
-
contains
It checks if the supplied set or setDomain is a subset of this domain. -
contains
Description copied from class:SetDomainIt checks if the supplied set domain is a subset of this domain. -
contains
public boolean contains(int value) It checks if value belongs to the domain. -
domainID
public int domainID()It returns an unique identifier of the domain. -
eq
It checks if the domain is equal to the supplied domain. -
getSize
public int getSize()Returns the number of elements in the domain. -
glb
It returns the greatest lower bound of the domain. -
in
This function is equivalent to in(int storeLevel, Variable var, int min, int max). -
in
It updates the domain to have values only within the domain. The type of update is decided by the value of stamp. It informs the variable of a change if it occurred. -
intersect
It intersects current domain with the one given as a parameter. -
intersect
It intersects current domain with the one given as a parameter. -
isEmpty
public boolean isEmpty()It returns true if given domain is empty. -
isIntersecting
It returns true if given domain intersects this domain.- Specified by:
isIntersectingin classSetDomain- Parameters:
domain- the domain against which the intersection is being checked.- Returns:
- true if the given domain intersects this domain.
-
isIntersecting
public boolean isIntersecting(int min, int max) In intersects current domain with the interval min..max.- Specified by:
isIntersectingin classSetDomain- Parameters:
min- the left bound of the interval (inclusive)max- the right bound of the interval (inclusive)- Returns:
- the intersection between the specified interval and this domain.
-
isNumeric
public boolean isNumeric()A set is never numeric -
isSparseRepresentation
public boolean isSparseRepresentation()A set is not sparse- Specified by:
isSparseRepresentationin classSetDomain- Returns:
- false
-
lub
It returns the least upper bound of the domain. -
setDomain
It sets the domain to the specified domain. -
setDomain
public void setDomain(int min, int max) It sets the domain to the the set {min..max}. It grounds it. FIXME should it be grounded? -
singleton
public boolean singleton()It returns true if given domain has only one set-element. -
singleton
It returns true if given domain has only one set-element and this set-element only contains c. -
subtract
It subtracts domain from current domain and returns the result. -
subtract
It subtracts the elements of the set {min..max}. -
subtract
It subtracts the set {value}. FIXME, it does not subtract set {value}, it subtracts value from the set domain. -
toString
It returns string description of the domain. -
union
It computes union of the supplied domain with this domain. -
union
It computes union of this domain and the interval. -
union
It computes union of this domain and value. -
valueEnumeration
It returns value enumeration of the domain values.- Specified by:
valueEnumerationin classSetDomain- Returns:
- valueEnumeration which can be used to enumerate the sets of this domain one by one.
-
checkInvariants
Description copied from class:DomainIt checks if the domain has correct state.- Specified by:
checkInvariantsin classSetDomain- Returns:
- It returns the information about the first invariant which does not hold or null otherwise.
-
inGLB
It adds if necessary an element to glb. -
inLUBComplement
It removes if necessary an element from lub.- Specified by:
inLUBComplementin classSetDomain- Parameters:
level- level at which the change is recorded.var- set variable to which the change applies to.element- the element which can not be in lub.
-
inValue
Description copied from class:SetDomainIt assigns a set variable to the specified value. -
singleton
Description copied from class:DomainIt returns true if given domain has only one element. -
inLUB
Description copied from class:SetDomainIt specifies what elements can be in LUB. It will not add any new elements only removed the elements currently in LUB but not permitted by the argument domain. -
inValueLUB
It assigns a set variable to lub of its current domain.- Parameters:
level- level of the store at which the change takes place.var- variable for which the domain is changing.
-
inGLB
Description copied from class:SetDomainIt specifies what elements must be in GLB. It will add new elements if they are not already in GLB. -
inValueGLB
It assigns a set variable to glb of its current domain.- Parameters:
level- level of the store at which the change takes place.var- variable for which the domain is changing.
-
addDom
Description copied from class:SetDomainAdds an interval to the lub. -
inCardinality
Description copied from class:SetDomainIt restricts the possible cardinality of the set domain.- Specified by:
inCardinalityin classSetDomain- Parameters:
level- level of the store at which the restriction takes place.var- the variable which domain is being restricted.min- the minimal allowed cardinalitymax- the maximal allowed cardinality
-