Bruce McCarl's GAMS Newsletter Number 19

GAMS 22.2 Release

GAMS Corporation has released versions 22.0, 22.1 and 22.2 which expanded some language capabilities. Cumulative release notes are on the GAMS web site at http://www.gams.com/docs/release/release.htm#22.2. Some of the new features within these releases are discussed below. The software can be downloaded from http://www.gams.com/download/.

The main new features are

See the release notes for details.

Speed and GAMS

I was recently working on a large and slow model. I found great success in speeding up certain types of calculations using a looping strategy. Namely I was computing

     climatepesticide(crop,Aggregateregs,periods,gcm)= 
      		sum(foraggregate(Aggregateregs,subreg),
              		climatepesticide(crop,subreg,periods,gcm)*
             		aggregatewtcr(Aggregateregs,SubReg,CROP));
and found this to be excessively slow using profile. (Note at the time I also had included $ conditions to suppress unnecessary cases but can't reconstruct them at this point and the time was still quite slow.)

In trying to speed this up I used the loop

     tclimatepesticide(crop,Aggregateregs,periods,gcm)=0;
     loop((rcrop(crop),allregforaggregate(Aggregateregs,subreg),periods,rgcm(gcm))
            	$(    (not sameas(Aggregateregs,subreg))
              	and climatepesticide(crop,subreg,periods,gcm)),
       		tclimatepesticide(crop,Aggregateregs,periods,gcm)
          			= tclimatepesticide(crop,Aggregateregs,periods,gcm)+
             		   climatepesticide(crop,subreg,periods,gcm)*
             		   aggregatewtcr(Aggregateregs,SubReg,CROP));
     climatepesticide(crop,Aggregateregs,periods,gcm)=
          		tclimatepesticide(crop,Aggregateregs,periods,gcm);
     tclimatepesticide(crop,Aggregateregs,periods,gcm)=0;
achieving spectacular reduction (more than 99%) in statement execution time. The strategy

CPLEX and a Basis

For a year or two I have noted a real degradation in the performance of a large model in repeated solves with CPLEX. The GAMS folks helped me out and found that benefits of an advanced basis can be enhanced using three CPLEX options.
Turn off the dual simplex method lpmethod 1
Cause more aggressive scaling to occur scaind 1
Force basis use and suppress presolve advind 1
The real problem is the presolve and the basis do not always live well together and CPLEX used to suppress the presolve and just use the basis but does not as of verion 9 or so. Thus the last option is critical.

A large time savings (75%) resulted and perhaps others using advanced bases or repeated solves can benefit.

MIP Indicator Constraints in CPLEX

For many years it has been standard practice to conditionally include constraints using integer/binary indicator variables using a "BigM" formulation.
     aX - MY <= 0,  X >= 0,  Y in (0,1),  and M a big number
Some have found that a tighter formulation of this speeds MIP solution time.

CPLEX has recently introduced an "indicator constraint" concept in an effort to gain solution speed and GAMS has accommodated this at the moment through the CPLEX option file. Namely an indicator constraint identifies a binary variable/constraint pair where the binary variable turns the constraint on or off. For the time being, the couplings between binary variables and constraints are made through an option file as detailed at http://www.gams.com/solvers/cpxindic.htm.

FeasOpt in CPLEX

CPLEX has introduced a feature named FeasOpt that tries to suggest the least change in an infeasible model that would achieve feasibility. It selectively relaxes the bounds and constraints in a way that minimizes a weighted penalty function that you define. FeasOpt returns a suggested set of bounds and constraint ranges, along with the solution that would result from these relaxations. The CPLEX 10.0 release notes and http://www.columbia.edu/~dano/resources/cplex91_man/usrcplex/solveLP23.html elaborate, while the library model feasopt1 provides an example.

Be careful with Execute_Loadpoint

There is an aspect of Execute_loadpoint that one needs to be careful with. It not only reads levels and marginals of variables and equations, but also bounds, and scales. Thus it can redefine these items to those in model when it was solved if one is not careful. I believe GAMS may be working on changing this. It also merges the solution information and can introduce problems in the longstanding difficulties with GAMS and a solution merge/replace. For elaboration, see the section entitled "A Bug in GAMS" in my fourth newsletter.

Comparing Files

I often find a need to compare two files to see what is different between them. To do this I use the POSIX utility diff.exe that is distributed with GAMS. I implement it within the following small GAMS file (I name it compare.gms) and then execute like any other GAMS file. In turn diff compares file1.gms with file2.gms and reports any differences found into the log file.
     $setglobal f1 c:\file1.gms
     $setglobal f2 c:\file2.gms
     $call '"%gams.sysdir%gbin\diff.exe"  %f1% %f2%'

Grid Computing and MIPs

GAMS is developing a grid computing version that can take a MIP model and distribute the problems to be solved across a grid network of computers. This is working but still experimental and in the process of being written up.

Tom Rutherford Utilities

Tom Rutherford has moved his GAMS related page to http://www.mpsge.org/ where he has a number of utilities including interfaces to EXCEL, Graphic packages, and a mapping program. Materials on CGE modeling and MPSGE also appear there.

Courses offered

I teach a 3.5 day Basic GAMS course at 9,200 feet in Frisco, Colorado June 12-15, 2006. That course is designed for beginners and those who have been working with GAMS casually. It deals mainly with GAMS usage in general, features for optimization and a little CGE.

A 3.5 day AAdvanced GAMS class will be offered in Frisco, Colorado August 14-17, 2006. That course is application independent mainly concentrating on the GAMS language, interfaces, graphing, report writing etc.

Further information and other courses are listed on http://www.gams.com/courses.htm.

Unsubscribe to future issues of this newsletter

To remove your name, please send an email to mccarl-news-request@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.

May 8, 2006