Complexity Analysis with GAMS - Writing the Solvertime and Runtime to file

Dear Gamsworld,

For a current model, I would like to do a parametric analysis of the
model (thanks for the looping gams trick btw.) for more than 2.5k
runs. Writing the solution to Excel is doing fine. I am however
unable to write the runtimes, or information about the relative gap to
theoretic optimum to file aswell.

Is there a way to write the solver runtime, and gap information to a
variable, or perhaps a way to directly export the information, so that
It’s “automatically” (with GDXXRW) written to the Excel file along
with the solutions. Or perhaps could you link me the manual which
covers these topics?

Regards
Chris

\

Chris,

You can access certain model information with . in GAMS, e.g., .resusd will show you the time used by the solver. You can for example display this information or create a parameter consisting of different attributes and use GDXXRW to write the information to Excel. The gap cannot be accessed directly but it can be calculated. The following is an example I added to the end of the model dice from the GAMS model library:

stats(‘Time Used’) := xdice.resusd;
stats(‘Absolute Gap’) := abs(xdice.objest - xdice.objval);
stats(‘Relative Gap’) := abs(xdice.objest - xdice.objval)/abs(xdice.objest);

Note that some solvers (like Cplex) use a different definition of the relative gap. This can be seen here:

stats(‘Relative Gap (Cplex)’) := abs(xdice.objest - xdice.objval)/(1e-10+abs(xdice.objval));

Information about the absolute and relative gap can also be found at the GAMS Support Wiki:

http://support.gams-software.com/doku.php?id=solver:what_is_optca_optcr

I hope that helps,
Lutz



Bodenstein wrote:

Dear Gamsworld,

For a current model, I would like to do a parametric analysis of the
model (thanks for the looping gams trick btw.) for more than 2.5k
runs. Writing the solution to Excel is doing fine. I am however
unable to write the runtimes, or information about the relative gap to
theoretic optimum to file aswell.

Is there a way to write the solver runtime, and gap information to a
variable, or perhaps a way to directly export the information, so that
It’s “automatically” (with GDXXRW) written to the Excel file along
with the solutions. Or perhaps could you link me the manual which
covers these topics?

Regards
Chris


Lutz Westermann LWestermann@gams.com
GAMS Development Corporation GAMS Software GmbH
1217 Potomac St. NW, Eupener Str. 135-137
Washington DC, 20007, USA 50933 Cologne, Germany
Fon/Fax: +1 202 342-0180/1 Fon/Fax: +49 221 949-9170/1
http://www.gams.com http://www.gams.de


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

Aha! (And now is the time where I recognize this from the GAMS
Distribution Manual on Pg. 72 …)

So just to see that I got this right in a tiny example model:

scalars ResourceUnits CPU time in seconds;

Model IsThisRight /all/

ResourceUnits := IsThisRight.resusd;

display ResourceUnits;

will get me a Scalar called “ResourceUnits” which I can again work
with in GDX, etc.

Regards
Chris

On 16 Jul., 18:36, Lutz Westermann wrote:

Chris,

You can access certain model information with . in
GAMS, e.g., .resusd will show you the time used by the
solver. You can for example display this information or create a
parameter consisting of different attributes and use GDXXRW to write the
information to Excel. The gap cannot be accessed directly but it can be
calculated. The following is an example I added to the end of the model
dice from the GAMS model library:

stats(‘Time Used’) := xdice.resusd;
stats(‘Absolute Gap’) := abs(xdice.objest - xdice.objval);
stats(‘Relative Gap’) := abs(xdice.objest - xdice.objval)/abs(xdice.objest);

Note that some solvers (like Cplex) use a different definition of the
relative gap. This can be seen here:

stats(‘Relative Gap (Cplex)’) := abs(xdice.objest -
xdice.objval)/(1e-10+abs(xdice.objval));

Information about the absolute and relative gap can also be found at the
GAMS Support Wiki:

http://support.gams-software.com/doku.php?id=solver:what_is_optca_optcr

I hope that helps,
Lutz

Bodenstein wrote:

Dear Gamsworld,

For a current model, I would like to do a parametric analysis of the
model (thanks for the looping gams trick btw.) for more than 2.5k
runs. Writing the solution to Excel is doing fine. I am however
unable to write the runtimes, or information about the relative gap to
theoretic optimum to file aswell.

Is there a way to write the solver runtime, and gap information to a
variable, or perhaps a way to directly export the information, so that
It’s “automatically” (with GDXXRW) written to the Excel file along
with the solutions. Or perhaps could you link me the manual which
covers these topics?

Regards
Chris


Lutz Westermann LWesterm...@gams.com
GAMS Development Corporation GAMS Software GmbH
1217 Potomac St. NW, Eupener Str. 135-137
Washington DC, 20007, USA 50933 Cologne, Germany
Fon/Fax: +1 202 342-0180/1 Fon/Fax: +49 221 949-9170/1http://www.gams.com http://www.gams.de

\