Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  CPLEX gap information

    Posted 09/21/09 01:52 AM

    Originally posted by: SystemAdmin


    [hernan said:]

    Hi everybody!
    When CPXmipopt finishes, I want to get the last gap information that appears in the log file, so if CPXmipopt execution finishes caused by Time Limit, I want to know the %gap. Is it possible using CPLEX Callable Library or I must parse the log file??
    Thanks!

    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: CPLEX gap information

    Posted 09/21/09 07:53 AM

    Originally posted by: SystemAdmin


    [johncui said:]

    Please try:

    CPXgetmiprelgap
    int CPXgetmiprelgap(CPXCENVptr env, CPXCLPptr lp, double * gap_p)
    Definition file: cplex.h
    The routine CPXgetmiprelgap accesses the relative objective gap for a MIP optimization.

    For a minimization problem, this value is computed by

    (bestinteger - bestobjective) / (1e-10 + |bestobjective|)
    where bestinteger is the value returned by CPXgetobjval and bestobjective is the value returned by CPXgetbestobjval. For a maximization problem, the value is computed by:

    (bestobjective - bestinteger) / (1e-10 + |bestobjective|)

    Example

    status = CPXgetmiprelgap (env, lp, &gap);

    Parameters:
    env A pointer to the CPLEX environment as returned by CPXopenCPLEX.

    lp A pointer to a CPLEX problem object as returned by CPXcreateprob.

    gap_p A pointer to the location where the relative mip gap is returned.


    Returns:
    The routine returns zero if successful and nonzero if an error occurs.
    #DecisionOptimization
    #MathematicalProgramming-General