Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame] | 1 | .. default-domain:: cpp |
| 2 | |
| 3 | .. cpp:namespace:: ceres |
| 4 | |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 5 | ==== |
| 6 | Why? |
| 7 | ==== |
| 8 | .. _chapter-features: |
| 9 | |
| 10 | * **Code Quality** - Ceres Solver has been used in production at |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame] | 11 | Google since 2011. It is clean, extensively tested and well |
| 12 | documented code that is actively developed and supported. |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 13 | |
| 14 | * **Modeling API** - It is rarely the case that one starts with the |
| 15 | exact and complete formulation of the problem that one is trying to |
| 16 | solve. Ceres's modeling API has been designed so that the user can |
| 17 | easily build and modify the objective function, one term at a |
| 18 | time. And to do so without worrying about how the solver is going to |
| 19 | deal with the resulting changes in the sparsity/structure of the |
| 20 | underlying problem. |
| 21 | |
| 22 | - **Derivatives** Supplying derivatives is perhaps the most tedious |
| 23 | and error prone part of using an optimization library. Ceres |
| 24 | ships with `automatic`_ and `numeric`_ differentiation. So you |
| 25 | never have to compute derivatives by hand (unless you really want |
| 26 | to). Not only this, Ceres allows you to mix automatic, numeric and |
| 27 | analytical derivatives in any combination that you want. |
| 28 | |
| 29 | - **Robust Loss Functions** Most non-linear least squares problems |
| 30 | involve data. If there is data, there will be outliers. Ceres |
| 31 | allows the user to *shape* their residuals using a |
| 32 | :class:`LossFunction` to reduce the influence of outliers. |
| 33 | |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame] | 34 | - **Manifolds** In many cases, some parameters lie on a manifold |
| 35 | other than Euclidean space, e.g., rotation matrices. In such |
| 36 | cases, the user can specify the geometry of the local tangent |
| 37 | space by specifying a :class:`Manifold` object. |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 38 | |
| 39 | * **Solver Choice** Depending on the size, sparsity structure, time & |
| 40 | memory budgets, and solution quality requirements, different |
| 41 | optimization algorithms will suit different needs. To this end, |
| 42 | Ceres Solver comes with a variety of optimization algorithms: |
| 43 | |
| 44 | - **Trust Region Solvers** - Ceres supports Levenberg-Marquardt, |
| 45 | Powell's Dogleg, and Subspace dogleg methods. The key |
| 46 | computational cost in all of these methods is the solution of a |
| 47 | linear system. To this end Ceres ships with a variety of linear |
| 48 | solvers - dense QR and dense Cholesky factorization (using |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame] | 49 | `Eigen`_, `LAPACK`_ or `CUDA`_) for dense problems, sparse |
| 50 | Cholesky factorization (`SuiteSparse`_, `Apple's Accelerate`_, |
| 51 | `Eigen`_) for large sparse problems, custom Schur complement based |
| 52 | dense, sparse, and iterative linear solvers for `bundle |
| 53 | adjustment`_ problems. |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 54 | |
| 55 | - **Line Search Solvers** - When the problem size is so large that |
| 56 | storing and factoring the Jacobian is not feasible or a low |
| 57 | accuracy solution is required cheaply, Ceres offers a number of |
| 58 | line search based algorithms. This includes a number of variants |
| 59 | of Non-linear Conjugate Gradients, BFGS and LBFGS. |
| 60 | |
| 61 | * **Speed** - Ceres Solver has been extensively optimized, with C++ |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame] | 62 | templating, hand written linear algebra routines and modern C++ |
| 63 | threads based multithreading of the Jacobian evaluation and the |
| 64 | linear solvers. |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 65 | |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame] | 66 | * **GPU Acceleration** If your system supports `CUDA`_ then Ceres |
| 67 | Solver can use the Nvidia GPU on your system to speed up the solver. |
| 68 | |
| 69 | * **Solution Quality** Ceres is the `best performing`_ solver on the |
| 70 | NIST problem set used by Mondragon and Borchers for benchmarking |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 71 | non-linear least squares solvers. |
| 72 | |
| 73 | * **Covariance estimation** - Evaluate the sensitivity/uncertainty of |
| 74 | the solution by evaluating all or part of the covariance |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame] | 75 | matrix. Ceres is one of the few solvers that allows you to do this |
| 76 | analysis at scale. |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 77 | |
| 78 | * **Community** Since its release as an open source software, Ceres |
| 79 | has developed an active developer community that contributes new |
| 80 | features, bug fixes and support. |
| 81 | |
| 82 | * **Portability** - Runs on *Linux*, *Windows*, *Mac OS X*, *Android* |
| 83 | *and iOS*. |
| 84 | |
| 85 | * **BSD Licensed** The BSD license offers the flexibility to ship your |
| 86 | application |
| 87 | |
| 88 | .. _best performing: https://groups.google.com/forum/#!topic/ceres-solver/UcicgMPgbXw |
| 89 | .. _bundle adjustment: http://en.wikipedia.org/wiki/Bundle_adjustment |
| 90 | .. _SuiteSparse: http://www.cise.ufl.edu/research/sparse/SuiteSparse/ |
| 91 | .. _Eigen: http://eigen.tuxfamily.org/ |
| 92 | .. _LAPACK: http://www.netlib.org/lapack/ |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 93 | .. _automatic: http://en.wikipedia.org/wiki/Automatic_differentiation |
| 94 | .. _numeric: http://en.wikipedia.org/wiki/Numerical_differentiation |
Austin Schuh | 3de38b0 | 2024-06-25 18:25:10 -0700 | [diff] [blame] | 95 | .. _CUDA : https://developer.nvidia.com/cuda-toolkit |
| 96 | .. _Apple's Accelerate: https://developer.apple.com/documentation/accelerate/sparse_solvers |