get_objective

Returns the value of the objective function.

REAL get_objective(lprec *lp);

Return Value

get_objective returns the value of the objective.

Parameters

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 get_objective function returns the value of the objective of the last solve.
This value is only valid after a successful solve or lag_solve.

Example

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

int main(void)
{
  lprec *lp;
  REAL obj;

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

  solve(lp);

  obj = get_objective(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, is_feasible, 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