lag_solve

Solve the model via Lagrangian relaxation.

The Lagrangian solver does not work. Do not use this call.

int lag_solve(lprec *lp, REAL start_bound, int num_iter, short verbose);

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
INFEASIBLE (2) The model is infeasible
FEAS_FOUND (6) An feasible solution was obtained, but num_iter was reached
NO_FEAS_FOUND (7) No feasible solution found

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

start_bound

Initial bound.

num_iter

Maximum number of iterations.

verbose

Not used. Still included for backwards compatibility. Use set_lag_trace to set the verbose level.

Remarks

The Lagrangian solver does not work. Do not use this call.

The lag_solve function solves the model via Lagrangian relaxation. Gives the ability to find an integer solution without the branch-and-bound algorithm.
At least 1 Lagrangian constraint must be added via add_lag_con, str_add_lag_con before lag_solve can be used.

Example

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

int main(void)
{
  lprec *lp;
  int ret;
  REAL row[1+2]; /* must be 1 more then number of columns ! */

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

  row[1] = 1.0;
  row[2] = 1.0;
  add_lag_con(lp, row, LE, 1.0);

  ret = lag_solve(lp, 0, 30, FALSE);

  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, solve, get_statustext, is_feasible, get_objective, get_working_objective, get_variables, get_ptr_variables, get_constraints, get_ptr_constraints, get_constr_value, 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, add_lag_con, get_Lrows