get_rh_range

Gets the range on a constraint.

REAL get_rh_range(lprec *lp, int row);

Return Value

get_rh_range returns the range set on the constraint specified by row.

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 number of the constraint from which the range must be retrieved. It must be between 1 and the number of rows in the lp.

Remarks

The get_rh_range function gets the range on the constraint (row) identified by row.
Setting a range on a row is the way to go instead of adding an extra constraint (row) to the model. Setting a range doesn't increase the model size that means that the model stays smaller and will be solved faster.
If the row has a less than constraint then the range means setting a minimum on the constraint that is equal to the RHS value minus the range. If the row has a greater than constraint then the range means setting a maximum on the constraint that is equal to the RHS value plus the range.
Note that the range value is the difference value and not the absolute value.
If no range was set then get_rh_range returns a very big number, the value of get_infinite.

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(1, 1);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  a = get_rh_range(lp, 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_range