Model solution status attributes: .Modelstat, .Solvestat, .Tmodstat, .Tsolstat

Top  Previous  Next

The attributes of models may be included in a put employing the syntax

 

Put modelname.attribute

 

The blue entries below involves the modelstat and solvestat model attributes plus their text counterparts (Tmodstat, Tsolstat) reporting model and solver solution status as used within the example putex1.gms.

 

loop(scenarios,

    Need(Destinaton)=demandscen(destinaton,scenarios);

    Solve tranport using LP minimizing totalcost ;

    report("total","cost",scenarios)=totalcost.l;

    report("demand shadow price",Destinaton,scenarios)

            = demandbal.m(Destinaton);

    report("supply shadow price",Source,scenarios)

          = Supplybal.m(Source);

                   savtransport(Source,Destinaton,scenarios)

=transport.l(Source,Destinaton);

    put 'Scenario name   ' scenarios.te(scenarios):14

    put ' Optimality status     ' tranport.modelstat:2:0 /;

    put ' Optimality status text ' tranport.Tmodstat /;

    put ' Solver status         ' tranport.solvestat:2:0 /;

    put ' Solver status text     ' tranport.Tsolstat /;   )      ;

 

The resultant output file follows with the blue entries corresponding to the model solution status attribute data generated by the put commands above.

 

Scenario name   Base Case     Optimality status      1

                              Optimality status text 1 OPTIMAL

                              Solver status          1

                              Solver status text     1 NORMAL COMPLETION

Scenario name   No Chicago    Optimality status      1

                              Optimality status text 1 OPTIMAL

                              Solver status          1

                              Solver status text     1 NORMAL COMPLETION

Notes:

Default field width is 12 characters but alternative widths may be used as discussed below.
The model solution status attributes that can be used are
Modelstatwhich gives problem optimality status as in the modelstat table
Solvestatwhich gives solver completion status as in the full list that appears here
Tmodstatwhich gives problem optimality status text  as in the modelstat table
Tsolstatwhich gives solver completion status text as in the full list that appears here.

 

Many more model attributes may be included.  A list appears in the Model Attributes chapter.
Small or large numbers cause exponential format to be used.
GAMS will print zeros out here but does not in display statements.
Default number of decimal places is 2 but alternative specifications may be used as discussed below.
Default justification for text is left but alternative formatting may be used as discussed below.