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.

CONOPT 125<br />

on the left hand side, and scale factors, both from variables and equations, can be used on the right hand side,<br />

for example to define other scale factors. <strong>The</strong> default scale factor is always 1, and a scale factor must be positive;<br />

<strong>GAMS</strong> will generate an execution time error if the scale factor is less than 1.e-20.<br />

<strong>The</strong> mathematical definition of scale factors is a follows: <strong>The</strong> scale factor on a variable, V s is used to related the<br />

variable as seen by the modeler, V m , to the variable as seen by the algorithm, V a , as follows:<br />

V m = V a ∗ V s<br />

This means, that if the variable scale, V s , is chosen to represent the order of magnitude of the modeler’s variable,<br />

V m , then the variable seen by the algorithm, V a , will be around 1. <strong>The</strong> scale factor on an equation, G s , is used<br />

to related the equation as seen by the modeler, G m , to the equation as seen by the algorithm, G a , as follows:<br />

G m = G a ∗ G s<br />

This means, that if the equation scale, G s , is chosen to represent the order of magnitude of the individual terms<br />

in the modelers version of the equation, G m , then the terms seen by the algorithm, G a , will be around 1.<br />

<strong>The</strong> derivatives in the scaled model seen by the algorithm, i.e. dG a /dV a , are related to the derivatives in the<br />

modelers model, dG m /dV m , through the formula:<br />

dG a /dV a = dG m /dV m ∗ V s /G s<br />

i.e. the modelers derivative is multiplied by the scale factor of the variable and divided by the scale factor of the<br />

equation. Note, that the derivative is unchanged if V s = G s . <strong>The</strong>refore, if you have a <strong>GAMS</strong> equation like<br />

G .. V =E= expression;<br />

and you select G s = V s then the derivative of V will remain 1. If we apply these rules to the example above with<br />

an intermediate variable we can get the following automatic scale calculation, based on an ”average” reference<br />

value for X:<br />

SCALAR XREF; XREF = 6;<br />

Y.SCALE = SUM(P, A(P)*POWER(XREF,ORD(P)-1));<br />

YDEF.SCALE = Y.SCALE;<br />

or we could scale Y using values at the end of the X interval and add safeguards as follows:<br />

Y.SCALE = MAX( ABS(SUM(P, A(P)*POWER(X.LO,ORD(P)-1))),<br />

ABS(SUM(P, A(P)*POWER(X.UP,ORD(P)-1))),<br />

0.01 );<br />

Lower and upper bounds on variables are automatically scaled in the same way as the variable itself. Integer<br />

and binary variables cannot be scaled.<br />

<strong>GAMS</strong>’ scaling is in most respects hidden for the modeler. <strong>The</strong> solution values reported back from a solution<br />

algorithm, both primal and dual, are always reported in the user’s notation. <strong>The</strong> algorithm’s versions of the<br />

equations and variables are only reflected in the derivatives in the equation and column listings in the <strong>GAMS</strong><br />

output if OPTION LIMROW and/or LIMCOL are positive, and in debugging output from the solution algorithm,<br />

generated with OPTION SYSOUT = ON. In addition, the numbers in the algorithms iteration log will represent the<br />

scaled model: the infeasibilities and reduced gradients will correspond to the scaled model, and if the objective<br />

variable is scaled, the value of the objective function will be the scaled value.<br />

A final warning about scaling of multidimensional variables is appropriate. Assume variable X(I,J,K) only appears<br />

in the model when the parameter IJK(I,J,K) is nonzero, and assume that CARD(I) = CARD(J) = CARD(K)<br />

= 100 while CARD(IJK) is much smaller than 100**2 = 1.e6. <strong>The</strong>n you should only scale the variables that appear<br />

in the model, i.e.

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

Saved successfully!

Ooh no, something went wrong!