You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,8 @@ Additionally, the following python packages should be installed (these will be i
57
57
* SciPy 0.18 or higher (http://www.scipy.org/)
58
58
* Pandas 0.17 or higher (http://pandas.pydata.org/)
59
59
60
+
**Optional package:** Py-BOBYQA versions 1.2 and higher also support the `trustregion <https://github.com/lindonroberts/trust-region>`_ package for fast trust-region subproblem solutions. To install this, make sure you have a Fortran compiler (e.g. `gfortran <https://gcc.gnu.org/wiki/GFortran>`_) and NumPy installed, then run :code:`pip install trustregion`. You do not have to have trustregion installed for Py-BOBYQA to work, and it is not installed by default.
61
+
60
62
Installation using pip
61
63
----------------------
62
64
For easy installation, use `pip <http://www.pip-installer.org/>`_ as root:
Copy file name to clipboardExpand all lines: docs/build/html/_sources/index.rst.txt
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,8 @@ That is, Py-BOBYQA solves
21
21
\min_{x\in\mathbb{R}^n} &\quad f(x)\\
22
22
\text{s.t.} &\quad a \leq x \leq b
23
23
24
+
The upper and lower bounds on the variables are non-relaxable (i.e. Py-BOBYQA will never ask to evaluate a point outside the bounds).
25
+
24
26
Full details of the Py-BOBYQA algorithm are given in our papers:
25
27
26
28
1. Coralia Cartis, Jan Fiala, Benjamin Marteau and Lindon Roberts, `Improving the Flexibility and Robustness of Model-Based Derivative-Free Optimization Solvers <https://arxiv.org/abs/1804.00154>`_, technical report, University of Oxford, (2018).
Copy file name to clipboardExpand all lines: docs/build/html/_sources/install.rst.txt
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ Additionally, the following python packages should be installed (these will be i
13
13
* `SciPy 0.18 or higher <http://www.scipy.org/>`_
14
14
* `Pandas 0.17 or higher <https://pandas.pydata.org/>`_
15
15
16
+
**Optional package:** Py-BOBYQA versions 1.2 and higher also support the `trustregion <https://github.com/lindonroberts/trust-region>`_ package for fast trust-region subproblem solutions. To install this, make sure you have a Fortran compiler (e.g. `gfortran <https://gcc.gnu.org/wiki/GFortran>`_) and NumPy installed, then run :code:`pip install trustregion`. You do not have to have trustregion installed for Py-BOBYQA to work, and it is not installed by default.
Copy file name to clipboardExpand all lines: docs/build/html/_sources/userguide.rst.txt
+65-51Lines changed: 65 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Py-BOBYQA is designed to solve the local optimization problem
11
11
\min_{x\in\mathbb{R}^n} &\quad f(x) \\
12
12
\text{s.t.} &\quad a \leq x \leq b
13
13
14
-
where the bound constraints :math:`a \leq x \leq b` are optional. The objective function :math:`f(x)` is usually nonlinear and nonquadratic. If you know your objective is linear or quadratic, you should consider a solver designed for such functions (see `here <https://neos-guide.org/Optimization-Guide>`_ for details).
14
+
where the bound constraints :math:`a \leq x \leq b` are optional. The upper and lower bounds on the variables are non-relaxable (i.e. Py-BOBYQA will never ask to evaluate a point outside the bounds). The objective function :math:`f(x)` is usually nonlinear and nonquadratic. If you know your objective is linear or quadratic, you should consider a solver designed for such functions (see `here <https://neos-guide.org/Optimization-Guide>`_ for details).
15
15
16
16
Py-BOBYQA iteratively constructs an interpolation-based model for the objective, and determines a step using a trust-region framework.
17
17
For an in-depth technical description of the algorithm see the paper [CFMR2018]_, and for the global optimization heuristic, see [CRO2018]_.
@@ -69,7 +69,8 @@ The :code:`solve` function has several optional arguments which the user may pro
* :code:`objfun_has_noise` - a flag to indicate whether or not :code:`objfun` has stochastic noise; i.e. will calling :code:`objfun(x)` multiple times at the same value of :code:`x` give different results? This is used to set some sensible default parameters (including using multiple restarts), all of which can be overridden by the values provided in :code:`user_params`.
85
86
* :code:`seek_global_minimum` - a flag to indicate whether to search for a global minimum, rather than a local minimum. This is used to set some sensible default parameters, all of which can be overridden by the values provided in :code:`user_params`. If :code:`True`, both upper and lower bounds must be set. Note that Py-BOBYQA only implements a heuristic method, so there are no guarantees it will find a global minimum. However, by using this flag, it is more likely to escape local minima if there are better values nearby. The method used is a multiple restart mechanism, where we repeatedly re-initialize Py-BOBYQA from the best point found so far, but where we use a larger trust reigon radius each time (note: this is different to more common multi-start approach to global optimization).
86
87
* :code:`scaling_within_bounds` - a flag to indicate whether the algorithm should internally shift and scale the entries of :code:`x` so that the bounds become :math:`0\leq x \leq1`. This is useful is you are setting :code:`bounds` and the bounds have different orders of magnitude. If :code:`scaling_within_bounds=True`, the values of :code:`rhobeg` and :code:`rhoend` apply to the *shifted* variables.
88
+
* :code:`do_logging` - a flag to indicate whether logging output should be produced. This is not automatically visible unless you use the Python `logging <https://docs.python.org/3/library/logging.html>`_ module (see below for simple usage).
89
+
* :code:`print_progress` - a flag to indicate whether to print a per-iteration progress log to terminal.
87
90
88
91
In general when using optimization software, it is good practice to scale your variables so that moving each by a given amount has approximately the same impact on the objective function.
89
92
The :code:`scaling_within_bounds` flag is designed to provide an easy way to achieve this, if you have set the bounds :code:`lower` and :code:`upper`.
@@ -112,9 +115,6 @@ This function has exactly one local minimum :math:`f(x_{min})=0` at :math:`x_{mi
112
115
# Define the starting point
113
116
x0 = np.array([-1.2, 1.0])
114
117
115
-
# Set random seed (for reproducibility)
116
-
np.random.seed(0)
117
-
118
118
# Call Py-BOBYQA
119
119
soln = pybobyqa.solve(rosenbrock, x0)
120
120
@@ -126,12 +126,12 @@ Note that Py-BOBYQA is a randomized algorithm: in its first phase, it builds an
If you have logging for some parts of your code and you want to deactivate all Py-BOBYQA logging, you can use the optional argument :code:`do_logging=False` in :code:`pybobyqa.solve()`.
207
+
208
+
An alternative option available is to get Py-BOBYQA to print to terminal progress information every iteration, by setting the optional argument :code:`print_progress=True` in :code:`pybobyqa.solve()`. If we do this for the above example, we get
209
+
210
+
.. code-block:: none
211
+
212
+
Run Iter Obj Grad Delta rho Evals
213
+
1 1 1.43e+01 1.74e+02 1.20e-01 1.20e-01 5
214
+
1 2 5.57e+00 1.20e+02 3.66e-01 1.20e-01 6
215
+
1 3 5.57e+00 1.20e+02 6.00e-02 1.20e-02 6
216
+
...
217
+
1 132 1.00e-02 2.00e-01 1.50e-08 1.00e-08 144
218
+
1 133 1.00e-02 2.00e-01 1.50e-08 1.00e-08 145
219
+
206
220
Example: Noisy Objective Evaluation
207
221
-----------------------------------
208
222
As described in :doc:`info`, derivative-free algorithms such as Py-BOBYQA are particularly useful when :code:`objfun` has noise. Let's modify the previous example to include random noise in our objective evaluation, and compare it to a derivative-based solver:
@@ -230,7 +244,7 @@ As described in :doc:`info`, derivative-free algorithms such as Py-BOBYQA are pa
230
244
231
245
print("Demonstrate noise in function evaluation:")
0 commit comments