get_constr_type

Gets the type of a constraint.

int get_constr_type(lprec *lp, int row);

Return Value

get_constr_type returns the type of the constraint on row row. Can by any of the following values:

LE (0) Less than or equal (<=)
EQ (1) Equal (=)
GE (2) Greater than or equal (>=)

If there is an error then the function returns -1.

Parameters

lp

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

row

The row for which the constraint type must be retrieved. Must be between 1 and number of rows in the lp.

Remarks

The get_constr_type function returns the constraint type for the specified row.
The default constraint type is LE.

Example

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

int main(void)
{
  lprec *lp;
  int constr;

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

  constr = get_constr_type(lp, 1); /* will be 0 (LE) */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS, set_constr_type, add_constraint, str_add_constraint, del_constraint