|
Upon solution a model attribute indicative of model status (Modelstat) is set by a solver and passed back to GAMS. This attribute can have the following values
| Value of Modelstat | Indicated Model Solution Status |
| 1 | Optimal solution achieved |
| 2 | Local optimal solution achieved (Only type found in an NLP) |
| 5 | Locally infeasible model found (in NLPs) |
| 6 | Solver terminated early and model was infeasible |
| 7 | Solver terminated early and model was feasible but not yet optimal |
| 8 | Integer solution model found |
| 9 | Solver terminated early with a non integer solution found (only in MIPs) |
| 10 | No feasible integer solution could be found |
| 12 | Error achieved – No cause known |
| 13 | Error achieved – No solution attained |
| 14 | No solution returned from CNS models |
| 15 | Feasible in a CNS models |
| 16 | Locally feasible in a CNS models |
| 17 | Singular in a CNS models |
| 18 | Unbounded – no solution |
| 19 | Infeasible – no solution |
A set of modelstat constants are defined where
ModelStat.Optimal has a numerical value of 1
ModelStat.Locally Optimal has a numerical value of 2
ModelStat.Unbounded has a numerical value of 3
ModelStat.Infeasible has a numerical value of 4
ModelStat.Locally Infeasible has a numerical value of 5
ModelStat.Intermediate Infeasible has a numerical value of 6
ModelStat.Intermediate Nonoptimal has a numerical value of 7
ModelStat.Integer Solution has a numerical value of 8
ModelStat.Intermediate Non-Integer has a numerical value of 9
ModelStat.Integer Infeasible has a numerical value of 10
ModelStat.Licensing Problems has a numerical value of 11
ModelStat.Error Unknown has a numerical value of 12
ModelStat.Error No Solution has a numerical value of 13
ModelStat.No Solution Returned has a numerical value of 14
ModelStat.Solved Unique has a numerical value of 15
ModelStat.Solved has a numerical value of 16
ModelStat.Solved Singular has a numerical value of 17
ModelStat.Unbounded - No Solution has a numerical value of 18
ModelStat.Infeasible - No Solution has a numerical value of 19
These values are fixed and cannot be manipulated.
In addition, the model attribute .Tmodstat contains internally assigned text describing the model optimality status and can be used in put files to print out a text indication of model optimality status.
Examples:
( varmodatt.gms )
scalar xx;
xX=transport.Modelstat;
Display xx,transport.Modelstat;
If(transport.Modelstat gt %ModelStat.Locally Optimal%,
Display '**** Model did not terminate with normal solution',
transport.Modelstat;)
set scenarios /goodone,toomuchdemand/;
set casewithbadanswer(scenarios,*);
loop (scenarios,
solve transport using lp minimizing cost;
demand(sink)=demand(sink)*1.1;
casewithbadanswer(scenarios,"model")
$(transport.Modelstat gt 2)=yes;
);
display casewithbadanswer;
Notes:
| • | In the example above note we are basically using this attribute so I can keep a record or generate output relative to model solution status. |
| • | The user can assign values to Modelstat, but ordinarily this is not desirable. |
| • | In a set of looped solves this provides the best 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. |
| • | .Tmodstat contains internally assigned text describing the model optimality status and can be used in put files to print out a text indication of that status. |
|