Procedure GMP::Column::SetUpperBound(GMP, column, value)

GMP::Column::SetUpperBound

The procedure GMP::Column::SetUpperBound changes the upper bound of a column in the generated mathematical program.

GMP::Column::SetUpperBound(
     GMP,            ! (input) a generated mathematical program
     column,         ! (input) a scalar reference or column number
     value           ! (input) a numerical expression
     )

Arguments

GMP

An element in AllGeneratedMathematicalPrograms.

column

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

value

The new value assigned to the upper bound of the column.

Return Value

The procedure returns 1 on success, and 0 otherwise.

Note

Example

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

Quantity SI_Mass {
    BaseUnit      :  kg;
    Conversions   :  ton -> kg : # -> # * 1000;
}
Parameter max_wght {
    Unit          :  ton;
    InitialValue  :  20;
}
Variable x1 {
    Range         :  [0, max_wght];
    Unit          :  ton;
}

Then if we run the following code

GMP::Column::SetUpperBound( 'MP', x1, 20 [ton] );
ub1 := GMP::Column::GetUpperBound( 'MP', x1 );
display ub1;

GMP::Column::SetUpperBound( 'MP', x1, 30 );
ub2 := GMP::Column::GetUpperBound( 'MP', x1 );
display ub2;

GMP::Column::SetUpperBound( 'MP', x1, 40 * GMP::Column::GetScale( 'MP', x1 ) );
ub3 := GMP::Column::GetUpperBound( 'MP', x1 );
display ub3;

(where ‘ub1’, ‘ub2’ and ‘ub3’ are parameters without a unit) we get the following results:

ub1 := 20 ;

ub2 := 0.030 ;

ub3 := 40 ;