EMP models are defined by both the usual content of a GAMS model and annotations found in a simple text file named emp.info
(aka the EMP info file). It is often most convenient to create this file via the GAMS put writing facility. The annotations primarily serve to define the model (e.g. to specify that a variable u
is really the dual multiplier for a constraint g
) but can also specify how a solver should process the model. The annotations make use of EMP keywords to do this.
A simple example will serve as illustration. Consider the following NLP:
\begin{equation} \tag{1} \begin{array}{lll} \textrm{Min}_{x,y,z} & -3x + xy \\ \text{s.t.} & x + y \leq 1 \\ & x + y - z = 2 \\ & x, y \geq 0 \\ \end{array} \end{equation}
We will use EMP annotations to automatically generate the first order conditions (KKT conditions) of this NLP and thus reformulate the NLP as an MCP:
Variables f, z;
Positive Variables x, y;
Equations g, h, defobj;
g.. x + y =l= 1;
h.. x + y - z =e= 2;
defobj.. f =e= -3*x + x*y;
Model comp / defobj, g, h /;
File info / '%emp.info%' /;
putclose info / 'modeltype mcp';
solve comp using EMP minimizing f;
Observe that the model is defined in the usual way and the file emp.info
contains just one line: modeltype mcp
. The EMP keyword modeltype
indicates that the value following the keyword is the model type to be used for the reformulation. In this example the model type is mcp
. Here this specification is required: the sole point of our EMP annotations is to generate an MCP and not (as is usually the case) to define the model. Usually, the model algebra and annotations together imply the type of the reformulated model and so no modeltype
specification is required or wanted. Finally, note that the model type in the solve statement is EMP:
this is typical.
The solver JAMS implements the EMP framework. It processes the model and the annotations, automatically reformulates the original EMP model as a model of a different (more easily solved) type, passes the reformulated model on to an appropriate subsolver, and maps the resulting solution back into the original problem space.
In case users wish to inspect the (scalar) reformulated model, the JAMS option FileName
may be used to specify the name of the file containing this model. Adding the following lines before the solve statement in the GAMS code above will cause the MCP reformulation to be saved in the file myReform.gms
.
File empopt / 'jams.opt' /;
comp.optfile = 1;
putclose empopt / 'FileName myReform.gms';
The listing file will contain some additional information - the EMP Summary - as part of the output for each EMP model solved. We provide details on the EMP summary for each reformulation that we discuss below.