Skip to content

Commit d8ca403

Browse files
committed
Added Github pages support
1 parent 44385e2 commit d8ca403

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+18279
-6
lines changed

docs/.nojekyll

Whitespace-only changes.

docs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# You can set these variables from the command line.
55
SPHINXOPTS =
66
SPHINXBUILD = python3 -msphinx
7-
SPHINXPROJ = DFO-Gen
7+
SPHINXPROJ = Py-BOBYQA
88
SOURCEDIR = .
9-
BUILDDIR = _build
9+
BUILDDIR = build
1010

1111
# Put it first so that "make" without argument is like "make help".
1212
help:

docs/build/html/.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 90eef6af7c282e0dc9d95721e936df8c
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/build/html/.nojekyll

Whitespace-only changes.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
Advanced Usage
2+
==============
3+
This section describes different optional user parameters available in Py-BOBYQA.
4+
5+
In the last section (:doc:`userguide`), we introduced :code:`pybobyqa.solve()`, which has the optional input :code:`user_params`. This is a Python dictionary of user parameters. We will now go through the settings which can be changed in this way. More details are available in the paper [CFMR2018]_.
6+
7+
The default values, used if no override is given, in some cases vary depending on whether :code:`objfun` has stochastic noise; that is, whether evaluating :code:`objfun(x)` several times at the same :code:`x` gives the same result or not. Whether or not this is the case is determined by the :code:`objfun_has_noise` input to :code:`pybobyqa.solve()` (and not by inspecting :code:`objfun`, for instance). Similarly, the default values depend on the input flag :code:`seek_global_minimum`, i.e. if a global minimum is desired.
8+
9+
General Algorithm Parameters
10+
----------------------------
11+
* :code:`general.rounding_error_constant` - Internally, all interpolation points are stored with respect to a base point :math:`x_b`; that is, we store :math:`\{y_t-x_b\}`, which reduces the risk of roundoff errors. We shift :math:`x_b` to :math:`x_k` when :math:`\|s_k\| \leq \text{const}\|x_k-x_b\|`, where 'const' is this parameter. Default is 0.1.
12+
* :code:`general.safety_step_thresh` - Threshold for when to call the safety step, :math:`\|s_k\| \leq \gamma_S \rho_k`. Default is :math:`\gamma_S =0.5`.
13+
* :code:`general.check_objfun_for_overflow` - Whether to cap the value of :math:`r_i(x)` when they are large enough that an OverflowError will be encountered when trying to evaluate :math:`f(x)`. Default is :code:`True`.
14+
15+
Logging and Output
16+
------------------
17+
* :code:`logging.n_to_print_whole_x_vector` - If printing all function evaluations to screen/log file, the maximum :code:`len(x)` for which the full vector :code:`x` should be printed also. Default is 6.
18+
* :code:`logging.save_diagnostic_info` - Flag so save diagnostic information at each iteration. Default is :code:`False`.
19+
* :code:`logging.save_poisedness` - If saving diagnostic information, whether to include the :math:`\Lambda`-poisedness of :math:`Y_k` in the diagnostic information. This is the most computationally expensive piece of diagnostic information. Default is :code:`True`.
20+
* :code:`logging.save_xk` - If saving diagnostic information, whether to include the full vector :math:`x_k`. Default is :code:`False`.
21+
22+
Initialization of Points
23+
------------------------
24+
* :code:`init.random_initial_directions` - Build the initial interpolation set using random directions (as opposed to coordinate directions). Default is :code:`True`.
25+
* :code:`init.random_directions_make_orthogonal` - If building initial interpolation set with random directions, whether or not these should be orthogonalized. Default is :code:`True`.
26+
* :code:`init.run_in_parallel` - If using random directions, whether or not to ask for all :code:`objfun` to be evaluated at all points without any intermediate processing. Default is :code:`False`.
27+
28+
Trust Region Management
29+
-----------------------
30+
* :code:`tr_radius.eta1` - Threshold for unsuccessful trust region iteration, :math:`\eta_1`. Default is 0.1.
31+
* :code:`tr_radius.eta2` - Threshold for very successful trust region iteration, :math:`\eta_2`. Default is 0.7.
32+
* :code:`tr_radius.gamma_dec` - Ratio to decrease :math:`\Delta_k` in unsuccessful iteration, :math:`\gamma_{dec}`. Default is 0.5 for smooth problems or 0.98 for noisy problems (i.e. :code:`objfun_has_noise = True`).
33+
* :code:`tr_radius.gamma_inc` - Ratio to increase :math:`\Delta_k` in very successful iterations, :math:`\gamma_{inc}`. Default is 2.
34+
* :code:`tr_radius.gamma_inc_overline` - Ratio of :math:`\|s_k\|` to increase :math:`\Delta_k` by in very successful iterations, :math:`\overline{\gamma}_{inc}`. Default is 4.
35+
* :code:`tr_radius.alpha1` - Ratio to decrease :math:`\rho_k` by when it is reduced, :math:`\alpha_1`. Default is 0.1 for smooth problems or 0.9 for noisy problems (i.e. :code:`objfun_has_noise = True`).
36+
* :code:`tr_radius.alpha2` - Ratio of :math:`\rho_k` to decrease :math:`\Delta_k` by when :math:`\rho_k` is reduced, :math:`\alpha_2`. Default is 0.5 for smooth problems or 0.95 for noisy problems (i.e. :code:`objfun_has_noise = True`).
37+
38+
Termination on Small Objective Value
39+
------------------------------------
40+
* :code:`model.abs_tol` - Tolerance on :math:`f(x_k)`; quit if :math:`f(x_k)` is below this value. Default is :math:`-10^{20}`.
41+
42+
Termination on Slow Progress
43+
----------------------------
44+
* :code:`slow.history_for_slow` - History used to determine whether the current iteration is 'slow'. Default is 5.
45+
* :code:`slow.thresh_for_slow` - Threshold for objective decrease used to determine whether the current iteration is 'slow'. Default is :math:`10^{-8}`.
46+
* :code:`slow.max_slow_iters` - Number of consecutive slow successful iterations before termination (or restart). Default is :code:`20*len(x0)`.
47+
48+
Stochastic Noise Information
49+
----------------------------
50+
* :code:`noise.quit_on_noise_level` - Flag to quit (or restart) if all :math:`f(y_t)` are within noise level of :math:`f(x_k)`. Default is :code:`False` for smooth problems or :code:`True` for noisy problems.
51+
* :code:`noise.scale_factor_for_quit` - Factor of noise level to use in termination criterion. Default is 1.
52+
* :code:`noise.multiplicative_noise_level` - Multiplicative noise level in :math:`f`. Can only specify one of multiplicative or additive noise levels. Default is :code:`None`.
53+
* :code:`noise.additive_noise_level` - Additive noise level in :math:`f`. Can only specify one of multiplicative or additive noise levels. Default is :code:`None`.
54+
55+
Interpolation Management
56+
--------------------------------
57+
* :code:`interpolation.precondition` - whether or not to scale the interpolation linear system to improve conditioning. Default is :code:`True`.
58+
* :code:`interpolation.minimum_change_hessian` - whether to solve the underdetermined quadratic interpolation problem by minimizing the Frobenius norm of the Hessian, or change in Hessian. Default is :code:`True`.
59+
60+
Multiple Restarts
61+
-----------------
62+
* :code:`restarts.use_restarts` - Whether to do restarts when :math:`\rho_k` reaches :math:`\rho_{end}`, or (optionally) when all points are within noise level of :math:`f(x_k)`. Default is :code:`False` for smooth problems or :code:`True` for noisy problems or when seeking a global minimum.
63+
* :code:`restarts.max_unsuccessful_restarts` - Maximum number of consecutive unsuccessful restarts allowed (i.e.~restarts which did not reduce the objective further). Default is 10.
64+
* :code:`restarts.max_unsuccessful_restarts_total` - Maximum number of total unsuccessful restarts allowed. Default is 20 when seeking a global minimum, otherwise it is :code:`maxfun` (i.e.~not restricted).
65+
* :code:`restarts.rhobeg_scale_after_unsuccessful_restart` - Factor to increase :math:`\rho_{beg}` by after unsuccessful restarts. Default is 1.1 when seeking a global minimum, otherwise it is 1.
66+
* :code:`restarts.rhoend_scale` - Factor to reduce :math:`\rho_{end}` by with each restart. Default is 1.
67+
* :code:`restarts.use_soft_restarts` - Whether to use soft or hard restarts. Default is :code:`True`.
68+
* :code:`restarts.soft.num_geom_steps` - For soft restarts, the number of points to move. Default is 3.
69+
* :code:`restarts.soft.move_xk` - For soft restarts, whether to preserve :math:`x_k`, or move it to the best new point evaluated. Default is :code:`True`.
70+
* :code:`restarts.hard.use_old_fk` - If using hard restarts, whether or not to recycle the objective value at the best iterate found when performing a restart. This saves one objective evaluation. Default is :code:`True`.
71+
* :code:`restarts.soft.max_fake_successful_steps` - The maximum number of successful steps in a given run where the new (smaller) objective value is larger than the best value found in a previous run. Default is :code:`maxfun`, the input to :code:`pybobyqa.solve()`.
72+
* :code:`restarts.auto_detect` - Whether or not to automatically determine when to restart. This is an extra condition, and restarts can still be triggered by small trust region radius, etc. Default is :code:`True`.
73+
* :code:`restarts.auto_detect.history` - How many iterations of data on model changes and trust region radii to store. There are two criteria used: trust region radius decreases (no increases over the history, more decreases than no changes), and change in model Jacobian (consistently increasing trend as measured by slope and correlation coefficient of line of best fit). Default is 30.
74+
* :code:`restarts.auto_detect.min_chg_model_slope` - Minimum rate of increase of :math:`\log(\|g_k-g_{k-1}\|)` and :math:`\log(\|H_k-H_{k-1}\|_F)` over the past iterations to cause a restart. Default is 0.015.
75+
* :code:`restarts.auto_detect.min_correl` - Minimum correlation of the data sets :math:`(k, \log(\|g_k-g_{k-1}\|))` and :math:`(k, \log(\|H_k-H_{k-1}\|_F))` required to cause a restart. Default is 0.1.
76+
77+
78+
References
79+
----------
80+
81+
.. [CFMR2018]
82+
C. Cartis, J. Fiala, B. Marteau and L. 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).
83+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Diagnostic Information
2+
======================
3+
In :doc:`userguide`, we saw that the output of Py-BOBYQA returns a container which includes diagnostic information about the progress of the algorithm (:code:`soln.diagnostic_info`). This object is a `Pandas <http://pandas.pydata.org/>`_ DataFrame, with one row per iteration of the algorithm. In this section, we explain the meaning of each type of output (the columns of the DataFrame).
4+
5+
To save this information to a CSV file, use:
6+
7+
.. code-block:: python
8+
9+
# Previously: define objfun and x0
10+
11+
# Turn on diagnostic information
12+
user_params = {'logging.save_diagnostic_info': True}
13+
14+
# Call Py-BOBYQA
15+
soln = pybobyqa.solve(objfun, x0, user_params=user_params)
16+
17+
# Save diagnostic info to CSV
18+
soln.diagnostic_info.to_csv("myfile.csv")
19+
20+
Depending on exactly how Py-BOBYQA terminates, the last row of results may not be fully populated.
21+
22+
Current Iterate
23+
---------------
24+
* :code:`xk` - Best point found so far (current iterate). This is only saved if :code:`user_params['logging.save_xk'] = True`.
25+
* :code:`fk` - The value of :math:`f` at the current iterate.
26+
27+
Trust Region
28+
------------
29+
* :code:`rho` - The lower bound on the trust region radius :math:`\rho_k`.
30+
* :code:`delta` - The trust region radius :math:`\Delta_k`.
31+
* :code:`norm_sk` - The norm of the trust region step :math:`\|s_k\|`.
32+
33+
Model Interpolation
34+
-------------------
35+
* :code:`npt` - The number of interpolation points.
36+
* :code:`interpolation_error` - The sum of squares of the interpolation errors from the interpolated model.
37+
* :code:`interpolation_condition_number` - The condition number of the matrix in the interpolation linear system.
38+
* :code:`interpolation_change_g_norm` - The norm of the change in model gradient at this iteration, :math:`\|g_k-g_{k-1}\|`.
39+
* :code:`interpolation_change_H_norm` - The Frobenius norm of the change in model Hessian at this iteration, :math:`\|H_k-H_{k-1}\|_F`.
40+
* :code:`poisedness` - The smallest value of :math:`\Lambda` for which the current interpolation set :math:`Y_k` is :math:`\Lambda`-poised in the current trust region. This is the most expensive piece of information to compute, and is only computed if :code:`user_params['logging.save_poisedness' = True`.
41+
* :code:`max_distance_xk` - The maximum distance from any interpolation point to the current iterate.
42+
* :code:`norm_gk` - The norm of the model gradient :math:`\|g_k\|`.
43+
44+
Iteration Count
45+
---------------
46+
* :code:`nruns` - The number of times the algorithm has been restarted.
47+
* :code:`nf` - The number of objective evaluations so far (see :code:`soln.nf`)
48+
* :code:`nx` - The number of points at which the objective has been evaluated so far (see :code:`soln.nx`)
49+
* :code:`nsamples` - The total number of objective evaluations used for all current interpolation points.
50+
* :code:`iter_this_run` - The number of iterations since the last restart.
51+
* :code:`iters_total` - The total number of iterations so far.
52+
53+
Algorithm Progress
54+
------------------
55+
* :code:`iter_type` - A text description of what type of iteration we had (e.g. Successful, Safety, etc.)
56+
* :code:`ratio` - The ratio of actual to predicted objective reduction in the trust region step.
57+
* :code:`slow_iter` - Equal to 1 if the current iteration is successful but slow, 0 if is successful but not slow, and -1 if was not successful.
58+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
13+
Version 1.0.2 (20 Jun 2018)
14+
---------------------------
15+
* Extra optional input :code:`args` which passes through arguments for :code:`objfun` (pull request from `logangrado <https://github.com/logangrado>`_).
16+
* Bug fixes: default parameters for reduced initialization cost regime, returning correct value from safety steps, retrieving dependencies during installation.
17+
18+
Version 1.1a0 (17 Jul 2018)
19+
---------------------------
20+
* Extra parameters to control the trust region radius over multiple restarts, designed for global optimization.
21+
* New input flag :code:`seek_global_minimum` to set sensible default parameters for global optimization. New example script to demonstrate this functionality.
22+
* Bug fix: default trust region radius when scaling variables within bounds.
23+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.. Py-BOBYQA documentation master file, created by
2+
sphinx-quickstart on Wed Nov 8 10:59:20 2017.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Py-BOBYQA: Derivative-Free Optimizer for Bound-Constrained Minimization
7+
=======================================================================
8+
9+
**Release:** |version|
10+
11+
**Date:** |today|
12+
13+
**Author:** `Lindon Roberts <lindon.roberts@maths.ox.ac.uk>`_
14+
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.
16+
17+
That is, Py-BOBYQA solves
18+
19+
.. math::
20+
21+
\min_{x\in\mathbb{R}^n} &\quad f(x)\\
22+
\text{s.t.} &\quad a \leq x \leq b
23+
24+
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 <https://arxiv.org/abs/1804.00154>`_, technical report, University of Oxford, (2018).
25+
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+
28+
**New feature: global optimization heuristic (July 2018)!** Py-BOBYQA now has a heuristic for global optimization (see :doc:`userguide` for details). As this is a heuristic, there are no guarantees it will find a global minimum, but it is more likely to escape local minima if there are better values nearby.
29+
30+
Py-BOBYQA is released under the GNU General Public License. Please `contact NAG <http://www.nag.com/content/worldwide-contact-information>`_ for alternative licensing.
31+
32+
.. toctree::
33+
:maxdepth: 2
34+
:caption: Contents:
35+
36+
install
37+
info
38+
userguide
39+
advanced
40+
diagnostic
41+
history
42+
43+
Acknowledgements
44+
----------------
45+
This software was developed under the supervision of `Coralia Cartis <https://www.maths.ox.ac.uk/people/coralia.cartis>`_, and was supported by the EPSRC Centre For Doctoral Training in `Industrially Focused Mathematical Modelling <https://www.maths.ox.ac.uk/study-here/postgraduate-study/industrially-focused-mathematical-modelling-epsrc-cdt>`_ (EP/L015803/1) in collaboration with the `Numerical Algorithms Group <http://www.nag.com/>`_.
46+

0 commit comments

Comments
 (0)