MATLAB and GAMS: Interfacing Optimization and Visualization Software (the GDXMRW utilities)

Authors: Michael C. Ferris (, Steven Dirkse (, and Rishabh Jain

Outline and Installation Procedure:

This document briefly describes a link between GAMS and MATLAB. The software gives MATLAB users the ability to use all the optimization capabilities of GAMS, and allows visualization of GAMS models directly within MATLAB. From version 23.4 of GAMS onwards, all the Matlab/GAMS utilities (rgdx, wgdx, and gams) previously documented and made available here are fully integrated into the GAMS distribution, so no separate downloads are necessary. We recommend that you use the supported version of these utilities integrated into and documented in the GAMS distributions available for download here.

More complete installation procedures are provided in the documentation in the GAMS distribution or online at: (GDXMRW installation and documentation).

Yet more details on troubleshooting installation and other support information can be accessed as part of the GAMS support Wiki: (Extended installation information and FAQ).

View this page in Romanian courtesy of azoft

Information for previous users only: deprecated versions

Older versions of this code that may work for previous versions of MATLAB and/or GAMS are documented as deprecated versions.

Simple instructions for people upgrading from previous versions

The new interface merges the read and write routines of GDXMRW and the original MATLAB/GAMS interface into one system with three routines:

Placeholders for the deprecated routines (from version 1 of GDXMRW) readgdx.m and writegdx.m are also provided but the user is encouraged to switch to the new, more efficient rgdx and wgdx routines. The routine "gams" is not backwards compatible: calls of the old form:

gams('qp', Q)

must be replaced by (for example) = 'Q'; sQ.val = Q; gams('qp',sQ);

(due to a change by Matlab in the mex interface). There is also a requirement for a "header" line in the GAMS file if you are using output parameters and some changes to the syntax within the GAMS file are needed.

From version 23.4 of GAMS onwards, the MATLAB facilities are provided within the GAMS distribution (download current GAMS distribution) for Windows, Mac and Linux platforms. Simpler installation procedures are provided in the documentation in the GAMS distribution or online at: (GDXMRW new version installation and documentation).