GAMS Support Wiki

Site Tools

solver:some_notes_on_scaling

Differences

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

 solver:some_notes_on_scaling [2007/09/21 16:00]127.0.0.1 external edit — (current) 2020/10/21 15:05 Atharv Bhosekar removed2007/10/20 07:16 Franz Nelissen 2007/09/21 16:00 external edit Next revision Previous revision 2020/10/21 15:05 Atharv Bhosekar removed2007/10/20 07:16 Franz Nelissen 2007/09/21 16:00 external edit Line 1: Line 1: - ====== Some Notes on Scaling ====== - Contributed by Arne Drud: 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 ***) - ​ - 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; - ​ - so you will also need - <​code>​ - e_hedge.scale = 1.e6; target.scale = 1.e6; - ​ - And finally you must tell GAMS to use scaling with the statement - <​code>​ - Hedge.scaleopt = 1; -