Solvestat: Tsolstat

Top  Previous  Next

Upon solution a model attribute indicative of solver termination model status (solvestat) is set by a solver and passed back to GAMS.  This attribute can have the following 13 values.

 

Value of SolvestatIndicated Solver termination condition

 

1Normal termination
2Solver ran out of iterations (fix with iterlim)
3Solver exceeded time limit (fix with reslim)
4Solver quit with a problem (see LST file) found
5Solver quit with excessive nonlinear term evaluation errors (see LST file and fix with bounds or domlim)
6Solver terminated for unknown reason (see LST file)
7Solver terminated with preprocessor error (see LST file)
8User interrupt
 9,10,11,12,13Solver terminated with some type of failure (see LST file)

 

A set of solvestat constants are defined where

 Solvestat.Normal Completion has a numerical value of 1
 Solvestat.Iteration Interrupt has a numerical value of 2
 Solvestat.Resource Interrupt has a numerical value of 3
 Solvestat.Terminated By Solver has a numerical value of 4
 Solvestat.Evaluation Interrupt has a numerical value of 5
 Solvestat.Capability Problems has a numerical value of 6
 Solvestat.Licensing Problems has a numerical value of 7
 Solvestat.User Interrupt has a numerical value of 8
 Solvestat.Setup Failure has a numerical value of 9
 Solvestat.Solver Failure has a numerical value of 10
 Solvestat.Internal Solver Failure has a numerical value of 11
 Solvestat.Solve Processing Skipped has a numerical value of 12
 Solvestat.System Failure has a numerical value of 13

These values are fixed and cannot be manipulated.

Examples:

( varmodatt.gms )

scalar xx;

xX=transport.solvestat;

Display xx,transport. solvestat;

If(transport.solvestat gt %Solvestat.Normal Completion%,

      Display '**** Solver did not terminate with normal solution',

                 transport. solvestat ;)

set scenarios /goodone,toomuchdemand/;

set casewithbadanswer(scenarios,*);

loop (scenarios,

         solve transport using lp minimizing cost;

         demand(sink)=demand(sink)*1.1;

         casewithbadanswer(scenarios,"solve")

$(transport.solvestat gt 1)=yes;

);

display casewithbadanswer;

Notes:

In the example above this attribute is used to keep a record of termination status and generate output relative to solver termination status.
The user can assign values to solvestat, but ordinarily this would not be the case.
In a set of looped solves this provides another way to keep track of whether the solves worked properly and if the numerical values are stored to record an indication of the type of problem.
Tsolstat contains internally assigned text describing the solver termination status and can be used in put files to print out a text indication of termination status.