Skip to main content
FRAMES NO FRAMES

Class IloExtractableArray

Definition file: ilconcert/iloextractable.h
Map of IloExtractableArrayIloExtractableArrayIloConstraintArrayIloIntExprArrayIloNumExprArrayIloExtractableArray
An array of extractable objects.

An instance of this class is an array of extractable objects (instances of the class IloExtractable or its subclasses).

Instances of IloExtractableArray are extensible. That is, you can add more elements to such an array. References to an array change whenever an element is added to or removed from the array.

Most member functions in this class contain assert statements. For an explanation of the macro NDEBUG (a way to turn on or turn off these assert statements), see the concept Assert and NDEBUG.

IloExtractableArray inherits additional methods from the template IloArray:

For information on arrays, see the concept Arrays

See Also:

Method Summary
public voidadd(IloInt more, const IloExtractable x)
public voidadd(const IloExtractable x)
public voidadd(const IloExtractableArray x)
public voidendElements()
public IloExtractableArray(IloDefaultArrayI * i=0)
public IloExtractableArray(const IloExtractableArray & r)
public IloExtractableArray(const IloEnv env, IloInt n=0)
public voidremoveFromAll()
public voidsetNames(const char * name)
Method Detail

IloExtractableArray

public IloExtractableArray(IloDefaultArrayI * i=0)

This constructor creates an empty array of elements. You cannot create instances of the undocumented class IloDefaultArrayI. As an argument in this default constructor, it allows you to pass 0 (zero) as a value to an optional argument in functions and member functions that accept an array as an argument.


IloExtractableArray

public IloExtractableArray(const IloExtractableArray & r)

This copy constructor creates a handle to the array of extractable objects specified by r.


IloExtractableArray

public IloExtractableArray(const IloEnv env, IloInt n=0)

This constructor creates an array of n elements, each of which is an empty handle.


add

public void add(IloInt more, const IloExtractable x)

This member function appends x to the invoking array multiple times. The argument more specifies how many times.


add

public void add(const IloExtractable x)

This member function appends x to the invoking array.


add

public void add(const IloExtractableArray x)

This member function appends the elements in the arrayx to the invoking array.


endElements

public void endElements()

This member function calls IloExtractable::end for each of the elements in the invoking array. This deletes all the extractables identified by the array. It also calls IloArray::clear. The array must not contain any duplicates since that will result in double deletions. This member function is the recommended way to delete the elements of an array.


removeFromAll

public void removeFromAll()

This member function removes the invoking array of extractable objects from all other extractable objects where they are used. However, unlike the member function end, the member function removeFromAll does not destroy the invoking objects. That is, the invoking extractable objects remain available for later re-use in the model.


setNames

public void setNames(const char * name)

This member function sets the name of each element of the invoking array. Each name is created by suffixing name with (n), where n is the index of the extractable in the array.

For example, if the array contains the three extractables x, y, and z, and the name specified is var, x is then named var(0), y is then named var(1), and z is named var(2).

All elements must be different. Otherwise, this method raises an error.

Note

It is more efficient to set the names of all elements at once as an array, rather than in a loop setting each name one by one. Set the name of an extractable object before the extraction of that object.