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

GMP::Row::SetRightHandSide

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

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

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.

value

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

Return Value

The procedure returns 1 on success, and 0 otherwise.

Note

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

Then if we run the following code

GMP::Row::SetRightHandSide( 'MP', c1, 20 [ton] );
rhs1 := GMP::Row::GetRightHandSide( 'MP', c1 );
display rhs1;

GMP::Row::SetRightHandSide( 'MP', c1, 30 );
rhs2 := GMP::Row::GetRightHandSide( 'MP', c1 );
display rhs2;

GMP::Row::SetRightHandSide( 'MP', c1, 40 * GMP::Row::GetScale( 'MP', c1 ) );
rhs3 := GMP::Row::GetRightHandSide( 'MP', c1 );
display rhs3;

(where ‘rhs1’, ‘rhs2’ and ‘rhs3’ are parameters without a unit) we get the following results:

rhs1 := 20 ;

rhs2 := 0.030 ;

rhs3 := 40 ;