Change Working Directory of GAMS

Problems with syntax of GAMS
Post Reply
barsssk
User
User
Posts: 5
Joined: 6 years ago

Change Working Directory of GAMS

Post by barsssk »

Hello all,

Is it possible to change working directory that GAMS puts all those .gdx, .txt, .lst files by default ?

Thanks
User avatar
gamsadmin
Site Admin
Site Admin
Posts: 16
Joined: 7 years ago

Re: Change Working Directory of GAMS

Post by gamsadmin »

Hi Barsssk

You could use a setlocal or setglobal parameter at the beginning of your file.
For example, if you want to have all your files in the directory results, which is below your model directory, I add:

Code: Select all

$setglobal results .\results\

* Send to results directory
execute_unload "%results%myresults.gdx";
Gams now replaces every occurence of %results% by .\results\

I use this technique for all my subdirectories (data, temp, results), so I keep all stuff nicely separated. In the subdirectory "temp" I save everything that is created during the run and can be recreated easily. The results subdirectory is for excel files that will be filled everytime with new results (if available).

Cheers

Renger
Post Reply