« Previous « Start » Next »
8 Approximation of Derivatives
8.1 Numerical differenatiaion in using TOMNET.
This section about derivatives is particulary important from a
practical point of view. It often seems to be the case that either
it is nearly impossible or the user has difficulties in coding the
derivatives.
Observe that the usage depends on which solver is used. Clearly, if
a global solver, such as
glbDirect is used, derivatives are
not used at all and the following sections do not apply. Some
solvers use only first order information.
SNOPT for example
requires this. If a solver requires second order information it is
highly recommended that at least the first order information is
given analytically or the accuracy requested is changed.
Prob.NumDiff and
Prob.ConsDiff could be set to 1 to use
numerical derivatives even when analytical are given (for comparison
purposes).
Calling Syntax
// to restore later
int OriginalNumDiff = Prob.NumDiff;
// Force numerical differentiation
Prob.NumDiff = 1;
solver.Solve(Prob, out result);
// restore to original value
Prob.NumDiff = OriginalNumDiff;
Table
8 describes the differentiation options
available in TOMNET.
Table 8:
The differentiation options in TOMNET.
|
| Problem Member |
Value |
Comments |
|
| |
| Prob.NumDiff |
1 |
TOMNET calculates the gradient. Default if an IFunction is used. |
| |
| Prob.ConsDiff |
1 |
TOMNET calculates the Jacobian of the constraints. Default if an IConstraints is used. |
| |
|
8.2 Numerical differentiation in using the SOL solvers.
The SOL solvers
MINOS ,
NPSOL ,
NLSSOL ,
SNOPT and other solvers include numerical differentiation.
To enable the numerical differentiation an any SOL solver the option
DerivativeLevel is used.
The following values are allowed:
-
3 All objective and constraint gradients are known (default).
- 2 All constraint gradients are known, but some or all components of the objective gradient are unknown.
- 1 The objective gradient is known, but some or all of the constraint gradients are unknown.
- 0 Some components of the objective gradient are unknown and some of the constraint gradients are unknown.
Calling Syntax
This example tells
NPSOL to perform numerical differentiation
of the objective function.
NPSOL solver = new NPSOL();
solver.Options.DerivativeLevel = 2;
« Previous « Start » Next »