XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ mnfb_r()

void mnfb_r ( int  n,
double  x[],
double  b[][2],
double  d[],
double  v[],
int  lv,
int  iv[],
int  liv,
int *  info,
double *  yy,
int *  irev 
)

Minimum of a multivariable nonlinear function (trust region method) (simply bounded) (gradient computed by finite differences) (reverse communication version)

Purpose
mnfb_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 gradient of the objective function is calculated by the finite differences. The user need not supply the analytic gradient values. The secant method (BFGS update) is used to compute the Hessian. Steps are computed by the double dogleg trust region method.

The arrays v[] and iv[] are the parameters and work spaces, If mnf_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]nThe 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: The abscissa where the function value 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[41] (eta0): Estimated bound on the relative error in the function value computed by calcf. (Suppose (true value) = (computed value)*(1 + e), Abs(e) is not greater than eta0) (default = 1000*eps)
  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]lvThe length of array v[]. (lv >= 77 + n*(n + 23)/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.
  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 (excluding those made only for computing gradients). mxfcal is applied to the value of nfcall.
  iv[27] (g): The starting subscript (+ 1) in v[] of the current gradient vector.
  iv[29] (ngcall): Number of function evaluations with irev = 1 so far made only for computing gradients (the total number of function evaluations is nfcall + ngcall).
  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.
[in]livThe length of array iv[]. (liv >= 59 + 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]irevControl 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.
= 50: Print the intermediate result (x[], yy, iv[5], iv[29], iv[30]) (if iv[18] = 1). Do not alter any variables.
Reference
netlib/port