How to enable solver output when using Grid GAMS Topic is solved

questions about GAMS' tools
Post Reply
CanLi
User
User
Posts: 4
Joined: 1 year ago

How to enable solver output when using Grid GAMS

Post by CanLi » 1 year ago

Hi folks,
I'm using Grid GAMS to solve a problem using Benders decomposition. Here's the code I write for solving some subproblems in parallel.
-------------------------------------------------
loop(w3,
freeze(w2) = no;
freeze(w3) = yes;
solve BenderSub using MINLP minimizing COST;
Bendersub_handle(w3) = Bendersub.handle;
);
Repeat
loop(w3$handlecollect(Bendersub_handle(w3)),
UB_Bender(iter) = UB_Bender(iter) + cost.l;
display$handledelete(Bendersub_handle(w3)) 'trouble deleting handles';
Bendersub_handle(w3)=0;
);
until card(Bendersub_handle) =0;
-------------------------------------------------
As you can see I solve each subproblem using MINLP solver DICOPT. This will solve the problem well. But I cannot see the solver output and solution output of DICOPT anymore. The solver output will always be printed on the screen when we solve the problem without using Grid GAMS. For example, the output from DICOPT can be
-------------------------------------------------
--- DICOPT: Starting major iteration 5
--- Search stopped on crossover
--- DICOPT: Log File:
Major Major Objective CPU time Itera- Evaluation Solver
Step Iter Function (Sec) tions Errors
NLP 1 733.42941 1.06 433 0 conopt
FP 1 1134.04762< 5.92 6531 0 conopt+cplex
MIP 1 908.18371 4.27 158800 0 cplex
NLP 2 920.00110< 0.13 141 0 conopt
MIP 2 913.44293 4.37 175711 0 cplex
NLP 3 922.90779 0.05 153 0 conopt
MIP 3 918.93552 4.65 289842 0 cplex
NLP 4 921.63306 0.06 191 0 conopt
MIP 4 920.11817 6.84 323320 0 cplex
--- DICOPT: Terminating...
--- DICOPT: Stopped on crossover

The search was stopped because a crossover occured.
The bound provided by the MIP master problem exceeds
the objective of the last NLP problem.

--- DICOPT: Best integer solution found: 920.001097
-------------------------------------------------
I'm wondering how can I see the output from DICOPT when I use Grid GAMS. Thank you for any answers.

Regards,
Can

Lutz
User
User
Posts: 23
Joined: 2 years ago

Re: How to enable solver output when using Grid GAMS

Post by Lutz » 1 year ago

Hi,

When you use Grid, the Solver log is suppressed by default, since it would be all mixed if you have many solves in parallel. However, you can instruct GAMS to write the log to a file, which would also cause the solver log to be written to a file (better: to separate files for each solve). To do this, set the command line parameter "LogOption" (https://www.gams.com/latest/docs/usergu ... SLogOption) to either 2 or 4. The solver log will be written to the separate grid directories. These will be deleted by the function "handledelete", so you should not call that, if you want to look at the log files at the end. Also, you should set the command line parameter "keep" (https://www.gams.com/latest/docs/usergu ... l#GAMSKeep) to 1.
If you want to see the solution listing for each solve in the lst file, you can set the command line parameter "AsyncSolLst" (https://www.gams.com/latest/docs/usergu ... syncSolLst) to 1. So, with the model trnsGrid from the GAMS model library I ran

gams trnsgrid.gms lo=4 keep 1 AsyncSolLst 1

from the command line (note that the GAMSIDE would reset the logOption) after removing the call to handleDelete in the model.

Hope that helps!
Lutz

CanLi
User
User
Posts: 4
Joined: 1 year ago

Re: How to enable solver output when using Grid GAMS

Post by CanLi » 1 year ago

Dear Lutz,

This works for me now. Thank you very much for your help.

Regards,
Can
Lutz wrote:Hi,

When you use Grid, the Solver log is suppressed by default, since it would be all mixed if you have many solves in parallel. However, you can instruct GAMS to write the log to a file, which would also cause the solver log to be written to a file (better: to separate files for each solve). To do this, set the command line parameter "LogOption" (https://www.gams.com/latest/docs/usergu ... SLogOption) to either 2 or 4. The solver log will be written to the separate grid directories. These will be deleted by the function "handledelete", so you should not call that, if you want to look at the log files at the end. Also, you should set the command line parameter "keep" (https://www.gams.com/latest/docs/usergu ... l#GAMSKeep) to 1.
If you want to see the solution listing for each solve in the lst file, you can set the command line parameter "AsyncSolLst" (https://www.gams.com/latest/docs/usergu ... syncSolLst) to 1. So, with the model trnsGrid from the GAMS model library I ran

gams trnsgrid.gms lo=4 keep 1 AsyncSolLst 1

from the command line (note that the GAMSIDE would reset the logOption) after removing the call to handleDelete in the model.

Hope that helps!
Lutz

Post Reply