Procedure GMP::Row::SetLeftHandSide(GMP, row, value)


The procedure GMP::Row::SetLeftHandSide changes the left-hand-side of a row in a generated mathematical program.

     GMP,            ! (input) a generated mathematical program
     row,            ! (input) a scalar reference or row number
     value           ! (input) a numerical expression



An element in AllGeneratedMathematicalPrograms.


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.


The new value that should be assigned to the left-hand-side of the row.

Return Value

The procedure returns 1 on success, and 0 otherwise.


If the row has a unit then value should have the same unit. If value has no unit then you should multiply it by the row scale, as returned by the function GMP::Row::GetScale.


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;
Constraint c1 {
    Unit         :  ton;
    Definition   :  -x1 + 2 * x2 <= wght;

Then if we run the following code

GMP::Row::SetLeftHandSide( 'MP', c1, 20 [ton] );
lhs1 := GMP::Row::GetLeftHandSide( 'MP', c1 );
display lhs1;

GMP::Row::SetLeftHandSide( 'MP', c1, 30 );
lhs2 := GMP::Row::GetLeftHandSide( 'MP', c1 );
display lhs2;

GMP::Row::SetLeftHandSide( 'MP', c1, 40 * GMP::Row::GetScale( 'MP', c1 ) );
lhs3 := GMP::Row::GetLeftHandSide( 'MP', c1 );
display lhs3;

(where ‘lhs1’, ‘lhs2’ and ‘lhs3’ are parameters without a unit) we get the following results:

lhs1 := 20 ;

lhs2 := 0.030 ;

lhs3 := 40 ;