Solve

Top  Previous  Next

Once one believes that the model is ready in such that it makes sense to find a solution for the variables then the solve statement comes into play.  The SOLVE statement causes GAMS to use a solver to optimize the model or solve the embodied system of equations.

 

SOLVE farmPROBLEM USING LP MAXIMIZING Z;(optimize.gms)

 

SOLVE PROBLEM USING MCP;(econequil.gms)

 

Solve wall using nlp minimizing ba;(nonlinsys.gms)

Notes:

The general forms of these statements for models with objective functions are

         Solve modelname using modeltype maximizing variablename ;

         Solve modelname using modeltype minimizing variablename ;

 

 and for models without objective functions is

         Solve modelname using modeltype;

 where

Solve is required

a modelname follows that must have already been given this name in a Model statement

using is required

the modeltype is one of the known GAMS model types where

 

models with objective functions are

LP for linear programming

NLP for nonlinear programming

MIP for mixed integer programming

MINLP for mixed integer non linear programming

plus RMIP, RMINLP, DNLP, MPEC as discussed in the chapter on Model Types and Solvers.

 

models without objective functions are

MCP for mixed complementary programming

CNS for constrained nonlinear systems

maximizing or minimizing is required for all optimization problems (not MCP or CNS problems)

a variablename to maximize or minimize is required for all optimization problems (not MCP or CNS problems) and must match with the name of a variable defined as free or just as a variable.

a ; ends the statement

The examples statement solve three different model types

a linear programming problem ("using LP").

a mixed complementary programming problem ("using MCP").

a non linear programming problem ("using NLP").

GAMS does not directly solve problems.  Rather it interfaces with external solvers developed by other companies.  This requires special licensing arrangements to have access to the solvers.  It also requires that, for the user to use a particular solver, it already must have been interfaced with GAMS.  A list of the solvers currently interfaced is covered in the Model Types and Solvers chapter.