Skip to content

Commit 8db189b

Browse files
committed
Added Github pages support
1 parent f2b3523 commit 8db189b

Some content is hidden

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

57 files changed

+18544
-5
lines changed

docs/.nojekyll

Whitespace-only changes.

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SPHINXOPTS =
66
SPHINXBUILD = python3 -msphinx
77
SPHINXPROJ = DFOLS
88
SOURCEDIR = .
9-
BUILDDIR = _build
9+
BUILDDIR = build
1010

1111
# Put it first so that "make" without argument is like "make help".
1212
help:
29.2 KB
Loading
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
Advanced Usage
2+
==============
3+
This section describes different optional user parameters available in DFO-LS.
4+
5+
In the last section (:doc:`userguide`), we introduced :code:`dfols.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:`dfols.solve()` (and not by inspecting :code:`objfun`, for instance).
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+
* :code:`logging.save_rk` - If saving diagnostic information, whether to include the full vector :math:`[r_1(x_k)\:\cdots\:r_m(x_k)]`. The value :math:`f(x_k)` is always included. Default is :code:`False`.
22+
23+
Initialization of Points
24+
------------------------
25+
* :code:`init.random_initial_directions` - Build the initial interpolation set using random directions (as opposed to coordinate directions). Default is :code:`True`.
26+
* :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`.
27+
* :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`.
28+
29+
Trust Region Management
30+
-----------------------
31+
* :code:`tr_radius.eta1` - Threshold for unsuccessful trust region iteration, :math:`\eta_1`. Default is 0.1.
32+
* :code:`tr_radius.eta2` - Threshold for very successful trust region iteration, :math:`\eta_2`. Default is 0.7.
33+
* :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`).
34+
* :code:`tr_radius.gamma_inc` - Ratio to increase :math:`\Delta_k` in very successful iterations, :math:`\gamma_{inc}`. Default is 2.
35+
* :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.
36+
* :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`).
37+
* :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`).
38+
39+
Termination on Small Objective Value
40+
------------------------------------
41+
* :code:`model.abs_tol` - Tolerance on :math:`f(x_k)`; quit if :math:`f(x_k)` is below this value. Default is :math:`10^{-12}`.
42+
* :code:`model.rel_tol` - Relative tolerance on :math:`f(x_k)`; quit if :math:`f(x_k)/f(x_0)` is below this value. Default is :math:`10^{-20}`.
43+
44+
Termination on Slow Progress
45+
----------------------------
46+
* :code:`slow.history_for_slow` - History used to determine whether the current iteration is 'slow'. Default is 5.
47+
* :code:`slow.thresh_for_slow` - Threshold for objective decrease used to determine whether the current iteration is 'slow'. Default is :math:`10^{-4}`.
48+
* :code:`slow.max_slow_iters` - Number of consecutive slow successful iterations before termination (or restart). Default is :code:`20*len(x0)`.
49+
50+
Stochastic Noise Information
51+
----------------------------
52+
* :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.
53+
* :code:`noise.scale_factor_for_quit` - Factor of noise level to use in termination criterion. Default is 1.
54+
* :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`.
55+
* :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`.
56+
57+
Interpolation Management
58+
--------------------------------
59+
* :code:`interpolation.precondition` - whether or not to scale the interpolation linear system to improve conditioning. Default is :code:`True`.
60+
61+
Regression Model Management
62+
---------------------------
63+
* :code:`regression.num_extra_steps` - In successful iterations, the number of extra points (other than accepting the trust region step) to move, useful when :math:`|Y_k|>n+1` (:math:`n` is :code:`len(x0)`). Default is 0.
64+
* :code:`regression.increase_num_extra_steps_with_restart` - The amount to increase :code:`regression.num_extra_steps` by with each restarts, for instance if increasing the number of points with each restart. Default is 0.
65+
* :code:`regression.momentum_extra_steps` - If moving extra points in successful iterations, whether to use the 'momentum' method. If not, uses geometry-improving steps. Default is :code:`False`.
66+
67+
Multiple Restarts
68+
-----------------
69+
* :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.
70+
* :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.
71+
* :code:`restarts.rhoend_scale` - Factor to reduce :math:`\rho_{end}` by with each restart. Default is 1.
72+
* :code:`restarts.use_soft_restarts` - Whether to use soft or hard restarts. Default is :code:`True`.
73+
* :code:`restarts.soft.num_geom_steps` - For soft restarts, the number of points to move. Default is 3.
74+
* :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`.
75+
* :code:`restarts.increase_npt` - Whether to increase :math:`|Y_k|` with each restart. Default is :code:`False`.
76+
* :code:`restarts.increase_npt_amt` - Amount to increase :math:`|Y_k|` by with each restart. Default is 1.
77+
* :code:`restarts.hard.increase_ndirs_initial_amt` - Amount to increase :code:`growing.ndirs_initial` by with each hard restart. To avoid a growing phase, it is best to set it to the same value as :code:`restarts.increase_npt_amt`. Default is 1.
78+
* :code:`restarts.hard.use_old_rk` - 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`.
79+
* :code:`restarts.max_npt` - Maximum allowed value of :math:`|Y_k|`, useful if increasing with each restart. Default is :code:`npt`, the input parameter to :code:`dfols.solve()`.
80+
* :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:`dfols.solve()`.
81+
* :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`.
82+
* :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.
83+
* :code:`restarts.auto_detect.min_chgJ_slope` - Minimum rate of increase of :math:`\log(\|J_k-J_{k-1}\|_F)` over the past iterations to cause a restart. Default is 0.015.
84+
* :code:`restarts.auto_detect.min_correl` - Minimum correlation of the data set :math:`(k, \log(\|J_k-J_{k-1}\|_F))` required to cause a restart. Default is 0.1.
85+
86+
Dynamically Growing Initial Set
87+
-------------------------------
88+
* :code:`growing.ndirs_initial` - Number of initial points to add (excluding :math:`x_k`). Default is :code:`npt-1`.
89+
* :code:`growing.num_new_dirns_each_iter` - Number of new search directions to add with each iteration where we do not have a full set of search directions. Default is 1.
90+
* :code:`growing.delta_scale_new_dirns` - When adding new search directions, the length of the step as a multiple of :math:`\Delta_k`. Default is 1, but if setting :code:`growing.perturb_trust_region_step=True` should be made smaller (e.g. 0.1).
91+
* :code:`growing.do_geom_steps` - While still growing the initial set, whether to do geometry-improving steps in the trust region algorithm, as per the usual algorithm. Default is :code:`False`.
92+
* :code:`growing.safety.do_safety_step` - While still growing the initial set, whether to perform safety steps, or the regular trust region steps. Default is :code:`True`.
93+
* :code:`growing.safety.reduce_delta` - While still growing the initial set, whether to reduce :math:`\Delta_k` in safety steps. Default is :code:`False`.
94+
* :code:`growing.safety.full_geom_step` - While still growing the initial set, whether to do a full geometry-improving step within safety steps (the same as the post-growing phase of the algorithm). Since this involves reducing :math:`\Delta_k`, cannot be :code:`True` if :code:`growing.safety.reduce_delta` is :code:`True`. Default is :code:`False`.
95+
* :code:`growing.full_rank.use_full_rank_interp` - Whether to perturb the interpolated :math:`J_k` to make it full rank, allowing the trust region step to include components in the full search space. If :code:`True`, setting :code:`growing.num_new_dirns_each_iter` to 0 is recommended. Default is :code:`False`.
96+
* :code:`growing.full_rank.scale_factor` - Magnitude of extra components added to :math:`J_k`. Default is :math:`10^{-2}`.
97+
* :code:`growing.full_rank.svd_scale_factor` - Floor singular values of :math:`J_k` at this factor of the last nonzero value. Default is 1.
98+
* :code:`growing.full_rank.min_sing_val` - Absolute floor on singular values of :math:`J_k`. Default is :math:`10^{-6}`.
99+
* :code:`growing.full_rank.svd_max_jac_cond` - Cap on condition number of :math:`J_k` after applying floors to singular values (effectively another floor on the smallest singular value, since the largest singular value is fixed). Default is :math:`10^8`.
100+
* :code:`growing.reset_delta` - Whether or not to reset trust region radius :math:`\Delta_k` to its initial value at the end of the growing phase. Default is :code:`False`.
101+
* :code:`growing.reset_rho` - Whether or not to reset trust region radius lower bound :math:`\rho_k` to its initial value at the end of the growing phase. Default is :code:`False`.
102+
* :code:`growing.gamma_dec` - Trust region decrease parameter during the growing phase. Default is :code:`tr_radius.gamma_dec`.
103+
* :code:`growing.perturb_trust_region_step` - Whether to perturb the trust region step by an orthogonal direction not yet searched. This is an alternative to :code:`growing.full_rank.use_full_rank_interp`. Default is :code:`False`.
104+
105+
106+
References
107+
----------
108+
109+
.. [CFMR2018]
110+
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).
111+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Diagnostic Information
2+
======================
3+
In :doc:`userguide`, we saw that the output of DFO-LS 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 DFO-LS
15+
soln = dfols.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 DFO-LS 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:`rk` - The vector of residuals at the current iterate. This is only saved if :code:`user_params['logging.save_rk'] = True`.
26+
* :code:`fk` - The value of :math:`f` at the current iterate.
27+
28+
Trust Region
29+
------------
30+
* :code:`rho` - The lower bound on the trust region radius :math:`\rho_k`.
31+
* :code:`delta` - The trust region radius :math:`\Delta_k`.
32+
* :code:`norm_sk` - The norm of the trust region step :math:`\|s_k\|`.
33+
34+
Model Interpolation
35+
-------------------
36+
* :code:`npt` - The number of interpolation points.
37+
* :code:`interpolation_error` - The sum of squares of the interpolation errors from the interpolated model.
38+
* :code:`interpolation_condition_number` - The condition number of the matrix in the interpolation linear system.
39+
* :code:`interpolation_change_J_norm` - The Frobenius norm of the change in Jacobian at this iteration, :math:`\|J_k-J_{k-1}\|_F`.
40+
* :code:`interpolation_total_residual` - The total residual from the interpolation optimization problem.
41+
* :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`.
42+
* :code:`max_distance_xk` - The maximum distance from any interpolation point to the current iterate.
43+
* :code:`norm_gk` - The norm of the model gradient :math:`\|g_k\|`.
44+
45+
Iteration Count
46+
---------------
47+
* :code:`nruns` - The number of times the algorithm has been restarted.
48+
* :code:`nf` - The number of objective evaluations so far (see :code:`soln.nf`)
49+
* :code:`nx` - The number of points at which the objective has been evaluated so far (see :code:`soln.nx`)
50+
* :code:`nsamples` - The total number of objective evaluations used for all current interpolation points.
51+
* :code:`iter_this_run` - The number of iterations since the last restart.
52+
* :code:`iters_total` - The total number of iterations so far.
53+
54+
Algorithm Progress
55+
------------------
56+
* :code:`iter_type` - A text description of what type of iteration we had (e.g. Successful, Safety, etc.)
57+
* :code:`ratio` - The ratio of actual to predicted objective reduction in the trust region step.
58+
* :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.
59+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Version History
2+
===============
3+
This section lists the different versions of DFO-LS and the updates between them.
4+
5+
Version 1.0 (6 Feb 2018)
6+
------------------------
7+
* Initial release of DFO-LS
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 DFO-LS.
12+
13+
Version 1.0.2 (20 Jun 2018)
14+
---------------------------
15+
* Extra optional input :code:`args` which passes through arguments for :code:`objfun`.
16+
* Bug fixes: default parameters for reduced initialization cost regime, returning correct value from safety steps, retrieving dependencies during installation.
17+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.. DFO-LS documentation master file, created by
2+
You can adapt this file completely to your liking, but it should at least
3+
contain the root `toctree` directive.
4+
5+
DFO-LS: Derivative-Free Optimizer for Least-Squares Minimization
6+
================================================================
7+
8+
**Release:** |version|
9+
10+
**Date:** |today|
11+
12+
**Author:** `Lindon Roberts <[email protected]>`_
13+
14+
DFO-LS is a flexible package for finding local solutions to nonlinear least-squares minimization problems (with optional bound constraints), without requiring any derivatives of the objective. DFO-LS stands for Derivative-Free Optimizer for Least-Squares.
15+
16+
That is, DFO-LS solves
17+
18+
.. math::
19+
20+
\min_{x\in\mathbb{R}^n} &\quad f(x) := \sum_{i=1}^{m}r_{i}(x)^2 \\
21+
\text{s.t.} &\quad a \leq x \leq b
22+
23+
Full details of the DFO-LS 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). DFO-LS is a more flexible version of `DFO-GN <https://github.com/numericalalgorithmsgroup/dfogn>`_.
24+
25+
If you are interested in solving general optimization problems (without a least-squares structure), you may wish to try `Py-BOBYQA <https://github.com/numericalalgorithmsgroup/pybobyqa>`_, which has many of the same features as DFO-LS.
26+
27+
DFO-LS is released under the GNU General Public License. Please `contact NAG <http://www.nag.com/content/worldwide-contact-information>`_ for alternative licensing.
28+
29+
.. toctree::
30+
:maxdepth: 2
31+
:caption: Contents:
32+
33+
install
34+
info
35+
userguide
36+
advanced
37+
diagnostic
38+
history
39+
40+
Acknowledgements
41+
----------------
42+
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/>`_.
43+

0 commit comments

Comments
 (0)