# get_sensitivity_obj, get_ptr_sensitivity_obj, get_sensitivity_objex, get_ptr_sensitivity_objex Returns the sensitivity of the objective function. unsigned char get_sensitivity_obj(lprec *lp, REAL *objfrom, REAL *objtill); unsigned char get_sensitivity_objex(lprec *lp, REAL *objfrom, REAL *objtill, REAL *objfromvalue, REAL *objtillvalue); unsigned char get_ptr_sensitivity_obj(lprec *lp, REAL **ptr_objfrom, REAL **ptr_objtill); unsigned char get_ptr_sensitivity_objex(lprec *lp, REAL **ptr_objfrom, REAL **ptr_objtill, REAL **ptr_objfromvalue, REAL **ptr_objtillvalue); Return Value get_sensitivity_obj, get_ptr_sensitivity_obj, get_sensitivity_objex, get_ptr_sensitivity_objex return TRUE (1) if the operation was successful. A return value of FALSE (0) indicates an error. 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 objfrom An array that will contain the values of the lower limits on the objective function. ptr_objfrom The address of a pointer that will point to an array that will contain the values of the lower limits of the objective function. objtill An array that will contain the values of the upper limits of the objective function. ptr_objtill The address of a pointer that will point to an array that will contain the values of the upper limits of the objective function. objfromvalue An array that will contain the values of the variables at their lower limit. Only applicable when the value of the variable is 0 (rejected). objtillvalue Not used at this time. ptr_objfromvalue The address of a pointer that will point to an array that will contain the values of the variables at their lower limit. Only applicable when the value of the variable is 0 (rejected). ptr_objtillvalue Not used at this time. Remarks The get_sensitivity_obj, get_ptr_sensitivity_obj, get_sensitivity_objex, get_ptr_sensitivity_objex functions return the sensitivity of the objective function. These values are only valid after a successful solve and if there are integer variables in the model then only if set_presolve is called before solve with parameter PRESOLVE_SENSDUALS. Functions get_sensitivity_obj, get_sensitivity_objex need arrays that are already dimensioned with get_Ncolumns elements. get_ptr_sensitivity_obj, get_ptr_sensitivity_objex returns a pointer to an array already dimensioned by lp_solve. Element 0 will contain the value of the first variable, element 1 of the second variable, ... The meaning of these limits are the following. As long as the value of the coefficient of the objective function stays between the lower limit (objfrom) and the upper limit (objtill), the solution stays the same. Only the objective value itself changes with a value equal to the difference multiplied by the amount of this variable. If there is no lower/upper limit, then these values are (-)infinity. Note that get_ptr_sensitivity_obj and get_ptr_sensitivity_objex return a pointer to memory allocated and maintained by lp_solve. Be careful what you do with it. Don't modify its contents or free the memory. Unexpected behaviour would occur. Also note that this memory pointer is only guaranteed to remain constant until a next lp_solve API call is done. You should call this function again to make sure you have again the correct pointer. Otherwise, this pointer could point to invalid memory. This should not be a problem since this call is very efficient. Example
    #include <stdio.h>
    #include <stdlib.h>
    #include "lp_lib.h"

    int main(void)
    {
      lprec *lp;
      REAL objfrom[1+2], objtill[1+2], *ptr_objfrom, *ptr_objtill;

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

      str_set_obj_fn(lp, "1 1");
      str_add_constraint(lp, "2 4", GE, 10);
      set_lowbo(lp, 1, 1);

      solve(lp);

      get_sensitivity_obj(lp, objfrom, objtill);
      get_ptr_sensitivity_obj(lp, &ptr_objfrom, &ptr_objtill);

      delete_lp(lp);
      return(0);
    }
lp_solve API reference See Also make_lp, copy_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, is_feasible, get_objective, get_working_objective, get_variables, get_ptr_variables, get_primal_solution, get_ptr_primal_solution, get_var_primalresult, get_sensitivity_rhs, get_ptr_sensitivity_rhs,