Model

Top  Previous  Next

Once all the model structural elements have been defined then one employs a MODEL statement to identify models that will be solved.  Such statements occur in the each of the three example models:

 

MODEL farmPROBLEM /ALL/;(optimize.gms)

 

MODEL PROBLEM /Pdemand.Qd, Psupply.Qs,Equilibrium.P/;(econequil.gms)

 

Model wall / all / ;(nonlinsys.gms)

Notes:

The general form of these statements are

         Model modelname  optional explanatory text / model  contents/ ;

 where

Model or models is required

a modelname follows that can be up to 63 characters long as discussed in the Rules for Item Names, Element names and Explanatory Text chapter

the optional explanatory text is up to 255 characters long as discussed in the Rules for Item Names, Element names and Explanatory Text chapter

the model contents are set off by beginning and ending slashes and can either be the keyword all including all equations, a list of equations, or a list of equations and complementary variables.  Each of these is discussed in the following bullets.

a ; ends the statement

 

In the Model Statement in the model contents field

         Using /ALL/ includes all the equations.

         One can list equations in the model statement like that below.

         MODEL FARM /obj, Land,labor/;

 

 and one does not need to list all the equations listed in the Equations statements.  Thus, in (optimize.gms), one could omit the constraints called labor from the model

         MODEL ALTPROBLEM / obj,land/;

 

The equilibrium problems are solved as Mixed complementarity problems (MCP) and require a special variant of the Model statement.  Namely in such problems there are exactly as many variables as there are equations and each variable must be specified as being complementary with one and only one equation. The model statement expresses these constraints indicating the equations to be included followed by a period(.) and the name of the associated complementary variables as follows

         MODEL PROBLEM /Pdemand.Qd, Psupply.Qs,Equilibrium.P/;        (econequil.gms)

 

 which imposes the complementary relations from our equilibrium problem above.

All equations in the model which are named and any data included must have been specified in .. notation before this model can be used (in a later solve statement).
Users may create several models in one run each containing a different set of equations and then solve those models and separately.