Skip to content

Commit be173df

Browse files
Merge branch 'master' into feat/args
2 parents e732a8e + 5fc7de3 commit be173df

19 files changed

+81
-43
lines changed

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: python
2+
python:
3+
- "2.7"
4+
- "3.5"
5+
- "3.6"
6+
7+
install:
8+
- pip install -r requirements.txt
9+
- python setup.py build
10+
11+
script:
12+
- pip install nose
13+
- python setup.py test

README.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
===================================================================================
2-
Py-BOBYQA: Derivative-Free Solver for Bound-Constrained Minimization |PyPI Version|
3-
===================================================================================
4-
Py-BOBYQA is a flexible package for solving bound-constrained general objective minimization, without requiring derivatives of the objective. It is a Python implementation of the BOBYQA algorithm by Powell.
1+
==================================================================================================
2+
Py-BOBYQA: Derivative-Free Solver for Bound-Constrained Minimization |Build Status| |PyPI Version|
3+
==================================================================================================
4+
Py-BOBYQA is a flexible package for solving bound-constrained general objective minimization, without requiring derivatives of the objective. It is a Python implementation of the BOBYQA algorithm by Powell. Py-BOBYQA is particularly useful when evaluations of the objective function are expensive and/or noisy.
55

66
More details about Py-BOBYQA can be found in our paper: C. Cartis, J. Fiala, B. Marteau and L. Roberts, Improving the Flexibility and Robustness of Model-Based Derivative-Free Optimization Solvers, technical report, University of Oxford, (2018).
77

88
The original paper by Powell is: M. J. D. Powell, The BOBYQA algorithm for bound constrained optimization without derivatives, technical report DAMTP 2009/NA06, University of Cambridge (2009), and the original Fortran implementation is available `here <http://mat.uc.pt/~zhang/software.html>`_.
99

10+
If you are interested in solving least-squares minimization problems, you may wish to try `DFO-LS <https://github.com/numericalalgorithmsgroup/dfols>`_, which has the same features as Py-BOBYQA (plus some more), and exploits the least-squares problem structure, so performs better on such problems.
11+
1012
Documentation
1113
-------------
1214
See manual.pdf or `here <http://people.maths.ox.ac.uk/robertsl/pybobyqa>`_.
@@ -25,7 +27,7 @@ Additionally, the following python packages should be installed (these will be i
2527

2628
Installation using pip
2729
----------------------
28-
For easy installation, use *pip* (http://www.pip-installer.org/) as root::
30+
For easy installation, use `pip <http://www.pip-installer.org/>`_ as root::
2931

3032
$ [sudo] pip install Py-BOBYQA
3133

@@ -100,5 +102,7 @@ License
100102
-------
101103
This algorithm is released under the GNU GPL license.
102104

105+
.. |Build Status| image:: https://travis-ci.org/numericalalgorithmsgroup/pybobyqa.svg?branch=master
106+
:target: https://travis-ci.org/numericalalgorithmsgroup/pybobyqa
103107
.. |PyPI Version| image:: https://img.shields.io/pypi/v/Py-BOBYQA.svg
104108
:target: https://pypi.python.org/pypi/Py-BOBYQA

docs/history.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Version History
2+
===============
3+
This section lists the different versions of Py-BOBYQA and the updates between them.
4+
5+
Version 1.0 (6 Feb 2018)
6+
------------------------
7+
* Initial release of Py-BOBYQA
8+
9+
Version 1.0.1 (20 Feb 2018)
10+
---------------------------
11+
* Minor bug fix to trust region subproblem solver (the output :code:`crvmin` is calculated correctly) - this has minimal impact on the performance of Py-BOBYQA.
12+

docs/index.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Py-BOBYQA: Derivative-Free Optimizer for Bound-Constrained Minimization
1212

1313
**Author:** `Lindon Roberts <lindon.roberts@maths.ox.ac.uk>`_
1414

15-
Py-BOBYQA is a flexible package for finding local solutions to nonlinear, nonconvex minimization problems (with optional bound constraints), without requiring any derivatives of the objective. Py-BOBYQA is a Python implementation of the `BOBYQA <http://mat.uc.pt/~zhang/software.html#powell_software>`_ solver by Powell (documentation `here <http://www.damtp.cam.ac.uk/user/na/NA_papers/NA2009_06.pdf>`_).
15+
Py-BOBYQA is a flexible package for finding local solutions to nonlinear, nonconvex minimization problems (with optional bound constraints), without requiring any derivatives of the objective. Py-BOBYQA is a Python implementation of the `BOBYQA <http://mat.uc.pt/~zhang/software.html#powell_software>`_ solver by Powell (documentation `here <http://www.damtp.cam.ac.uk/user/na/NA_papers/NA2009_06.pdf>`_). It is particularly useful when evaluations of the objective function are expensive and/or noisy.
1616

1717
That is, Py-BOBYQA solves
1818

@@ -23,6 +23,8 @@ That is, Py-BOBYQA solves
2323
2424
Full details of the Py-BOBYQA algorithm are given in our paper: C. Cartis, J. Fiala, B. Marteau and L. Roberts, Improving the Flexibility and Robustness of Model-Based Derivative-Free Optimization Solvers, technical report, University of Oxford, (2018).
2525

26+
If you are interested in solving least-squares minimization problems, you may wish to try `DFO-LS <https://github.com/numericalalgorithmsgroup/dfols>`_, which has the same features as Py-BOBYQA (plus some more), and exploits the least-squares problem structure, so performs better on such problems.
27+
2628
Py-BOBYQA is released under the GNU General Public License. Please `contact NAG <http://www.nag.com/content/worldwide-contact-information>`_ for alternative licensing.
2729

2830
.. toctree::
@@ -34,6 +36,7 @@ Py-BOBYQA is released under the GNU General Public License. Please `contact NAG
3436
userguide
3537
advanced
3638
diagnostic
39+
history
3740

3841
Acknowledgements
3942
----------------

docs/userguide.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ Note that Py-BOBYQA is a randomized algorithm: in its first phase, it builds an
125125
126126
****** Py-BOBYQA Results ******
127127
Solution xmin = [ 1. 1.]
128-
Objective value f(xmin) = 2.790048765e-19
129-
Needed 211 objective evaluations (at 211 points)
130-
Approximate gradient = [ -1.57869863e-08 7.96417081e-09]
131-
Approximate Hessian = [[ 803.2582815 -399.50964113]
132-
[-399.50964113 199.12578708]]
128+
Objective value f(xmin) = 2.964036794e-19
129+
Needed 213 objective evaluations (at 213 points)
130+
Approximate gradient = [ -2.57280154e-08 1.26855793e-08]
131+
Approximate Hessian = [[ 802.90904563 -400.46022134]
132+
[-400.46022134 200.23335154]]
133133
Exit flag = 0
134134
Success: rho has reached rhoend
135135
******************************
@@ -156,10 +156,10 @@ Py-BOBYQA correctly finds the solution to the constrained problem:
156156
****** Py-BOBYQA Results ******
157157
Solution xmin = [ 0.9 0.81]
158158
Objective value f(xmin) = 0.01
159-
Needed 129 objective evaluations (at 129 points)
160-
Approximate gradient = [ -2.00000002e-01 -4.01842008e-09]
161-
Approximate Hessian = [[ 649.34361541 -364.85712365]
162-
[-364.85712365 200.53013142]]
159+
Needed 134 objective evaluations (at 134 points)
160+
Approximate gradient = [ -1.99999226e-01 -4.31078784e-07]
161+
Approximate Hessian = [[ 649.6790222 -360.18361979]
162+
[-360.18361979 200.00205196]]
163163
Exit flag = 0
164164
Success: rho has reached rhoend
165165
******************************
@@ -190,8 +190,8 @@ And we can now see each evaluation of :code:`objfun`:
190190
Function eval 2 at point 2 has f = 14.337296 at x = [-1.08 0.85]
191191
Function eval 3 at point 3 has f = 55.25 at x = [-1.2 0.73]
192192
...
193-
Function eval 128 at point 128 has f = 0.0100000000000225 at x = [ 0.9 0.81000002]
194-
Function eval 129 at point 129 has f = 0.00999999999999997 at x = [ 0.9 0.81]
193+
Function eval 133 at point 133 has f = 0.0100000000000165 at x = [ 0.9 0.81000001]
194+
Function eval 134 at point 134 has f = 0.00999999999999997 at x = [ 0.9 0.81]
195195
Did a total of 1 run(s)
196196
197197
If we wanted to save this output to a file, we could replace the above call to :code:`logging.basicConfig()` with
@@ -288,18 +288,18 @@ As noted above, Py-BOBYQA has an input parameter :code:`objfun_has_noise` to ind
288288
289289
soln = pybobyqa.solve(rosenbrock_noisy, x0, objfun_has_noise=True)
290290
291-
Using this setting, we get a more accurate solution, and better estimates of the gradient and Hessian:
291+
This time, we find the true solution, and better estimates of the gradient and Hessian:
292292

293293
.. code-block:: none
294294
295295
****** Py-BOBYQA Results ******
296296
Solution xmin = [ 1. 1.]
297-
Objective value f(xmin) = 3.559647071e-18
297+
Objective value f(xmin) = 3.418770987e-18
298298
Needed 300 objective evaluations (at 300 points)
299299
Did a total of 4 runs
300-
Approximate gradient = [ -3.70447710e-07 1.81205404e-07]
301-
Approximate Hessian = [[ 804.44834579 -394.71053944]
302-
[-394.71053944 194.52019795]]
300+
Approximate gradient = [ -1.36175005e-08 2.12249758e-09]
301+
Approximate Hessian = [[ 805.93202374 -394.16671315]
302+
[-394.16671315 192.99451721]]
303303
Exit flag = 1
304304
Warning (max evals): Objective has been called MAXFUN times
305305
******************************

examples/rosenbrock_noisy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def rosenbrock_noisy(x):
2323
print("")
2424

2525
# Call Py-BOBYQA
26-
soln = pybobyqa.solve(rosenbrock_noisy, x0)
27-
#soln = pybobyqa.solve(rosenbrock_noisy, x0, objfun_has_noise=True)
26+
#soln = pybobyqa.solve(rosenbrock_noisy, x0)
27+
soln = pybobyqa.solve(rosenbrock_noisy, x0, objfun_has_noise=True)
2828

2929
# Display output
3030
print(soln)

manual.pdf

2.11 KB
Binary file not shown.

pybobyqa/controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
EXIT_LINALG_ERROR = -3 # error, linalg error (singular matrix encountered)
5555

5656

57-
class ExitInformation:
57+
class ExitInformation(object):
5858
def __init__(self, flag, msg_details):
5959
self.flag = flag
6060
self.msg = msg_details
@@ -92,7 +92,7 @@ def able_to_do_restart(self):
9292
return "sufficiently small" not in self.msg # restart for rho=rhoend and noise level termination
9393

9494

95-
class Controller:
95+
class Controller(object):
9696
def __init__(self, objfun, x0, args, f0, f0_nsamples, xl, xu, npt, rhobeg, rhoend, nf, nx, maxfun, params, scaling_changes):
9797
self.objfun = objfun
9898
self.maxfun = maxfun

pybobyqa/diagnostic_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
ITER_SAFETY = "Safety" # safety step taken (||s|| too small compared to rho)
4747

4848

49-
class DiagnosticInfo:
49+
class DiagnosticInfo(object):
5050
def __init__(self):
5151
self.data = {}
5252
# Initialise everything we want to store

pybobyqa/hessian.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
__all__ = ['Hessian']
3636

3737

38-
class Hessian:
38+
class Hessian(object):
3939
def __init__(self, n, vals=None):
4040
self.n = n
4141
if vals is None:

0 commit comments

Comments
 (0)