solve

solve the model.

int solve(lprec *lp);

Return Value

TIMEOUT (-2) A timeout occurred. A timeout was set via set_timeout
USERABORT (-3) The abort routine returned TRUE. See put_abortfunc
OPTIMAL (0) An optimal solution was obtained
MILP_FAIL (1) The branch-and-bound algorithm had an error
INFEASIBLE (2) The model is infeasible
UNBOUNDED (3) The model is unbounded
FAILURE (4) An error occurred
BREAK_BB (8) The branch-and-bound was stopped because of a break-at-first (see set_break_at_first) or a break-at-value (see set_break_at_value)

Parameters

lp

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

Remarks

The solve function solves the model. solve can be called more than once. Between calls, the model may be modified in every way. Restrictions may be changed, matrix values may be changed and even rows and/or columns may be added or deleted.

Example

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

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

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

  ret = solve(lp);

  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, lag_solve, is_feasible, get_objective, get_variables, get_ptr_variables, get_constraints, get_ptr_constraints, get_primal_solution, get_ptr_primal_solution, get_work_solution, get_ptr_work_solution, get_sensitivity_rhs, get_ptr_sensitivity_rhs, get_reduced_costs, get_ptr_reduced_costs, get_sensitivity_obj, get_ptr_sensitivity_obj, get_sensitivity_objex, get_ptr_sensitivity_objex