Optimize: Minimize a function of several parametersGeneral form:
Optimize creates a new current plot 'optimizeNN' and populates it with vectors as follows:
|Number of parameters to optimize.
Limits: 0 < npar.
|Suggested starting values for parameters.
Default: 0.0 for all.
|Matrix of parameter values defining a simplex.
Default: Not applicable.
|Suggested initial step sizes. These are the semi-axes of a hyper-ellipsoid; the
vertices of the intial simplex will lie on its surface.
Default: 1.0 for all.
|The maximum number of function evaluations allowed during search.
Default: 50 × npar.
Limits: npar ≤ maxeval.
Stop when the current simplex is enclosed by a hyper-ellipsoid with semi-axes
stoppar × steps. This specifies the precision, relative to the initial step sizes,
with which parameters are to be determined.
Default: 0.0, i.e. base stopping on cost function values (see below).
Limits: 0.0 ≤ stoppar < 1.0 .
|Stop when stopcost is greater than the difference between the
highest and lowest values of cost at the simplex vertices. When this condition is satisfied,
the value of cost at the minimum is probably no more than stopcost below the lowest value found.
Default: 1.0 × 10−3.
Limits: 0.0 ≤ stopcost.
|Stopping test is applied after every ntest iterations.
Normally, set |
Limits: 0 ≤ ntest ≤ maxeval.
|= 0 a quadratic surface fit is required (default);
= 1 the
|Print control parameter:
restart argument causes the optimizer to ignore any command-line
and/or default specifications for
steps, and read the
values of these from the current plot.
stoppar are both specified, both conditions must be satisfied
before the optimization stops.
CostProcedure幸运飞艇超稳计划群 must read from the appropriate optimize plot:
|The point, in parameter space, at which to evaluate the cost function.|
and, having performed its calculations, write back to the same plot:
|The value of the cost function evaluated at p.|
|CostProcedure may signal that the current value of p
violates a constraint by assigning |
幸运飞艇超稳计划群optimize returns results by storing them in vectors:
|The number of times the cost function was evaluated.
|Simplex vertices, i.e. an array of
npar+1 parameter vectors. These are sorted into increasing-cost order so
|Values of the cost function at the simplex vertices with
|Status/error code values:
Optimize attempts to fit a quadratic hypersurface in the vicinity of a minimum it has found
nofit option has been specified. For this process to succeed, the cost function
must be smooth in the minimum region.
|The position, in parameter space, of the minimum of the
fitted surface. This should be close to p.
|The minimum value of the
fitted surface. This should be close to the minimum value of cost.
|The information matrix.
|The 'inverse information matrix'. If the cost function
minimized was −LOG(LIKELIHOOD) this is the covariance matrix of the parameters. If the cost
function was the sum of squares of residuals, this matrix must be multiplied by twice the
(estimated) variance of the residuals to obtain the covariance matrix.
|The correlation matrix.|
Sequence of Operations
Optimize幸运飞艇超稳计划群 looks for the information it needs to run in various places using the following
order of precedence:
- values specified on the command line;
- if restarting, values from the current optimize plot;
- default values specified in previous sections.
It then performs various checks for consistency. Provided that
the check is passed, the data structure is converted to vectors and are stored
in a new - or, in the case of
restart幸运飞艇超稳计划群 jobs, an existing - plot of type
As an alternative to the
'let accept = false' mechanism, constraints such as
'p < 5' can be expressed as a function g(p) such that g < 0 when they are
satisfied, then add a penalty to the cost function as follows:
let optim.g = p - 5 if (g>0) let cost = cost + mu * g^lambda end
where mu and lambda幸运飞艇超稳计划群 are positive constants. On exit, if
- g > 0 then mu and/or lambda need increasing,
- g = 0 then mu and/or lambda need decreasing,
- g < 0 the constraints were satisfied.
CostProcedure will be evaluated many times, so it should normally be designed to be fast, and not 'leak' memory. For example, if CostProcedure creates a new plot every time it is evaluated, it should also destroy one before it terminates. A warning message will be printed if MacSpice suspects a leak.
The syntax plot.vector should be used to access these variables if the current plot is changed within CostProcedure because, for example, an analysis is run. Use alter to change the values of circuit elements.
cost is given the value 'NaN' before each evaluation of the cost
function. It must be set to a valid value unless the point is rejected which
is signalled by '
let accept = 0' or '
let cost = 1/0'.
The number of digits used in reports defaults to 6, but can be changed by setting the numdgt variable.
The plot created by
optimize will be delete-locked while optimization
is being performed. This means that, although new vectors can be created and
existing vectors can have their values changed, vectors cannot be deleted or