# is_feasible

Checks if provided solution is a feasible solution.

unsigned char is_feasible(lprec *lp, REAL *values, REAL threshold);

Return Value

is_feasible returns FALSE (0) or TRUE (1) that indicates if provided solution is feasible.

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

values

An array of row/column values that are checked against the bounds and ranges.
The array must have get_Nrows+get_Ncolumns elements. Element 0 is not used.

threshold

A tolerance value. The values may differ that much. Recommended to use get_epsint for this value.

Remarks

The is_feasible function checks if provided solution is a feasible solution. All values of the values array must be between the bounds and ranges to be a feasible solution.
This value is only valid after a successful solve or lag_solve.

Example

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

    int main(void)
    {
      lprec *lp;
      REAL values[1+2];
      unsigned char feasible;

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

      solve(lp);

      values[0] = 0.0;
      values[1] = 1.0;
      values[2] = 2.0;
      feasible = is_feasible(lp, values, 0); /* Will return TRUE */

      delete_lp(lp);
      return(0);
    }

lp_solve API reference

See Also make_lp, copy_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, get_objective, get_working_objective, get_variables, get_ptr_variables, get_constraints, get_ptr_constraints, get_constr_value, 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