solver:some_notes_on_scaling

**This is an old revision of the document!**

Contributed by Arne Drud to the GAMS-User List: If you look at the equation listing for your model you will see:

---- E_DHEDGE =E= E_DHEDGE.. - (2.581140E+7)*X(1) - D_HDG =E= 0 ; (LHS = 4.1541556E+9, INFES = 4.1541556E+9 ***)

Nonlinear models can be hard to solve if terms and derivatives are very large. And 2.8e7 = 28 million is very large. 4.15e9 is very very large.

You can scale the model using the `.scale`

and `.scaleopt`

feature in GAMS. The objective is to get derivatives that are not too much over one in absolute value. The equation scale is selected to be of the order of the largest derivative or term in the equation, for example `e_dhedge.scale = 1.e6;`

The equation says `d_hdg =e= …`

and in order to preserve the coefficient 1 for `d_hdg`

you must also have `d_hdg.scale = 1.e6;`

Now `d_hdg`

is scaled and it appears in

E_HEDGE .. D_HDG =E= TARGET;

so you will also need

e_hedge.scale = 1.e6; target.scale = 1.e6;

And finally you must tell GAMS to use scaling with the statement

Hedge.scaleopt = 1;

IMPRESSUM / LEGAL NOTICE
PRIVACY POLICY
solver/some_notes_on_scaling.1192857406.txt.gz · Last modified: 2007/10/20 07:16 by Franz Nelissen