|
Models are objects that GAMS solves. They are collections of the specified equations and contain variables along with the upper and lower bound attributes of the variables. The model statement identifies and labels them so that they can be solved. Three fundamental types of models can be identified.
| 1 | Optimization models (LP, NLP, MIP, MINLP, ...) where the model statement identifies the equations present in the model. |
| 2 | Simultaneous systems of equations (CNS) that are to be solved where the model statement identifies the equations present in the model. |
| 3 | Mixed complementary problems (MCP) where the model statement identifies the equations present in the model and their complementary relationships with the problem variables. |
The basic form of the model statement is
Model Modelname optional explanatory text / model contents /;
or
Models Modelname optional explanatory text / model contents /;
Notes:
| • | Model or Models can be used interchangeably. |
| • | More than one named model is definable under a single Model statement separated by commas or line feeds with a semicolon terminating the total statement. |
| • | Model contents can be defined in several different ways. |
| — | The notation /all/ includes all equations seen before the model statement within the named model. (model.gms) |
Model warehousel Warehouse location model /all/;
| — | In optimization and nonlinear system models one can list the equations to be included as follows (model.gms) |
Model warehousel2 Warehouse location model
/tcosteq,supplyeq,demandeq,balance,capacity,configure/;
| — | One may include the names of models that were previously defined. Thus for example: |
Model one first model / e1,e2,e3 /
two second model that nests first / one, e4 /
three third model that nests first and second / two, e5 /;
In turn model two will now contain equations e1,e2,e3,e4 while model three will contain all of model two plus equation e5.
Model qp6 Michael Ferris example of MCP
/ d_x●x, d_w●w, retcon●m_retcon,
budget●m_budget, wdef●m_wdef /;
where the notation has
equation name●complementary variable name
| • | In MCP models one can use the /all / notation to add all equations and match up complementary variables provided that all the equations are of the form =e= or =n= and the variables are all free with the problem being square with free variables defined with exactly matching subscripts for each equation (kormcp.gms). However this is somewhat risky as the model does not choose variables that are really related to equations and much of the problem structure is not conveyed to the solver. It is generally better to specify the complementary pairs in the model statement. |
| • | In MCP problems one need only define part of the complementary relations and the remaining ones can be filled in by GAMS and the solvers providing a free variable can be found for each of the remaining equations and that the system is square. The equation names and possible complementary variable names included in the model contents specification need to be named variables and equations. Again, this is risky. |
| • | Set membership is not included in the model contents field. |
| • | The terms in an equation are recomputed every time a solve statement is executed as discussed in the Calculating Items chapter. |
| • | The MCP problem structure imposes particular requirements on specification of the equations in the problem. |
| — | It is always acceptable to write the equations defining the problem with =N= relations. In this case, the sign of the associated equation is implied by the equation/variable matching and the variable bounds. |
| — | If a variable is complementary with an equation and that variable has lower bounds only (e.g if the variable in GAMS terms is a positive variable) then it is acceptable to write the complementary equation with =G= relations, since this is consistent with the constraint implied by the lower bound on the variable. |
| — | A variable bounded only above can be matched with =L= equations. |
| — | Free variables without bounds can be matched with =E= equations. |
These restrictions are elaborated on in the Model Types and Solvers chapter.
|