0

I have a code of more than 400 lines, and it takes a long time to run it. I'm at the stage of debugging and was wondering whther its possible to just run only a display command in a particular line? I mean like the option we have in PyCharm that we jsut press shift+enter at the desired line and it'll execute only that line. Thanks

Rainbow
  • 171
  • 9

1 Answers1

1

Short answer: No, you can not run just a single line (unless it is the first one).

Little longer, some way that could still be useful to save some time while debugging:

You could add $exit to run just the lines before that and skip the rest of your model.

If you have "static code" that takes some time at the start before you have other code that is work in progress and you want to save the time for the first part, you can use the "Save and Restart" facility of GAMS (see https://www.gams.com/41/docs/UG_SaveRestart.html). For this, you split the model in parts, lets say, the first part will be saved in longPrep.gms, the second part is wip.gms.

Then, you run gams longPrep.gms s=prep, which will generate a save file prep which will be your starting point for your second part by running gams wip.gms r=prep.

Lutz
  • 2,197
  • 1
  • 10
  • 12