get_lambda, get_ptr_lambda

Returns the Lamdba vectors (Lagrangian optimization).

int get_lambda(lprec *lp, REAL *lambda);

int get_ptr_lambda(lprec *lp, REAL **ptr_lambda);

Return Value

get_lambda, get_ptr_lambda returns TRUE (1) if the operation was successful. A return value of FALSE (0) indicates an error.



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


An array that will contain the values of the Lamdba vectors.


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


The get_lambda, get_ptr_lambda functions retrieve the Lamdba vectors.
These values are only valid after a successful lag_solve. Function get_lambda needs an array that is already dimensioned with get_Lrows elements. get_ptr_lambda returns a pointer to an array already dimensioned by lp_solve.


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

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

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

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

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

  get_lambda(lp, lambda);
  get_ptr_lambda(lp, &ptr_lambda);


lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS, is_feasible, get_objective, get_variables, get_ptr_variables, 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, get_constraints, get_ptr_constraints, lag_solve