Set the lower range on a constraint.

int set_lowrange(lprec *lp, int row, REAL value);

Return Value

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



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


The row number of the constraint on which the range must be set. It must be between 1 and the number of rows in the lp.


The set_lowrange function sets a lower 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.
A lower range will be set if the constraint is a less than constraint. This lower range has the same effect as adding an extra row to the model with a greater than constraint and a RHS equal to the value of the RHS minus this range. However the range is more performant since no extra row must be created.
Note that the range must be the difference between the maximum that must be set and the minimum that is already set in the RHS.


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

int main(void)
  lprec *lp;

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

  set_lowrange(lp, 1, 1.0);


lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS, set_rh_range, get_rh_range, set_uprange