Bruce McCarl's GAMS Newsletter Number 4

Good Modeling Practices

I feel it's largely in a modelers hands as how much self documentation a piece of GAMS code contains. I think there are purposeful actions one can undertake to improve documentation. This effort often determines how easy it is to reuse or repair a model at a later time or how easily a colleague (or in my case a consultant) can work with that code. I argue this in the notes on http://www.gams.com/mccarl/goodmodl.pdf.

A Bug in GAMS?

There is a feature in GAMS that while debatable, I call a bug. It arises under the following circumstances

  1. I have a named variable that is in the model only under certain cases
  2. I run the model a number of times in a loop or repeated solves or use a basis
  3. In the solves or through the basis elements of the named variable are nonzero
  4. I then solve omitting the variable and am doing some report writing involving sums over the omitted variable
  5. I get a solution which is consistent with the variable not being in the model (or having a zero level)
  6. BUT the blasted reports still have non zero levels for the variable
I found this by solving a model with and without allowing land transfers between sectors and found that in the without case I still had non zero transfers. What happens is GAMS retains the levels from the solution before (solveopt=replace does not fix this, we need solveopt=destroy). For an example and corrective recommendations see http://www.gams.com/mccarl/wontgo.pdf.

Controlling a run with the command line User options

Did you know using set global and the gams user options you can control a run from the command line. Consider the following example portion of a gamscode:

   $setglobal incfile michael
   $if not %gams.user1% == "" $set incfile  %gams.user1%
   $include %incfile%
In turn if one runs this code with the command line
   gams mymodel user1=john then problem includes the file "john"
   gams mymodel user1=paul then problem includes the file "paul"
   gams mymodel            then problem includes the file "michael"
One can use user1 through user5 in this manner. One can also use this in the IDE user parameters box. This is not limited to included files but could be used to change include data items or other elements using general set global commands as discussed in newsletter 3.

An additional example is in http://www.gams.com/mccarl/rqap.gms.

Problems with CPLEX 7 and Dual

I have had fits with the new version of CPLEX because on restarts it automatically goes to the dual simplex algorithm and problems that used to take seconds take up to an hour. Sometimes the primal is much better. There are some options others who may be experiencing such problems may want to use. Namely I use

in our CPLEX options file. Solutions performance is greatly improved. You may wish to experiment. If you solve in sequence or use a basis, this may help.

XSAVE to allow different platforms to work together

I own several HP work stations, several LINUX machines, and several PCs. In general the save files from these machines are not interchangeable across the different types i.e. an HP save can not be used for a LINUX restart. But this is not true if you use XSAVE, you then can interchange the files. This is an advantage to me but comes at a cost as XSAVE is slower and the files are somewhat bigger. The RESTART parameter is used as with SAVE. Thus, use a command like

   gams mymodel xsave=r1 r=f0

Courses offered

I teach advanced GAMS in Goettingen, Germany in June 5-8, 2001 and in Texas in January 2002. I teach basic GAMS in Texas October 8-11. Further information and other courses are listed on http://www.gams.com/courses.htm.

Quest for a classroom

I wanted to teach a course in Washington or somewhere on the east coast this summer but could not find a satisfactory arrangement for a first time offering. If anyone is interested in hosting a basic course for some free attendees please contact me.

Unsubscribe to future issues of this newsletter

To remove your name, please send an email to mccarl@gams.com containing unsubscribe on the subject line or unsubscribe through the web form http://www.gams.com/maillist/newsletter.htm.

This newsletter is not a product of GAMS Corporation although it is distributed with their cooperation.

March 9, 2001