set_rh_range
Set the range on a constraint.
unsigned char set_rh_range(lprec *lp, int row, REAL deltavalue);
Return Value
set_rh_range 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 number of the constraint on which the range must be set.
It must be between 1 and the number of rows in the lp.
deltavalue
The range on the constraint.
Remarks
The set_rh_range function sets a 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.
Example
#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.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");
return(1);
}
set_rh_range(lp, 1, 1.0);
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, get_rh_range
