Function DomainIndex(identifierName, indexPosition)

DomainIndex

The function DomainIndex returns the indexPosition-th index of identifierName as an element in AllIdentifiers.

DomainIndex(
     identifierName,       ! (input) scalar element parameter
     indexPosition
     )        ! (input) scalar integer parameter

Arguments

identifierName

An element expression in the predefined set AllIdentifiers specifying the identifier for which an index should be obtained.

indexPosition

An expression in the range \(\{1..dim\}\) where \(dim\) is the dimension of identifierName.

Return Value

This function returns an element in the set AllIdentifiers representing the indexPosition index of identifierName. If identifierName is not an indexed parameter, variable or constraint, or if indexPosition is outside the range \(\{1..dim\}\), the empty element is returned without further warning.

Example

The following code uses the function DomainIndex to obtain the indices of the index domain of a parameter:

put outf ;
for ( IndexParameters | IdentifierDimension( IndexParameters ) > 0 ) do
   put IndexParameters:0, "(" ;
   while loopcount <= IdentifierDimension( IndexParameters ) do
       put DomainIndex( IndexParameters, loopcount ):0 ;
       if loopCount < IdentifierDimension( IndexParameters ) then put "," ; endif ;
   endwhile ;
   put ")", /  ;
endfor ;
putclose ;

A fragment of the output of this code might look as follows:

LowFP(f,p)
UppFP(f,p)
Supply(c)
Demand(f)

See also

The functions IdentifierDimension, DeclaredSubset and IndexRange.