16.01.2015 Views

GAMS — The Solver Manuals - Available Software

GAMS — The Solver Manuals - Available Software

GAMS — The Solver Manuals - Available Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PATH 4.6 475<br />

variables x;<br />

equations d_f;<br />

x.lo = 0;<br />

x.up = 2;<br />

d_f.. 2*(x - 1) =e= 0;<br />

model first / d_f.x /;<br />

solve first using mcp;<br />

Figure 28.5: First order conditions as an MCP, first.gms<br />

and equ.l - equ.upper, where equ is the paired equation.<br />

Finally, a summary report is given that indicates how many errors were found. Figure 28.4 is a good case; when<br />

the model has infeasibilities, these can be found by searching for the string “INFES” as described above.<br />

1.3.2 Redefined Equations<br />

Unfortunately, this is not the end of the story. Some equations may have the following form:<br />

LOWER LEVEL UPPER MARGINAL<br />

new-york 325.000 350.000 325.000 0.225 REDEF<br />

This should be construed as a warning from <strong>GAMS</strong>, as opposed to an error. In principle, the REDEF should only<br />

occur if the paired variable to the constraint had a finite lower and upper bound and the variable is at one of those<br />

bounds. In this case, at the solution of the complementarity problem the “equation (=e=)” may not be satisfied.<br />

<strong>The</strong> problem occurs because of a limitation in the <strong>GAMS</strong> syntax for complementarity problems. <strong>The</strong> <strong>GAMS</strong><br />

equations are used to define the function F . <strong>The</strong> bounds on the function F are derived from the bounds on the<br />

associated variable. Before solving the problem, for finite bounded variables, we do not know if the associated<br />

function will be positive, negative or zero at the solution. Thus, we do not know whether to define the equation<br />

as “=e=”, “=l=” or “=g=”. <strong>GAMS</strong> therefore allows any of these, and informs the modeler via the “REDEF”<br />

label that internally <strong>GAMS</strong> has redefined the bounds so that the solver processes the correct problem, but that<br />

the solution given by the solver does not satisfy the original bounds. However, in practice, a REDEF can also occur<br />

when the equation is defined using “=e=” and the variable has a single finite bound. This is allowed by <strong>GAMS</strong>,<br />

and as above, at a solution of the complementarity problem, the variable is at its bound and the function F does<br />

not satisfy the “=e=” relationship.<br />

Note that this is not an error, just a warning. <strong>The</strong> solver has solved the complementarity problem specified by<br />

this equation. <strong>GAMS</strong> gives this report to ensure that the modeler understands that the complementarity problem<br />

derives the relationships on the equations from the bounds, not from the equation definition.<br />

1.4 Pitfalls<br />

As indicated above, the ordering of an equation is important in the specification of an MCP. Since the data of the<br />

MCP is the function F and the bounds l and u, it is important for the modeler to pass the solver the function F<br />

and not −F .<br />

For example, if we have the optimization problem,<br />

then the first order optimality conditions are<br />

min (x − 1)2<br />

x∈[0,2]<br />

0 ≤ x ≤ 2 ⊥ 2(x − 1)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!