Function GMP::Row::GetRightHandSide(GMP, row)

GMP::Row::GetRightHandSide

The function GMP::Row::GetRightHandSide returns the right-hand-side value of a row as present in the generated mathematical program.

GMP::Row::GetRightHandSide(
     GMP,            ! (input) a generated mathematical program
     row             ! (input) a scalar reference or row number
     )

Arguments

GMP

An element in AllGeneratedMathematicalPrograms.

row

A scalar reference to an existing row in the matrix or an element in the set Integers in the range \(\{ 0 .. m-1 \}\) where \(m\) is the number of rows in the matrix.

Return Value

The function returns the right-hand-side value of the specified row.

Note

If the row has a unit then the scaled right-hand-side value is returned (without unit).

Example

Assume that ‘c1’ is a constraint in mathematical program ‘MP’ with a unit as defined by:

Quantity SI_Mass {
    BaseUnit      :  kg;
    Conversions   :  ton -> kg : # -> # * 1000;
}
Parameter wght {
    Unit          :  ton;
    InitialValue  :  20;
}
Constraint c1 {
    Unit          :  ton;
    Definition    :  -x1 + 2 * x2 <= wght;
}

If we want to multiply the right-hand-side value by 1.5 and assign it as the new value by using function GMP::Row::SetRightHandSide we can use

rhs1 := 1.5 * (GMP::Row::GetRightHandSide( 'MP', c1 )) [ton];

GMP::Row::SetRightHandSide( 'MP', c1, rhs1 );

if ‘rhs1’ is a parameter with unit [ton], or we can use

rhs2 := 1.5 * GMP::Row::GetRightHandSide( 'MP', c1 );

GMP::Row::SetRightHandSide( 'MP', c1, rhs2 * GMP::Row::GetScale( 'MP', c1 ) );

if ‘rhs2’ is a parameter without a unit.