solver:some_notes_on_scaling

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision | ||

solver:some_notes_on_scaling [2007/10/20 07:16] Franz Nelissen |
— (current) | ||
---|---|---|---|

Line 1: | Line 1: | ||

- | ====== Some Notes on Scaling ====== | ||

- | Contributed by [[mailto:adrud@arki.dk|Arne Drud]] to the [[http://www.gams.com/maillist/gams_l.htm|GAMS-User List]]: If you look at the equation listing for your model you will see: | ||

- | <code> | ||

- | ---- E_DHEDGE =E= | ||

- | |||

- | E_DHEDGE.. - (2.581140E+7)*X(1) - D_HDG =E= 0 ; | ||

- | |||

- | (LHS = 4.1541556E+9, INFES = 4.1541556E+9 ***) | ||

- | </code> | ||

- | 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 | ||

- | <code> | ||

- | E_HEDGE .. D_HDG =E= TARGET; | ||

- | </code> | ||

- | so you will also need | ||

- | <code> | ||

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

- | </code> | ||

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

- | <code> | ||

- | Hedge.scaleopt = 1; | ||

- | </code> |

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