I want to calculate relative optimality Gap of a MIP Problem also i want to abort runs at a certain run time. this method:
F(1)
abs(mymodel.objest - mymodel.objval)/max(abs(mymodel.objest),abs(mymodel.objval))
is not consistent with gap which GAMS calculate in log. GAMS uses "Best Integer" to find gap not current objective value. which one is correct? and How can i save current "Best Integer" into a parameter ( like .objval).
and finally calculating relative optimality Gap in a benders algorithm is right this way?
rgap = (upperBound - lowerBound)/(1 + abs(upperBound));
What GAMS Calculate using "MIP Solution"
MIP Solution: 3334501534.000555 (1625 iterations, 0 nodes)
Final Solve: 56330158.829040 (2561 iterations)
Best possible: 48915652.476336
Absolute gap: 3285585881.524219
Relative gap: 0.985330
F(1) calculated gap using mymodel.objval (mymodel.objval return "Final Solve") so calculated gap is %13 and mymodel.objval value is 5.633016E+7 (GAMS calculated gap is %98). so i need to save "MIP Solution" to a parameter to export it to a excel file.