- Function GMP::Instance::GetColumnNumbers(GMP, variableSet)
GMP::Instance::GetColumnNumbers
The function GMP::Instance::GetColumnNumbers
returns a subset of the
column numbers of a generated mathematical program. It returns the
column numbers that are generated for a set of variables.
GMP::Instance::GetColumnNumbers(
GMP, ! (input) a generated mathematical program
variableSet ! (input) a set of variables
)
Arguments
- GMP
An element in the set
AllGeneratedMathematicalPrograms
.- variableSet
A subset of the set
AllVariables
.
Return Value
The function returns a subset of the column numbers as a subset of the set
Integers
.
Example
Assume we have generated a mathematical program and we want to change
the upper bound of the variables demand(i)
and supply(j,k)
into
100. This can be done as follows:
myGMP := GMP::Instance::Generated( MP );
for (i) do
GMP::Column::SetUpperBound( myGMP, demand(i), 100 );
endfor;
for (j,k) do
GMP::Column::SetUpperBound( myGMP, supply(j,k), 100 );
endfor;
Using the function
GMP::Instance::GetColumnNumbers
this can also be coded as follows.
Here ColNrs
is a subset of Integers
with index c
, and Vars
a subset of AllVariables
.
myGMP := GMP::Instance::Generated( MP );
Vars := { 'demand', 'supply' };
ColNrs := GMP::Instance::GetColumnNumbers( myGMP, Vars );
for (c) do
GMP::Column::SetUpperBound( myGMP, c, 100 );
endfor;