get_upbo

Gets the upper bound of a variable.

REAL get_upbo(lprec *lp, int column);

Return Value

get_upbo returns the upper bound on the specified variable. If no bound was set, it returns a very big number, the value of get_infinite, the default upper bound.

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

column

The column number of the variable. It must be between 1 and the number of columns in the lp.

Remarks

The get_upbo function returns the upper bound on the variable identified by column.
Setting a bound on a variable is the way to go instead of adding an extra constraint (row) to the model. Setting a bound doesn't increase the model size that means that the model stays smaller and will be solved faster.
The default upper bound of a variable is infinity (well not quite. It is 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(0, 2);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  a = get_upbo(lp, 1); /* will return 1e30 since no upper bound was 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_upbo, set_lowbo, get_lowbo, set_bounds, set_unbounded, is_unbounded, is_negative