Solve: Maximizing, Minimizing, and Using

Top  Previous  Next

Various types of problems can be solved with GAMS.  The type of the model must be specified so GAMS can choose the appropriate solver to use as must some information about the model, and, if relevant, direction of optimization.  This is done through a Solve statement.  The general syntax for the Solve statement depends on model type and is

For optimization model types (LP, NLP, MIP, MINLP etc.) the Solve is one of the following 4 forms

 

Solve model name maximizing var name using model type ;

Solve model name minimizing var name using model type ;

Solve model name using model type maximizing var name ;

Solve model name using model type minimizing var name ;

 

while for MCP and CNS model types which involve solution of equations systems we use

 

Solve model name using model type ;

where

model name is the name of a model specified in a Model statement somewhere earlier in the program.
the key word maximizing or minimizing is used to identify the direction of optimization.
var name is the name of an unrestricted in sign variable (free or one declared as a variable only) which is declared and in a .. equation specification for at least one equation in the model and is the item to be maximized or minimized. Often such variables must be added as covered in the Tutorial chapter.
model type which is one of the following types of problems.

 

GAMS model type

Model Type Description

Requirement

LP

Linear Program

Optimization problem which cannot contain nonlinear terms or discrete (binary or integer) variables

NLP

Non Linear Program

Optimization problem which contains smooth nonlinear terms, but not discrete (binary or integer) variables

DNLP

Discontinuous Non Linear Program

Optimization problem which contains non smooth nonlinear terms with discontinuous derivatives, but not discrete (binary or integer) variables

MIP

Mixed Integer Program

Optimization problem which contains discrete (binary or integer) variables, but does not contain nonlinear terms

RMIP

Relaxed Mixed Integer Program

Optimization problem which contains binary, integer, SOS and/or semi variables, but does not contain nonlinear terms and has discrete/SOS/Semi variable requirement relaxed

MINLP

Mixed Integer Nonlinear Program

Optimization problem which contains smooth nonlinear terms and discrete (binary or integer) variables

RMINLP

Relaxed Mixed Integer Nonlinear Program

MINLP optimization problem with the binary and integer restrictions relaxed

MPEC

Mathematical Programs with Equilibrium Constraints

A difficult problem type for which solvers are just now under development and is the subject of a section on gamsworld.org.

MCP

Mixed Complementarity Problem

A problem solving a nonlinear system of equations which contains one to one complementary relationships between all of an equal number of variables and equations

CNS

Constrained Nonlinear System

A problem solving a square, possibly nonlinear system of equations, with an equal number of non-fixed variables and constraints

MPSGE

General Equilibrium

Not actually a model type but mentioned for completeness see mpsge.pdf

EMP

Extended Mathematical Program

A family of mathematical programming extensions.

 

The exact form of these problem types is discussed in the Model Types and Solvers chapter.

Examples:

(model.gms , mcp.gms , korcns.gms , resource.gms)

Solve warehousel2 using MIP minimizing tcost;

Solve qp6 using MCP;

Solve model1 using cns;

Solve resalloc using lp maximizing profit;