get_constraints, get_ptr_constraints

Returns the values of the constraints.

unsigned char get_constraints(lprec *lp, REAL *constr);

unsigned char get_ptr_constraints(lprec *lp, REAL **ptr_constr);

Return Value

get_constraints, get_ptr_constraints 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, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI

constr

An array that will contain the values of the constraints.

ptr_constr

The address of a pointer that will point to an array that will contain the values of the constraints.

Remarks

The get_constraints, get_ptr_constraints functions retrieve the values of the constraints.
These values are only valid after a successful solve or lag_solve. Function get_constraints needs an array that is already dimensioned with get_Nrows elements. get_ptr_constraints returns a pointer to an array already dimensioned by lp_solve. Element 0 will contain the value of the first row, element 1 of the second row, ...

Example

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

int main(void)
{
  lprec *lp;
  REAL constr[2], *ptr_constr;

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

  solve(lp);

  get_constraints(lp, constr);
  get_ptr_constraints(lp, &ptr_constr);

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, is_feasible, get_objective, get_working_objective, get_variables, get_ptr_variables, get_primal_solution, get_ptr_primal_solution, get_var_primalresult, get_sensitivity_rhs, get_ptr_sensitivity_rhs, get_dual_solution, get_ptr_dual_solution, get_var_dualresult, get_sensitivity_obj, get_ptr_sensitivity_obj, get_sensitivity_objex, get_ptr_sensitivity_objex,