幸运飞艇超稳计划群

MacSpice > Optimize Command

Optimize Command

Optimize: Minimize a function of several parameters

General form:
optimize CostProcedure [new|restart] [terse|verbose|report number] [npar number] [maxeval number] [stopcost value] [stoppar value] [ntest number] [vertices {name|matrix|vector|value} ] [steps {name|matrix|vector|value}] [nofit]

Optimize creates a new current plot 'optimizeNN' and populates it with vectors as follows:

npar
 Number of parameters to optimize.
Default: 1.
Limits: 0 < npar.
 
vertices[npar]
 Suggested starting values for parameters.
Default: 0.0 for all.
 
vertices[npar+1][npar]
 Matrix of parameter values defining a simplex.
Default: Not applicable.
 
steps[npar]
 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.
 
maxeval
 The maximum number of function evaluations allowed during search.
Default: 50 × npar.
Limits: nparmaxeval.
 
stoppar
  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 .
 
stopcost
 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.
 
ntest
 Stopping test is applied after every ntest iterations. Normally, set ntest to about npar. Setting ntest to zero prevents any convergence test being made and hence maxeval stops the iteration.
Default: npar.
Limits: 0 ≤ ntestmaxeval.
 
nofit
 = 0 a quadratic surface fit is required (default);
= 1 the nofit flag was on the command line.
 
report
 Print control parameter:
< 0[terse] print no report;
= 0 [default] print parameter values and the cost function value once convergence has been detected;
= 1[verbose] as default plus progress reports after every iteration, plus printing for the initial simplex;
nas 'verbose' but only report after each n iterations.

The restart argument causes the optimizer to ignore any command-line and/or default specifications for npar, vertices and steps, and read the values of these from the current plot.

If stopcost and stoppar are both specified, both conditions must be satisfied before the optimization stops.

CostProcedure幸运飞艇超稳计划群 must read from the appropriate optimize plot:

p[npar]
  The point, in parameter space, at which to evaluate the cost function.

and, having performed its calculations, write back to the same plot:

cost
 The value of the cost function evaluated at p.
 
accept
 CostProcedure may signal that the current value of p violates a constraint by assigning accept the value false (i.e. 0.0).

幸运飞艇超稳计划群optimize returns results by storing them in vectors:

neval
 The number of times the cost function was evaluated.
 
vertices[npar+1][npar]
 Simplex vertices, i.e. an array of npar+1 parameter vectors. These are sorted into increasing-cost order so vertices[0] contains the best p tried so far.
 
values[npar+1]
 Values of the cost function at the simplex vertices with values[0] containing the lowest value found so far.
 
ifail
 Status/error code values:
= -1 still running, or interrupted by user;
=  0 successful termination;
=  1 evaluation limit 'maxeval' exceeded;
=  2 illegal value for 'maxeval';
=  3 illegal value for 'npar';
=  4 illegal value for 'ntest';
=  5 attempt to shrink simplex failed;
=  6 'steps' has an invalid number of elements;
=  7 'vertices' has an invalid structure and/or number of elements;
=  8 'values' has an invalid number (or ordering) of elements;
=  9 recursive calls to optimise exceed depth limit;
= 10 couldn't restart - current plot is not of type 'optim';
= 11 the cost function did not set 'cost' to a valid value;
= 12 bad vertices - simplex has zero volume;
= 101 quadfit - matrix of second derivatives is not positive definite;
= 102 quadfit - unable to evaluate cost function near minimum;
= 103 quadfit - maxeval limit exceeded trying to expand region;
= 104 quadfit - infinite value encountered trying to expand region.

Optimize attempts to fit a quadratic hypersurface in the vicinity of a minimum it has found unless the nofit option has been specified. For this process to succeed, the cost function must be smooth in the minimum region.

q[npar]
 The position, in parameter space, of the minimum of the fitted surface. This should be close to p.
 
qmin
 The minimum value of the fitted surface. This should be close to the minimum value of cost.
 
info[npar][npar]
 The information matrix.
 
invinfo[npar][npar]
 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.
 
corr[npar][npar]
 The correlation matrix.

Sequence of Operations

Optimize幸运飞艇超稳计划群 looks for the information it needs to run in various places using the following order of precedence:

  1. values specified on the command line;
  2. if restarting, values from the current optimize plot;
  3. 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 'optimization'.

Remarks

Constraints

As an alternative to the 'let accept = false' mechanism, constraints such as 'p[2] < 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[2] - 5
    if (g>0)
        let cost = cost + mu * g^lambda
    end

where mu and lambda幸运飞艇超稳计划群 are positive constants. On exit, if

Cost Functions

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.

The vector 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'.

Reports

The number of digits used in reports defaults to 6, but can be changed by setting the numdgt variable.

Plot Locking

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 re-dimensioned.

幸运飞艇pk10彩票 免费幸运飞艇计划手机 pk10微信群或者飞艇群 全天幸运飞艇精准计划 助赢幸运飞艇软件 天天幸运飞艇计划软件 北京pk10幸运飞艇直播 幸运飞艇 开奖b678甸vip 北京幸运飞艇开奖直播 幸运飞艇app下载 幸运飞艇【上恒达集团~HD161。COM~平台】 幸运飞艇【上恒达集团~HD161。COM~平台】 幸运飞艇【上恒达集团~HD161。COM~平台】 澳门百家乐【上恒达集团~HD161。COM~平台】 澳门百家乐【上恒达集团~HD161。COM~平台】 澳门百家乐【上恒达集团~HD161。COM~平台】 六合彩公司【上恒达集团~HD161。COM~平台】