Many real world applications involve complex models containing multiple data sources (include files or gdx files). In order to reproduce the problem, the GAMS support may need the complete model. There may be an issue with confidentiality. A model may contain:

  • confidential data
  • confidential data structures (equation, parameter, variable names)
  • confidential comments which the developer may wish to hide.

GAMS has several utilities, which aid in conversion into scalar format and the removal of confidential information. In particular, GAMS/CONVERT is a utility which transforms a GAMS model instance into formats used by other modeling and solution systems.

GAMS/CONVERT is designed to achieve the following goals:

  • Permit users to convert a confidential model into GAMS scalar format so that any identifiable structure is removed. It can then be passed on to others for investigation without confidentiality being lost.
  • A way of sharing GAMS test problems for use with other modeling systems or solvers. GAMS/CONVERT comes free of charge with any licensed GAMS system.

Simple Conversion

The GAMS/CONVERT utility can transform a single model instance (from a solve statement) into scalar format. The scalar format removes all confidential information (data and identifiable model data structures). To translate a model into a scalar format removing any identifiable modeling constructs, enter:

    gams mymodel.gms [modeltype]=convert

where [modeltype] is the model type used (LP, NLP, MIP, etc.). If you have hard coded the solver inside your GAMS model via an option statement like option LP=bdmlp; or need to solve other models before the model instance you want to convert you should not set the [modeltype]=convert command line option, but add the run time option option [modeltype]=convert; in front of the solve statement of the model instance you want to convert. This will generate a scalar model called gams.gms which can be submitted to GAMS support or others without divulging any confidential information. Below is an example output generated from the trnsport model of the GAMS model library using the default settings:

*  LP written by GAMS Convert at 02/08/08 11:45:21
*  Equation counts
*      Total        E        G        L        N        X        C
*          6        1        3        2        0        0        0
*  Variable counts
*                   x        b        i      s1s      s2s       sc       si
*      Total     cont   binary  integer     sos1     sos2    scont     sint
*          7        7        0        0        0        0        0        0
*  FX      0        0        0        0        0        0        0        0
*  Nonzero counts
*      Total    const       NL      DLL
*         19       19        0        0
*  Solve m using LP minimizing x7;

Variables  x1,x2,x3,x4,x5,x6,x7;

Positive Variables  x1,x2,x3,x4,x5,x6;

Equations  e1,e2,e3,e4,e5,e6;

e1..  - 0.225*x1 - 0.153*x2 - 0.162*x3 - 0.225*x4 - 0.162*x5 - 0.126*x6 + x7
      =E= 0;

e2..    x1 + x2 + x3 =L= 350;

e3..    x4 + x5 + x6 =L= 600;

e4..    x1 + x4 =G= 325;

e5..    x2 + x5 =G= 300;

e6..    x3 + x6 =G= 275;

* set non default bounds

* set non default levels

* set non default marginals

Model m / all /;

m.limrow=0; m.limcol=0;

Solve m using LP minimizing x7;

Customized Scalar Model Output

CONVERT allows customized scalar model output by making use of options. Please consult the CONVERT options in the CONVERT user guide for details.

To do so, the user must make a solver option file called convert.opt (or similarly using the GAMS option file naming conventions). As usual, the user must tell GAMS to use this option file, either by specifying

    gams mymodel.gms [modeltype]=convert optfile=1

from the command line, or

    mymodel.optfile = 1; option [modeltype]=convert;

before the solve statement in the model.

Custom scalar model name

The default scalar model created is called gams.gms. In order to generate a scalar model with a different name, specify gams mymodel.gms in the convert.opt option file. The resulting output file will be called mymodel.gms.

Terminate GAMS after solve

Models may consist of several solves, whereas the user may wish to obtain the scalar model only from a single particular solve. The CONVERT option terminate causes GAMS to abort once the solve is complete. To do so, specify terminate in the convert.opt option file. GAMS will then terminate after the solve (and resulting scalar model conversion) is completed. Note that it may be necessary to specify different solvers before previous solves and then specify CONVERT as the solver only for the particular solve for which one wishes to obtain a scalar model.

Renaming the objective variable in the scalar model

By default, the scalar variable is called x1, x2, x3, or similar. If the user wishes to rename the objective variable to something more identifiable, the user can do so by specifying ObjVar myobj in the convert.opt option file. The resulting objective variable will then be called myobj. If the user only specifies ObjVar, the default is objvar.

Mapping scalar data structure names to original model names

The scalar model uses data structures called x1, x2, x3,... for variables and eq1, eq2, eq3,... for equations. The user may wish to know how scalar data structures are mapped to the original variable and equation names. For example, GAMS support may identify infeasibilities in a particular scalar equation, which the user needs to identify in the original (non-scalar) model. To do so, CONVERT has an option called Dict. Specifying Dict mydict.txt in the convert.opt option file will generate a dictionary file called mydict.txt containing the mapping information. If only Dict is specified, the default file name is dict.txt. A sample dictionary file, obtained from running CONVERT on the transportation model ([[|trnsport.gms]]) is given below:

LP written by GAMS Convert at 02/08/08 11:56:03

Equation counts
    Total        E        G        L        N        X        C
        6        1        3        2        0        0        0

Variable counts
                 x        b        i      s1s      s2s       sc       si
    Total     cont   binary  integer     sos1     sos2    scont     sint
        7        7        0        0        0        0        0        0
FX      0        0        0        0        0        0        0        0

Nonzero counts
    Total    const       NL      DLL
       19       19        0        0

Equations 1 to 6
  e1  cost
  e2  supply(seattle)
  e3  supply(san-diego)
  e4  demand(new-york)
  e5  demand(chicago)
  e6  demand(topeka)

Variables 1 to 7
  x1  x(seattle,new-york)
  x2  x(seattle,chicago)
  x3  x(seattle,topeka)
  x4  x(san-diego,new-york)
  x5  x(san-diego,chicago)
  x6  x(san-diego,topeka)
  x7  z

Non-disclosure agreement

We are happy to sign a non-disclosure agreement (NDA), also known as a confidentiality agreement (CA), in case this is required.