.. _method-npsol_sqp-scaling:

"""""""
scaling
"""""""


Turn on scaling for variables, responses, and constraints



**Topics**


method_independent_controls


.. toctree::
   :hidden:
   :maxdepth: 1



**Specification**

- *Alias:* None

- *Arguments:* None

- *Default:* no scaling


**Description**


Some optimization and calibration methods support scaling of
continuous design variables, objective functions, calibration terms,
and constraints.  This is activated with the ``scaling`` keyword.
Discrete variable scaling is not supported.

When scaling is enabled, variables, functions, gradients, Hessians,
etc., are transformed such that the method iterates in scaled variable
space, whereas evaluations of the computational model as specified in
the interface are performed on the original problem scale.  Therefore
using scaling does not require rewriting the interface to the
simulation code.

Scaling also requires the specification of additional keywords
``*scale_types`` and/or ``*scales`` in the :dakkw:`variables` and
:dakkw:`responses` blocks.  When the ``scaling`` keyword is omitted from
:dakkw:`method`, these scaling type and value specifications are ignored in the
variables and responses sections.

This page describes the usage of all scaling related keywords.  The
additional keywords come in pairs, one pair for each set of quantities
(variables, primary responses, or constraints) to be scaled.

- a ``*scales`` keyword, which gives characteristic values (divisors)
- a ``*scale_types`` keyword, which determines how to use the   characteristic values

The pair of keywords both take argument(s), and the length of the
arguments can be either be one or equal to the number of quantities to
be scaled (see details in :dakkw:`responses` for lengths when field
responses are active).  If one argument is given, it will apply to all
quantities in the set. See the examples below.

*Scale Types*

There are three scale types:


1. ``value`` - characteristic value scaling The target quantity will be scaled (divided) by the specified characteristic value.


2. ``auto`` - automatic scaling First the quantity is scaled by any characteristic value, then automatic scaling will be attempted according to the following scheme:



  - two-sided bounds scaled into the interval [0,1];

  - one-sided bound or targets are scaled by the characteristic value, moving the bound or target to 1 and changing the sense of inequalities where necessary;

  - no bounds or targets: no automatic scaling possible, therefore no scaling for this component Automatic scaling is not available for objective functions nor calibration terms since they lack bound constraints. Futher, when automatically scaled, linear constraints are scaled by characteristic values only, not affinely scaled into [0,1].

3. ``log`` - logarithmic scaling First, any characteristic values from the optional ``*_scales`` specification are applied. Then logarithm base 10 scaling is applied. Logarithmic scaling is not available for linear constraints. When continuous design variables are log scaled, linear constraints are not allowed.




*Scales*

The ``*scales`` keywords are used to specify the characteristic values.
These must be non-zero real numbers. The numbers are used according to
the corresponding ``*scale_types``, as described above. A value of 1.0
can be used to selectively omit some quantities in a vector from being
scaled.

Depending on the scale type, the characteristic values may be required or
optional.

- ``auto``, ``log`` - optional
- ``value`` - required.

A warning is issued if scaling would result in division by a value
smaller in magnitude than <tt>1.0e10*DBL_MIN</tt>.  User-provided
values violating this lower bound are accepted unaltered, whereas for
automatically calculated scaling, the lower bound is enforced.



**Examples**


The two examples below are equivalent:

.. code-block::

      responses
        objective_functions 3
        sense "maximize"
        primary_scale_types = "value"
        primary_scales = 1 1 100



.. code-block::

      responses
        objective_functions 3
        sense "maximize"
        primary_scale_types = "value" "value" "value"
        primary_scales = 1 1 100




