gdxmrw_tr5.gms : better example of gams() usage

Description

We solve an LP model in GAMS with the data coming from Matlab:
 c.f. the file tr4_run.m, which runs this example.

The style we use here breaks the process into smaller steps:
  1. Write the sets and parameters from Matlab to the first GDX file using
     wgdx(). The resulting GDX file can be viewed without running GAMS -
     this makes debugging data issues easier.
  2. Run the GAMS model, reading data from the first GDX file and writing
     the results to a second GDX file.  The modeling and debugging can
     take place without running Matlab or even having it installed, and
     subsequent problems can be reproduced trivially.  Also, there is
     nothing Matlab-specific about the GAMS model: it uses GDX in the
     usual way.
  3. Read the solution from the second GDX file into Matlab.

The disadvantage of this scheme compared to one where all data is passed
via the gams() call is that it doesn't have the feel of a
subroutine call.  In addition to the advantages explained above, it is
also easier to read and write data at both compile and execution time
using this scheme.

This example is nearly identical to gdxmrw_tr4, except this one
uses nice UELs (i.e. set element labels) like 'seattle,'new-york' instead
of '1', '2', '3'.

Contributor: Steven Dirkse, December 2014


Category : GAMS Data Utilities library


Main file : gdxmrw_tr5.gms   includes :  trdata.m  tr45_mod.gms  gdxmrw_tr5.gms  tr5_run.m

$Title LP with sets and params from GDXMRW - nice UELs

$ontext
We solve an LP model in GAMS with the data coming from Matlab:
 c.f. the file tr4_run.m, which runs this example.

The style we use here breaks the process into smaller steps:
  1. Write the sets and parameters from Matlab to the first GDX file using
     wgdx(). The resulting GDX file can be viewed without running GAMS -
     this makes debugging data issues easier.
  2. Run the GAMS model, reading data from the first GDX file and writing
     the results to a second GDX file.  The modeling and debugging can
     take place without running Matlab or even having it installed, and
     subsequent problems can be reproduced trivially.  Also, there is
     nothing Matlab-specific about the GAMS model: it uses GDX in the
     usual way.
  3. Read the solution from the second GDX file into Matlab.

The disadvantage of this scheme compared to one where all data is passed
via the gams() call is that it doesn't have the feel of a
subroutine call.  In addition to the advantages explained above, it is
also easier to read and write data at both compile and execution time
using this scheme.

This example is nearly identical to gdxmrw_tr4, except this one
uses nice UELs (i.e. set element labels) like 'seattle,'new-york' instead
of '1', '2', '3'.

Contributor: Steven Dirkse, December 2014

$offtext

$log *** ---------------------------------------------------------------
$log This GMS file is just a placeholder!!
$log To run this example, start Matlab and run the M-script tr5_run that
$log came with this file.
$log *** ---------------------------------------------------------------