set_rh

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

unsigned char set_rh(lprec *lp, int row, REAL value);

Return Value

set_rh returns TRUE (1) if the operation was successful. A return value of FALSE (0) indicates an error.

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 set. Must be between 0 and number of rows in the lp.

value

The value of the RHS.

Remarks

The set_rh function sets 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 an initial value for the objective value is set. Functions set_rh_vec, str_set_rh_vec ignore row 0 (for historical reasons) in the specified RHS vector, but it is possible to first call one of these functions and then set the value of the objective with set_rh.

Example

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

int main(void)
{
  lprec *lp;

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

  set_rh(lp, 1, 1.0); /* sets the value 1.0 for RHS row 1 */

  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_vec, str_set_rh_vec, get_rh, add_constraint, add_constraintex, str_add_constraint, get_row, get_rowex, get_mat