# GAMS Support Wiki

### Site Tools

gams:the_scale_option_for_nlp_problems

# The SCALE Option for NLP problems

The rules for good scaling are exclusively based on algorithmic needs. GAMS has been developed to increase the efficiency of modellers, and one of the best ways seems to be to encourage modellers to write their models using a notation that is as 'natural' as possible. The units of measurement are one part of this natural notation, and there is unfortunately a potential conflict between what the modeler thinks is a good unit and what constitutes a well scaled model.

To facilitate the translation between a natural model and a well scaled model, GAMS has introduced the concept of a scale factor, both for variables and equations. The notations and definitions are quite simple. First of all, scaling is turned off by default. The GAMS statement to turn it on is

`   modelname.SCALEOPT = 1 ;`

where modelname is the name of the model specified in the model statement. For example,

```   MODEL M /ALL/ ;
M.SCALEOPT = 1 ;
SOLVE M USING NLP MAXIMIZING DOLLARS ;```

The statement should be inserted somewhere after the MODEL statement and before the SOLVE statement. In order to turn scaling off again, set the modelname.SCALEOPT parameter to 0 before the next solve. The scale factor of a variable or an equation is referenced with the suffix `.SCALE`, i.e. the scale factor of variable `X(I)` is referenced as `X.SCALE(I)`. Note that there is one scale value for each individual component of a multidimensional variable or equation. Scale factors can be defined using assignment statements. The default scale factor is always 1. The scale factor on a variable, `Vs`, is used to relate the variable as seen by the user, `Vu`, to the variable as seen by the algorithm, `Va`, as follows:

`   Vu = Va*Vs`

Similarly, the scale factor on an equation, `Gs`, is used to relate the equation as seen by the user, `Gu`, to the equation as seen by the algorithm, `Ga`, as follows:

`   Gu = Ga*Gs`

The derivatives in the scaled model seen by the algorithm, i.e `d(Ga)/d(Va)` are related to the derivatives in the user's model, `d(Gu)/d(Vu)` through the formula:

`   d(Ga)/d(Va) = d(Gu)/d(Vu) * (Vs/Gs)`

Upper and lower bounds on variables are automatically scaled in the same way as the variable itself. Integer and binary variables cannot be scaled. GAMS scaling is in most respects hidden from the user. The solution values reported back from a solution algorithm are always reported in the user's notation. The algorithm's versions of the equations and variables are only reflected in the derivatives in the equation and column listings in the GAMS output if the options `LIMROW` and `LIMCOL` are positive, and the debugging output from the solution algorithm generated with `OPTION SYSOUT = ON`.

Furthermore, note that there is a chapter on scaling in the CONOPT manual . 