- Function GMP::Instance::GetObjectiveRowNumber(GMP)
GMP::Instance::GetObjectiveRowNumber returns the row
number corresponding to the constraint or variable definition that
defines the objective of a generated mathematical program.
GMP::Instance::GetObjectiveRowNumber( GMP ! (input) a generated mathematical program )
An element in
The function returns the row number as an element of the set
Integers. If the generated mathematical program does not contain an objective then -1 is returned.
You should assign the return value of this function to an element parameter with range
Integersif you want to use it as (row) argument to call other GMP routines.
If the objective variable appears in more than one constraint (or variable definition) then the row number of the first of those constraints will be returned.
Assume that we want to change the coefficients of all integer variables in the objective to 10. This can be done as follows.RowNo := GMP::Instance::GetObjectiveRowNumber( myGMP ); ColNrs := GMP::Instance::GetColumnNumbers( myGMP, AllIntegerVariables ); for (c) do GMP::Coefficient::Set( myGMP, RowNo, c, 10 ); endfor;