naginterfaces.library.opt.bounds_​mod_​deriv_​easy

naginterfaces.library.opt.bounds_mod_deriv_easy(ibound, funct2, bl, bu, x, data=None)[source]

bounds_mod_deriv_easy is an easy-to-use modified Newton algorithm for finding a minimum of a function , subject to fixed upper and lower bounds on the independent variables , when first derivatives of are available. It is intended for functions which are continuous and which have continuous first and second derivatives (although it will usually work even if the derivatives have occasional discontinuities).

For full information please refer to the NAG Library document for e04kz

https://www.nag.com/numeric/nl/nagdoc_27.3/flhtml/e04/e04kzf.html

Parameters
iboundint

Indicates whether the facility for dealing with bounds of special forms is to be used. It must be set to one of the following values:

If you are supplying all the and individually.

If there are no bounds on any .

If all the bounds are of the form .

If and .

funct2callable (fc, gc) = funct2(xc, data=None)

You must supply this function to calculate the values of the function and its first derivatives at any point .

It should be tested separately before being used in conjunction with bounds_mod_deriv_easy (see submodule opt).

Parameters
xcfloat, ndarray, shape

The point at which the function and derivatives are required.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
fcfloat

The value of the function at the current point ,

gcfloat, array-like, shape

must be set to the value of the first derivative at the point , for .

blfloat, array-like, shape

The lower bounds .

If is set to , you must set to , for . (If a lower bound is not specified for a particular , the corresponding should be set to .)

If is set to , you must set to ; bounds_mod_deriv_easy will then set the remaining elements of equal to .

bufloat, array-like, shape

The upper bounds .

If is set to , you must set to , for . (If an upper bound is not specified for a particular , the corresponding should be set to .)

If is set to , you must set to ; bounds_mod_deriv_easy will then set the remaining elements of equal to .

xfloat, array-like, shape

must be set to a guess at the th component of the position of the minimum, for . The function checks the gradient at the starting point, and is more likely to detect any error in your programming if the initial are nonzero and mutually distinct.

dataarbitrary, optional

User-communication data for callback functions.

Returns
blfloat, ndarray, shape

The lower bounds actually used by bounds_mod_deriv_easy.

bufloat, ndarray, shape

The upper bounds actually used by bounds_mod_deriv_easy.

xfloat, ndarray, shape

The lowest point found during the calculations of the position of the minimum.

ffloat

The value of corresponding to the final point stored in .

gfloat, ndarray, shape

The value of corresponding to the final point stored in , for ; the value of for variables not on a bound should normally be close to zero.

Raises
NagValueError
(errno )

On entry, and for some .

(errno )

On entry, and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

There have been function evaluations.

(errno )

The modulus of a variable has become very large. There may be a mistake in , your problem has no finite solution, or the problem needs rescaling.

(errno )

It is very likely that you have made an error forming the gradient.

Warns
NagAlgorithmicWarning
(errno )

The conditions for a minimum have not all been satisfied, but a lower point could not be found.

(errno )

It is probable that a local minimum has been found, but it cannot be guaranteed.

(errno )

It is possible that a local minimum has been found, but it cannot be guaranteed.

(errno )

It is unlikely that a local minimum has been found.

(errno )

It is very unlikely that a local minimum has been found.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

bounds_mod_deriv_easy is applicable to problems of the form:

when first derivatives are known.

Special provision is made for problems which actually have no bounds on the , problems which have only non-negativity bounds, and problems in which and . You must supply a function to calculate the values of and its first derivatives at any point .

From a starting point you supplied there is generated, on the basis of estimates of the gradient of the curvature of , a sequence of feasible points which is intended to converge to a local minimum of the constrained function.

References

Gill, P E and Murray, W, 1976, Minimization subject to bounds on the variables, NPL Report NAC 72, National Physical Laboratory