get_rh

Gets the value of the right hand side (RHS) vector (column 0) for one row.

REAL get_rh(lprec *lp, int row);

Return Value

get_rh returns the value of the RHS for the specified row. If row is out of range it returns 0. If no previous value was set, then it also returns 0, the default RHS value.

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI

row

The row for which the RHS value must be retrieved. Must be between 0 and number of rows in the lp.

value

The value of the RHS.

Remarks

The get_rh function returns the value of the RHS vector (column 0) for the specified row.
Note that row can also be 0 with this function. In that case it returns the initial value of the objective function.

Example

#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"

int main(void)
{
  lprec *lp;
  REAL a;

  /* Create a new LP model */
  lp = make_lp(2, 0);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  a = get_rh(lp, 1); /* will return 0 since no value was previously set */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, set_rh, set_rh_vec, str_set_rh_vec, add_constraint, add_constraintex, str_add_constraint, get_column, get_columnex, add_column, add_columnex, str_add_column, set_column, set_columnex, get_row, get_rowex, get_mat