1.8 The class OZ_FSetConstraint

An OZ_FSetConstraint defines (among other things) a set of values that are definitely in (the greatest lower bound), a set of values that are definitely out of any set satisfying the Constraint; and a set of values who may or may not be in. These sets will be referred to as IN, OUT, and UNKNOWN sets in the descriptions below.

1.8.1 Constructor Member Functions

OZ_FSetConstraint

OZ_FSetConstraint(void);

Creates an uninitialised OZ_FSetConstraint entity.

OZ_FSetConstraint

OZ_FSetConstraint(const OZ_FSetValue &fs);

Creates a constraint where the IN set is fs.

OZ_FSetConstraint

OZ_FSetConstraint(OZ_FSetState state);

Creates a Finite Set Constraint with IN set of state state, and OUT its complement.

value of state

constraint

fs_empty

the empty set matches

fs_full

the set \{0, \ldots, OZ\_getFSetSup()\} matches.

OZ_FSetConstraint

OZ_FSetConstraint(const OZ_FSetConstraint &fsc);

Copy-constructs a Finite Set Constraint from fsc.

1.8.2 Initialization Member Functions

init

void init(void);

Initializes an empty constraint.

init

void init(const OZ_FSetValue &fs);

Initializes a constraint that is only matched by fs.

init

void init(OZ_FSetState);

Initializes a Finite Set Constraint with IN set of state state, and OUT its complement.

value of state

constraint

fs_empty

the empty set matches

fs_full

the set \{0, \ldots, OZ\_getFSetSup()\} matches.

1.8.3 Reflection Member Functions

These all access members of *this.

getKnownIn

int getKnownIn(voidconst;

Returns the cardinality of IN.

getKnownNotIn

int getKnownNotIn(voidconst;

Returns the cardinality of OUT.

getUnknown

int getUnknown(voidconst;

Returns the cardinality of UNKNOWN.

getGlbSet

OZ_FSetValue getGlbSet(voidconst;

Returns IN.

getLubSet

OZ_FSetValue getLubSet(voidconst;

Returns the set of values that may be in sets satisfying the constraint.

getUnknownSet

OZ_FSetValue getUnknownSet(voidconst;

Returns UNKNOWN.

getNotInSet

OZ_FSetValue getNotInSet(voidconst;

Returns OUT.

getGlbCard

int getGlbCard(voidconst;

Returns the cardinality of IN.

getLubCard

int getLubCard(voidconst;

Returns the cardinality of the set of all values that are in some a set satisfying the constraint.

getNotInCard

int getNotInCard(voidconst;

Returns the cardinality of OUT.

getUnknownCard

int getUnknownCard(voidconst;

Returns the cardinality of UNKNOWN.

iterators

int getGlbMinElem(voidconst;
int getLubMinElem(voidconst;
int getNotInMinElem(voidconst;
int getUnknownMinElem(voidconst;
int getGlbMaxElem(voidconst;
int getLubMaxElem(voidconst;
int getNotInMaxElem(voidconst;
int getUnknownMaxElem(voidconst;
int getGlbNextSmallerElem(intconst;
int getLubNextSmallerElem(intconst;
int getNotInNextSmallerElem(intconst;
int getUnknownNextSmallerElem(intconst;
int getGlbNextLargerElem(intconst;
int getLubNextLargerElem(intconst;
int getNotInNextLargerElem(intconst;
int getUnknownNextLargerElem(intconst;

These functions allow to access and iterate over elements of several sets related to the constraint.

name

function

getMinElem

get the minimal element, -1 if empty

getMaxElem

get the maximal element, -1 if empty

getNextLargerElem(i)

get the next larger element above i, -1 if there is none

getNextSmallerElem(i)

get the next smaller element below i, -1 if there is none

name

referred set

glb

the set of values that are in all sets satisfying the constraint

lub

the set of all values that are in some sets satisfying the constraint

unknown

the set of values that are in some, but not all sets satisfying the constraint

notIn

the set of values that are in no sets satisfying the constraint

getCardMin

int getCardMin(voidconst

Returns the minimal allowed cardinality.

getCardMax

int getCardMax(voidconst;

Returns the maximal allowed cardinality (-1 means the constraint cannot be satisfied)

getCardSize

int getCardSize(voidconst;

Returns the size of the interval between the minimal and maximal allowed cardinality.

getKnownInList

OZ_Term getKnownInList(voidconst;

Returns IN as a list.

getKnownNotInList

OZ_Term getKnownNotInList(voidconst;

Returns OUT as a list.

getUnknownList

OZ_Term getUnknownList(voidconst;

Returns UNKNOWN as a list.

getLubList

OZ_Term getLubList(voidconst;

Returns the union of IN and UNKNOWN as a list.

getCardTuple

OZ_Term getCardTuple(voidconst;

Returns a tuple consisting of integers giving the minimum and maximum allowed cardinality.

1.8.4 Imposing Constraints

Where an operator member Function returns an OZ_Boolean, it is to indicate whether constraint becomes unsatisfiable in the operation.

operator =

OZ_FSetConstraint &operator = (const OZ_FSetConstraint &fsc);

fsc gets assigned to *this.

operator -

OZ_FSetConstraint operator - (voidconst;

The complementary constraint is returned.

operator +=

OZ_Boolean operator+=(int i);

i is added to *this.IN.

operator -=

OZ_Boolean operator-=(int i);

i is added to *this.OUT.

operator <<=

OZ_Boolean operator <<= (const OZ_FSetConstraint &fsc);

fsc is added to *this.

operator %

OZ_Boolean operator % (const OZ_FSetConstraint &fsc);

Returns OZ_True if all values known to be in *this are known not to be in fsc, and the other way round.

operator &

OZ_FSetConstraint operator & (const OZ_FSetConstraint &fscconst;

Returns the intersection of *this and fsc.

operator |

OZ_FSetConstraint operator | (const OZ_FSetConstraint &fscconst;

Returns the union of *this and fsc.

operator -

OZ_FSetConstraint operator - (const OZ_FSetConstraint &fscconst;

Returns the difference of *this and fsc.

operator <=

OZ_Boolean operator <= (const OZ_FSetConstraint &fsc);

Returns OZ_True if *this has as least the elements excluded (in OUT) that are excluded by fsc.

operator >=

OZ_Boolean operator >= (const OZ_FSetConstraint &);

Returns OZ_True if *this has as least the elements included (in IN) that are included by fsc.

operator !=

OZ_Boolean operator != (const OZ_FSetConstraint &fsc);

The elements known to be in fsc are excluded from *this

operator ==

OZ_Boolean operator == (const OZ_FSetConstraint &fsconst;

Returns OZ_True if *this is equivalent to fsc.

le

OZ_Boolean le(const int i);

All values above i are excluded from *this.

ge

OZ_Boolean ge(const int);

All values below i are excluded from *this.

1.8.5 Auxiliary Member Functions

putCard

OZ_Boolean putCard(int cardminint cardmax);

The minimum and maximum allowed cardinality is set.

isValue

OZ_Boolean isValue(voidconst;

Returns OZ_True if the constraint determines exactly one set.

isIn

OZ_Boolean isIn(int iconst;

Returns OZ_True if i is known to be in every(!) set satisfying the constraint.

isNotIn

OZ_Boolean isNotIn(int iconst;

Returns OZ_True if i is in no set satisfying the constraint.

isEmpty

OZ_Boolean isEmpty(voidconst;

Returns OZ_True if *this is satisfied only by the empty set.

isFull

OZ_Boolean isFull(voidconst;

Returns true if *this can only be satisfied by the set containing all possible values (i. e. , \{0, \ldots, OZ\_getFSetSup()\}).

isSubsumedBy

OZ_Boolean isSubsumedBy(const OZ_FSetConstraint &fscconst;

Returns true if *this is subsumed by fsc.

copyExtension

void copyExtension(void);

This member function replaces the current extension of the set constraint representation by a copy of it.

disposeExtension

void disposeExtension(void);

This member function frees the heap memory occupied by the extension of the set constraint.

toString

char * toString(voidconst;

Returns a textual representation of the finite set constraint pointing to a static array of chars.


Tobias Müller
Version 1.4.0 (20080702)