Change Working Directory of GAMS

Problems with syntax of GAMS
Post Reply
barsssk
User
User
Posts: 5
Joined: 2 months ago

Change Working Directory of GAMS

Post by barsssk » 1 month ago

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: 5
Joined: 1 year ago

Re: Change Working Directory of GAMS

Post by gamsadmin » 1 month ago

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