Skip to main content
FRAMES NO FRAMES

Class IlcIntTupleSet

Definition file: ilcp/cpext.h
Include file: <ilcp/cpext.h>
Map of IlcIntTupleSetIlcIntTupleSetIlcIntTupleSet
The class representing a set of integer tuples.

An integer tuple is an ordered set of integer values. A set of integer tuples is represented by an instance of IlcIntTupleSet. That is, the elements of an integer tuple set are integer tuples. The number of values in a tuple is known as the arity of the tuple, and the arity of the tuples in a set is called the arity of the set. (In contrast, the number of tuples in the set is known as the cardinality of the set.)

As a handle class, IlcIntTupleSet manages certain set operations efficiently. In particular, elements can be added to such a set. It is also possible to search a given set with the member function IlcIntTupleSet::isIn to see whether or not the set contains a given element.

In addition, a set of integer tuples can represent a constraint defined on a constrained integer variable, either as the set of allowed combinations of values of the constrained variable on which the constraint is defined, or as the set of forbidden combinations of values.

There are a few conventions governing integer tuple sets:

CP Optimizer will throw an exception (an instance of IloException) if you attempt:

You do not have to worry about memory allocation. If you respect these conventions, CP Optimizer manages allocation and de-allocation transparently for you.

See Also:

Method Summary
public voidadd(IlcIntArray tuple) const
public voidclose() const
public IlcIntTupleSet(IlcCPEngine solver, IlcInt arity)
public IlcBoolisClosed() const
public IlcBoolisIn(IlcIntArray tuple) const
Method Detail

IlcIntTupleSet

public IlcIntTupleSet(IlcCPEngine solver, IlcInt arity)

This constructor creates a set of integer tuples (an instance of the class IlcIntTupleSet) with the arity indicated by arity.


add

public void add(IlcIntArray tuple) const

This member function adds an integer tuple represented by the array tuple to the invoking set. If you attempt to add an element that is already in the set, that element will not be added again; in other words, CP Optimizer respects the definition of a set as containing exclusive elements with no duplicates. Added elements are not copied; that is, there is no memory duplication. CP Optimizer will throw an exception (an instance of IloException) if the set has already been closed. CP Optimizer will throw an exception (an instance of IloException) if the size of the array is not equal to the arity of the invoking set.


close

public void close() const

This member function closes the invoking set. That is, it states that all the tuples in the set are known so efficient data structures can be defined and exploited.


isClosed

public IlcBool isClosed() const

This member function returns IlcTrue if the invoking set has been closed. Otherwise, it returns IlcFalse.


isIn

public IlcBool isIn(IlcIntArray tuple) const

This member function returns IlcTrue if tuple belongs to the invoking set. Otherwise, it returns IlcFalse. CP Optimizer will throw an exception (an instance of IloException) if the set has not yet been closed. CP Optimizer will throw an exception (an instance of IloException) if the size of the array is not equal to the arity of the invoking set.