CPXXgetmiprelgap and CPXgetmiprelgap

The routine CPXXgetmiprelgap/CPXgetmiprelgap accesses the relative objective gap for a MIP optimization.

int  CPXXgetmiprelgap( CPXCENVptr env, CPXCLPptr lp, double * gap_p )

int  CPXgetmiprelgap( CPXCENVptr env, CPXCLPptr lp, double * gap_p )

Description

The routine CPXXgetmiprelgap/CPXgetmiprelgap accesses the relative objective gap for a MIP optimization.

For a minimization problem, this value is computed by


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

where bestinteger is the value returned by CPXXgetobjval/CPXgetobjval and bestobjective is the value returned by CPXXgetbestobjval/CPXgetbestobjval. For a maximization problem, the value is computed by:


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

Arguments

env
A pointer to the CPLEX environment as returned by CPXXopenCPLEX/CPXopenCPLEX.
lp
A pointer to a CPLEX problem object as returned by CPXXcreateprob/CPXcreateprob.
gap_p
A pointer to the location where the relative mip gap is returned.

Return

The routine returns 0 (zero) if successful and nonzero if an error occurs.

Example


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