|
◆ mnhb_r()
void mnhb_r |
( |
int |
n, |
|
|
double |
x[], |
|
|
double |
b[][2], |
|
|
double |
d[], |
|
|
double |
v[], |
|
|
int |
lv, |
|
|
int |
iv[], |
|
|
int |
liv, |
|
|
int * |
info, |
|
|
double * |
yy, |
|
|
double |
yyp[], |
|
|
double |
yypd[], |
|
|
int * |
irev |
|
) |
| |
Minimum of a multivariable nonlinear function (trust region method) (simply bounded) (gradient and Hessian computed analytically) (reverse communication version)
- Purpose
- mnhb_r finds the local minimum point (xs1, xs2, ..., xsn) of general nonlinear function f(x1, x2, ..., xn) (a twice continuously differentiable real-valued function) under the following simple constraint (b0i and b1i are lower and upper bounds).
b0i <= xsi <= b1i (i = 1 to n)
The user-supplied analytic gradient and Hessian values of the objective function are used. Steps are computed by the double dogleg trust region method.
The arrays v[] and iv[] are the parameters and work spaces, If mnh_r is called with iv[0] = 0, these arrays will be initialized to the defalt values before starting the calculation. See description on iv[0] below.
- Parameters
-
[in] | n | The number of variables (n > 0) |
[in,out] | x[] | Array x[lx] (lx >= n)
[in] Initial approximation of the solution vector
[out] irev = 0: Obtained solution vector
irev = 1, 30: The abscissa where the function value or derivatives and Hessian shoule be evaluated
irev = 50: Recent approximation of the solution vector |
[in] | b[][] | Array b[lb][2] (lb >= n)
Lower and upper bounds on solution vector x
b[i][0] <= x[i] <= b[i][1] (i = 0 to n-1) |
[in] | d[] | Array d[ld] (ld >= n)
A scale vector such that d[i]*x[i], i=0,1,...,n-1 are all in comparable units (d[i] > 0) |
[in,out] | v[] | Array v[lv]
The array for the floating point parameters and work space
[in]
v[25] (tuner1): Parameter to check for false convergence. (0 <= tuner1 <= 0.5) (default = 0.1)
v[30] (atol): Absolute function convergence tolerance. (0 <= atol) (default = max(1e-20, eps^2), where eps is the machine epsilon)
v[31] (rtol): Relative function convergence tolerance. (eps <= rtol <= 0.1) (default = max(1e-10, eps^(2/3))
v[32] (xctol): X-convergence tolerance. (0 <= xctol <= 1) (default = eps^(1/2))
v[33] (xftol): False convergence tolerance. (0 <= xftol <= 1) (default = 100*eps)
v[34] (lmax0): Maximum 2-norm allowed for scaled very first step. (0 < lmax0) (default = 1)
v[35] (lmaxs), v[36] (sctol): Parameters to test for singular convergence. (0 < lmaxs, 0 <= sctol <= 1)
If the function reduction predicted for a step of length bounded by lmaxs is at most sctol*abs(f). (f is the function value at the start of the current iteration)
v[37] (dinit): If nonnegative, all components of the scale vector d[] is initialized to this value. (-10 <= dinit) (default = -1)
v[38] (dtinit): If positive, all components of the dtol array (tolerances for adaptive scaling) are initialized to this value. If zero, then it is assumed that the user has initialized the dtol array. (dtinit >= 0) (default = 1e-6)
v[39] (d0init): If positive, all components of the d0 array (initial values for adaptive scaling) are initialized to this value. If zero, then it is assumed that the user has initialized the d0 array. (d0init >= 0) (default = 1)
v[40] (dfac): Factor for adaptive scaling. (0 <= dfac <= 1) (default = 0.6)
If iv[15] (dtype) = 1 or 2, a scale factor d[i] is chosen by adaptive scaling so that d[i]*x[i] has about the same magnitude for all i.
Let d1[i] = max(sqrt(abs(Hii)), dfac*d[i]) where Hii is the diagonal element of Hessian matrix, then d[i] is chosen as follows.
if d1[i] >= dtol: d[i] = d1[i].
if d1[i] < dtol: d[i] = max(d0, dtol).
v[42] (bias): The bias parameter used in double dogleg method. (0 <= bias <= 1) (default = 0.8)
[out]
v[0] (dgnorm): 2-norm of diag(d)^(-1)*g. (g is most recently computed gradient)
v[1] (dstnorm): 2-norm of diag(d)^(-1)*s. (s is the current step)
v[9] (f): Current function value.
v[12] (f0): Function value at the start of the current iteration. |
[in] | lv | The length of array v[]. (lv >= 78 + n*(n+27)/2) |
[in,out] | iv[] | Array iv[liv]
The array for the integer parameters and work space
[in]
iv[0]: If = 0, all parameters in v[] and iv[] will be initialized to the default values before starting calculation.
If = 12, v[] and iv[] are assumed to have already been set by the user and will not be initialized by the routine. Since the subroutine ivset assigns iv[0] = 12, user can first call ivset to set default values to v[] and iv[], and then change some necessary entries to non-default values and start calculation with such non-default parameters.
If = 13, similar to iv[0] = 12, but the routine will only carry out the storage allocation and return with iv[0] = 14. When the routine is called again with iv[0] = 14, the calculation will be started. This can be used to obtain iv[58] to set the dtol and d0 arrays by the user.
iv[15] (dtype): Choice of adaptive scaling. (dtype = 0, 1 or 2) (default = 0)
= 0: Disable adaptive scaling. (scale factor = 1)
= 1: Enable adaptive scaling during all iterations.
= 2: Enable adaptive scaling during the first iteration and scale factor is left unchanged thereafter. iv[16] (mxfcal): Maximum number of function evaluations allowed. (default = 200)
iv[17] (mxiter): Maximum number of iterations allowed. (default = 150)
iv[18] (outlev): Controls the print of intermediate results. (default = 0)
!= 1: Do not return with irev = 50.
= 1: Return after every iteration with irev = 50 for printing intermediate result.
[out]
iv[0]: Return code.
= 3: x-convergence.
= 4: Relative function convergence.
= 5: Both x- and relative function convergence.
= 6: Absolute function convergence.
= 7: Singular convergence. The Hessian near the current iterate appears to be singular.
= 8: False convergence. The iterates appear to be converging to a noncritical point.
= 9: Function evaluation limit reached.
= 10: Iteration limit reached.
= 11: stopx returned true. (External interrupt)
= 17: Restart attempted with N changed.
= 18: d has a negative component and iv[dtype] < 0.
= 19...43: v[iv[0]] is out of range.
= 63: f(x) cannot be computed at the initial x.
= 64: Bad parameters passed to assess.
= 65: The gradient could not be computed at x.
= 67: Bad first parameter to ivset.
= 80: iv[0] was out of range.
= 81: n is not positive.
iv[5] (nfcall): Number of function evaluations with irev = 1 so far made.
iv[27] (g): The starting subscript (+ 1) in v[] of the current gradient vector.
iv[29] (ngcall): Number of gradient evaluations with irev = 30 so far made.
iv[30] (niter): Number of iterations performed.
iv[43] (lastiv): The least acceptable value of liv.
iv[44] (lastv): The least acceptable value of lv.
iv[58] (dtol): Gives the starting subscript (+ 1) in v[] of the dtol array. The d0 array follows the dtol array in v[]. |
[in] | liv | The length of array iv[]. (liv >= 59 + 3*n) |
[out] | info | = 0: Successful exit (iv[0] = 3 to 6)
= -1: The argument n had an illegal value (n < 1) (iv[0] = 81)
= -3: The argument b had an illegal value (b[i][0] > b[i][1]) (iv[0] = 82)
= -4: The argument d had an illegal value (d has a negative component and iv[15] = 0) (iv[0] = 18)
= -5: The argument v[18], ... or v[42] had an illegal value (out of range) (iv[0] = 19 to 43)
= -6: The argument lv had an illegal value (lv too small) (iv[0] = 16)
= -7: The argument iv[0] had an illegal value (iv[0] out of range) (iv[0] = 80)
= -8: The argument liv had an illegal value (liv too small) (iv[0] = 15)
= 7: Singular convergence (the Hessian near the current iterate appears to be singular)
= 8: False convergence (the iterates appear to be converging to a noncritical point)
= 9: Function evaluation limit reached
= 10: Iteration limit reached
= 14: iv[] and v[] have been allocated (normal exit after a call with iv[0]=13)
= 17: Restart attempted with n changed
= 63: f(x) cannot be computed at the initial x
= 65: The gradient could not be computed at x |
[in,out] | yy | [in] If irev = 1, the function value f(x[]) should be given in yy in the next call.
[out] If irev = 50, yy contains the function value at current x[] for printing. |
[in,out] | yyp[] | Array yyp[lyyp] (lyyp >= n)
[in] If irev = 30, the derivatives at x[] should be given in yyp[] in the next call.
[out] If irev = 50, yyp[] contains the derivatives at current x[] for printing. |
[in,out] | yypd[] | Array yyp[lyyp] (lyypd >= n*(n + 1)/2)
[in] If irev = 30, the lower triangle of the Hessian at x[] should be given in yypd[] in packed form in the next call.
[out] If irev = 50, yypd[] contains the lower triangle of the Hessian at current x[] for printing. |
[in,out] | irev | Control variable for reverse communication.
[in] Before first call, irev should be initialized to zero. On succeeding calls, irev should not be altered.
[out] If irev is not zero, complete the following process and call this routine again.
= 0: Computation finished. See return code in info.
= 1: User should set the function values at x[] in yy. Do not alter any variables other than yy.
= 30: User should set the derivatives at x[] in yyp[], and the lower triangle of the Hessian in yypd[]. Do not alter any variables other than yyp[] and yypd[].
= 50: Print the intermediate result (x[], yy, yyp[], yypd[], iv[5], iv[29], iv[30]) (if iv[18] = 1). Do not alter any variables. |
- Reference
- netlib/port
|