Gams-Mode


  • Using the Gams Manuals in Gams-Mode

    You can call the help and solver files from within Gams.mode hitting C-c Enter. Be sure that the directory for the help files is properly set (choose Customize Gams mode for Emacs from the Gams menu) and search for the following entry in the buffer:
     
    If you hit enter, the gams manual is shown in your PDF viewer, but you can also search for another file. For example: type path and hit tab for completion: Gams-mode will show you two completions for ‘path’: PATH-Solver and PATH-LP-Solver.
    You should also set the path of the PDF file
    Read the rest “Using the Gams Manuals in Gams-Mode”

  • Indenting with Gams-mode

    The new version of Gams-mode has a nice feature that helps you in formatting your model.
    You can automatically indent GAMS programs according to GAMS syntax.
     
    M-C-\        =       Indent region.  Specify region and type M-C-\.
    TAB          =       Indent the current line.
     
    On the left you see the model before using the indent feature of Gams-mode. I selected the region and typed M-C-\ (`indent-region’).
    You can see on the right side what happened. The set and parameter declarations are nicely formatted and the loop is clearly
    Read the rest “Indenting with Gams-mode”

  • Version 3.5 of Gams-mode released

    There is a new version of Gams-mode for Emacs (Release 3.5). When I install a new version on my Windows machine, I usually rename the old Gams-mode directory (on my computer this is ‘C:\Program Files\Emacs\site-lisp\gams’ in ‘C:\Program Files\Emacs\site-lisp\gamsOld’ and put the downloaded Gams-mode files in a directory with the original name (C:\Program Files\Emacs\site-lisp\gams). This way I can check if the new version runs without problems (all settings are preserved) and go back to the old version if there are any problems (just by renaming the directories again). The new version has a great feature for aligning blocks in Gams code.
    Read the rest “Version 3.5 of Gams-mode released”

  • GAMS mode goodies: Looking up the identifier part of a parameter, variable or set

    One of the nice features of Gams-Mode for Emacs is the possibility to quickly look up the identifier part of a variable, parameter or set. This is a nice feature in big models or when you haven’t worked with the model for some time. Just put the cursor somewhere on the parameter in the code you are looking at and hit F7. The screen will split and an additional side pane will appear.
    Here is an example: in the lower pane you see the file readdata.gms, where I am working on, and the cursor is on the parameter “total” (red
    Read the rest “GAMS mode goodies: Looking up the identifier part of a parameter, variable or set”

  • Golden Rule 2: Comments and Descriptions

    The next golden rule might also be obvious:Always add comments to your work and label your sets, variables, parameters and equations
    Now this might be obvious if you have a lot of time, but usually the rule is forgotten if you are stressed and want to finish what you are working on. Not writing comments will probably cost you a lot of time, if you take your model a year from now and see your code: Wow, that looks interesting and very ingenious, but what the %*?!  did I do here? If you send your model to somebody else for
    Read the rest “Golden Rule 2: Comments and Descriptions”


Categories