get_working_objective

Returns the value of the objective function.

REAL get_working_objective(lprec *lp);

Return Value

get_working_objective returns the current value of the objective while solving the model.

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

Remarks

The get_working_objective function returns the current value of the objective while solving the model.
This value can be retrieved while solving in a callback function.

Example

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

int msgfunction(lprec *lp, void *userhandle, char *buf)
{

 printf("%f\n", get_working_objective(lp));

 return(0);
}

int main(void)
{
  lprec *lp;

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

  put_msgfunc(lp, msgfunction, NULL, 0);

  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, get_working_objective, is_feasible, get_variables, get_ptr_variables, get_constraints, get_ptr_constraints, 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