More-Garbow-Hillstrom test functions with first derivatives (PyOPUS subsystem name: MGH)
Translated from Matlab implementation (with bugs omitted).
All test functions in this module are maps from to
.
Every function is comprised of m auxiliary functions
where x is a n-dimensional vector.
The actual test function is then constructed as
The i-th component of the function’s gradient can be expressed as
where J(x) is the Jacobian matrix of the auxiliary functions at x where the first index corresponds to the auxiliary function and the second index corresponds to the component of auxiliary function’s gradient.
An exception is the McKinnon function which is not part of the original test suite but is included here because it is a wll known counterexample for the Nelder-Mead simplex algorithm. See
McKinnon, K. I. M.: Convergence of the Nelder-Mead Simplex Method to a Nonstationary Point. SIAM Journal on Optimization, vol. 9, pp. 148-158, 1998.
The functions were first published as a test suite in
More J.J, Garbow B. S., Hillstrom K. E.: Testing Unconstrained Optimization Software. ACM Transactions on Mathematical Software, vol. 7, pp. 17-41, 1981.
Later bounds were added to most test functions in
Gay D. M., A trust-region approach to linearly constrained optimization. Numerical Analysis (Griffiths, D.F., ed.), Lecture Notes in Mathematics 1066, pp. 72-105, Springer, Berlin, 1984.
If a function’s documentation does not say anything about bounds, the bounds are defined for all allowed values of n.
This module is independent of PyOPUS, meaning that it can be taken as is and used as a module in some other package.
A test function wrapper class for obtaining the function’s value.
The f() method of test function objects is not picklable while objects of this class are.
Objects of this class are callable and pass the arguments to the f() method function of MGHfunc. The return value is the value returned by MGHfunc.f().
Example:
from pyopus.optimizer.mgh import ExtendedRosenbrock, MGHf
from numpy import array
from cPickle import dumps
# Create an instance of the extended Rosenbrock function with n=m=4
rb=ExtenedRosenbrock(n=4, m=4)
# This cannot be pickled
func=rb.f
# This one does the same thing when called, but is picklable
funcprime=MGHf(rb)
# These two are equivalent
print func(array[1.0, 1.0, 1.0, 1.0])
print funcprime(array[1.0, 1.0, 1.0, 1.0])
# This will fail
str=dumps(func)
# This will work
str=dumps(funcprime)
A test function wrapper class for obtaining the function’s gradient.
The g() method of test function objects is not picklable while objects of this class are.
Objects of this class are callable and pass the arguments to the g() method function of MGHfunc. The return value is the value returned by MGHfunc.g().
Example:
from pyopus.optimizer.mgh import ExtendedRosenbrock, MGHg
from numpy import array
from cPickle import dumps
# Create an instance of the extended Rosenbrock function with n=m=4
rb=ExtenedRosenbrock(n=4, m=4)
# This cannot be pickled
g=rb.g
# This one does the same thing when called, but is picklable
gprime=MGHg(rb)
# These two are equivalent
print g(array[1.0, 1.0, 1.0, 1.0])
print gprime(array[1.0, 1.0, 1.0, 1.0])
# This will fail
str=dumps(g)
# This will work
str=dumps(gprime)
Base class for test functions
The initial point can be obtained from the initial member. The full name of the problem is in the name member.
The xl and xh members specify the lower and the upper bound given by D. M. Gay in his paper. If they are None no known lower or upper bound is available in the literature.
Objects of this class are callable. The calling convention is
object(x, gradients)
where x is the input values vector and gradients is a boolean flag specifying whether the Jacobian should be evaluated. The values of the auxiliary functions and the jacobian are stored in the fi and J members.
To create an instance of the extended Rosenbrock function with n=m=4 and evaluate the function and the gradient at the initial point one should:
from pyopus.optimizer.mgh import ExtendedRosenbrock
rb=ExtendedRosenbrock(n=4, m=4)
(f, g)=rb(rb.initial)
Rosenbrock test function (n=m=2).
See the MGH class for more details.
Freudenstein and Roth test function (n=m=2).
See the MGH class for more details.
Powell badly scaled test function (n=m=2).
See the MGH class for more details.
Brown test function (n=2, m=3).
See the MGH class for more details.
Beale test function (n=2, m=3).
See the MGH class for more details.
Jennrich and Sampson test function (n=2, m>=n).
See the MGH class for more details.
Helical valley test function (n=m=3).
See the MGH class for more details.
Bard test function (n=3, m=15).
See the MGH class for more details.
Gaussian test function (n=3, m=15).
See the MGH class for more details.
Meyer test function (n=3, m=16).
See the MGH class for more details.
Gulf research and developement test function (n=3, n<=m<=100).
See the MGH class for more details.
Box 3D test function (n=3, m>=n).
See the MGH class for more details.
Powell singular test function (n=m=4).
See the MGH class for more details.
Wood test function (n=4, m=6).
See the MGH class for more details.
Kowalik and Osborne test function (n=4, m=11).
See the MGH class for more details.
Brown and Dennis test function (n=4, m=20).
See the MGH class for more details.
Osborner 1 test function (n=5, m=33).
See the MGH class for more details.
Biggs EXP6 test function (n=6, m>=n).
See the MGH class for more details.
Osborner 2 test function (n=11, m=65).
See the MGH class for more details.
Watson test function (2<=n<=31, m=31).
Bounds defined for n=2, 9, and 12.
See the MGH class for more details.
Extended Rosenbrock test function (n=2k>=2, m=n).
See the MGH class for more details.
Extended Powell singular test function (n=4k>=4, m=n).
See the MGH class for more details.
Penalty I test function (m=n+1).
Bounds defined for n=10.
See the MGH class for more details.
Penalty II test function (m=2n).
Bounds defined for n=1, 4, and 10.
See the MGH class for more details.
Variably dimensional test function (m=n+2).
Bounds defined for n=10.
See the MGH class for more details.
Trigonometric test function (m=n).
Bounds defined for n=10.
See the MGH class for more details.
Brown almost linear test function (m=n).
Bounds defined for n=10k.
See the MGH class for more details.
Discrete boundary value test function (m=n).
No bounds defined.
See the MGH class for more details.
Discrete integral equation test function (m=n).
No boundas defined.
See the MGH class for more details.
Broyden tridiagonal test function (m=n).
No bounds defined.
See the MGH class for more details.
Broyden banded test function (m=n).
No bounds defined.
See the MGH class for more details.
Linear full rank test function (m>=n). Default m=n.
Bounds defined for n=5.
See the MGH class for more details.
Linear rank 1 test function (m>=n). Default m=n.
Bounds defined for n=5.
See the MGH class for more details.
Linear rank 1 zero columns and rows test function (m>=n). Default m=n.
Bounds defined for n=5.
See the MGH class for more details.
Chebyquad test function (m>=n). Default m=n.
Bounds defined for n=1, 7, 8, 9, and 10.
See the MGH class for more details.