Function GMP::Instance::GetRowNumbers(GMP, constraintSet)

GMP::Instance::GetRowNumbers

The function GMP::Instance::GetRowNumbers returns a subset of the row numbers of a generated mathematical program. It returns the row numbers that are generated for a set of constraints.

GMP::Instance::GetRowNumbers(
     GMP,                  ! (input) a generated mathematical program
     constraintSet        ! (input) a set of constraints
     )

Arguments

GMP

An element in the set AllGeneratedMathematicalPrograms.

constraintSet

A subset of the set AllConstraints.

Return Value

The function returns a subset of the row numbers as a subset of the set Integers.

Example

Assume we have generated a mathematical program and we want to change the right hand side of the constraints c1(i) and c2(j,k) into 100. This can be done as follows:

myGMP := GMP::Instance::Generated( MP );

for (i) do
    GMP::Row::SetUpperBound( myGMP, c1(i), 100 );
endfor;

for (j,k) do
    GMP::Row::SetRightHandSide( myGMP, c2(j,k), 100 );
endfor;

Using the function GMP::Instance::GetRowNumbers this can also be coded as follows. Here RowNrs is a subset of Integers with index r, and Cons a subset of AllConstraints.

myGMP := GMP::Instance::Generated( MP );

Cons := { 'c1', 'c2' };

RowNrs := GMP::Instance::GetRowNumbers( myGMP, Cons );

for (r) do
    GMP::Row::SetRightHandSide( myGMP, r, 100 );
endfor;