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.

128 CONOPT<br />

delta. <strong>The</strong> error is reduced to approximately SQR(delta)/2 for f(x) = 1. <strong>The</strong> second derivative is 1/delta at f(x)<br />

= 0 (excluding terms related to the second derivative of f(x)). A delta value between 1.e-3 and 1.e-4 should in<br />

most cases be appropriate. It is possible to use a larger value in an initial optimization, reduce it and solve the<br />

model again. You should note, that if you reduce delta below 1.e-4 then large second order terms might lead to<br />

slow convergence or even prevent convergence.<br />

<strong>The</strong> approximation shown above has its largest error when f(x) = 0 and smaller errors when f(x) is far from<br />

zero. If it is important to get accurate values of ABS exactly when f(x) = 0, then you may use the alternative<br />

approximation<br />

SQRT( SQR(f(x)) + SQR(delta) ) - delta<br />

instead. <strong>The</strong> only difference is the constant term. <strong>The</strong> error is zero when f(x) is zero and the error grows to -delta<br />

when f(x) is far from zero.<br />

Some theoretical work uses the Huber, H(*), function as an approximation for ABS. <strong>The</strong> Huber function is<br />

defined as<br />

H(x) = x for x > delta,<br />

H(x) = -x for x < -delta and<br />

H(x) = SQR(x)/2/delta + delta/2 for -delta < x < delta.<br />

Although the Huber function has some nice properties, it is for example accurate when ABS(x) > delta, it is not<br />

so useful for <strong>GAMS</strong> work because it is defined with different formulae for the three pieces.<br />

A smooth <strong>GAMS</strong> approximation for MAX(f(x),g(y)) is<br />

( f(x) + g(y) + SQRT( SQR(f(x)-g(y)) + SQR(delta) ) )/2<br />

where delta again is a small scalar. <strong>The</strong> approximation error is delta/2 when f(x) = g(y) and decreases with the<br />

difference between the two terms. As before, you may subtract a constant term to shift the approximation error<br />

from the area f(x) = g(y) to areas where the difference is large. <strong>The</strong> resulting approximation becomes<br />

( f(x) + g(y) + SQRT( SQR(f(x)-g(y)) + SQR(delta) ) - delta )/2<br />

Similar smooth <strong>GAMS</strong> approximations for MIN(f(x),g(y)) are<br />

and<br />

( f(x) + g(y) - SQRT( SQR(f(x)-g(y)) + SQR(delta) ) )/2<br />

( f(x) + g(y) - SQRT( SQR(f(x)-g(y)) + SQR(delta) ) + delta )/2<br />

Appropriate delta values are the same as for the ABS approximation: in the range from 1.e-2 to 1.e-4.<br />

It appears that there are no simple symmetric extensions for MAX and MIN of three or more arguments or for<br />

indexed SMAX and SMIN.<br />

7.4 Are DNLP Models Always Non-smooth<br />

A DNLP model is defined as a model that has an equation with an ABS, MAX, or MIN function with endogenous<br />

arguments. <strong>The</strong> non-smooth properties of DNLP models are derived from the non-smooth properties of these<br />

functions through the use of the chain rule. However, composite expressions involving ABS, MAX, or MIN can<br />

in some cases have smooth derivatives and the model can therefore in some cases be smooth.<br />

One example of a smooth expression involving an ABS function is common in water systems modeling. <strong>The</strong><br />

pressure loss over a pipe, dH, is proportional to the flow, Q, to some power, P. P is usually around +2. <strong>The</strong> sign<br />

of the loss depend on the direction of the flow so dH is positive if Q is positive and negative if Q is negative.

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

Saved successfully!

Ooh no, something went wrong!