All Projects → PatWie → Cppnumericalsolvers

PatWie / Cppnumericalsolvers

Licence: mit
a lightweight C++17 library of numerical optimization methods for nonlinear functions (Including L-BFGS-B for TensorFlow)

Programming Languages

cpp
1120 projects
cpp11
221 projects
cpp14
131 projects

Projects that are alternatives of or similar to Cppnumericalsolvers

Optim
OptimLib: a lightweight C++ library of numerical optimization methods for nonlinear functions
Stars: ✭ 411 (-35.58%)
Mutual labels:  optimization-algorithms, gradient-descent, eigen, optimization
qpmad
ROS-compatible Eigen-based Goldfarb-Idnani quadratic programming solver
Stars: ✭ 41 (-93.57%)
Mutual labels:  optimization, solver, eigen, optimization-algorithms
osqp
The Operator Splitting QP Solver
Stars: ✭ 929 (+45.61%)
Mutual labels:  optimization, solver
least-squares-cpp
A single header-only C++ library for least squares fitting.
Stars: ✭ 46 (-92.79%)
Mutual labels:  optimization, gradient-descent
Poisson blend
Seamless copy-and-paste of images with Poisson Blending.
Stars: ✭ 277 (-56.58%)
Mutual labels:  mathematics, eigen
Pagmo2
A C++ platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
Stars: ✭ 540 (-15.36%)
Mutual labels:  optimization-algorithms, optimization
dfogn
DFO-GN: Derivative-Free Optimization using Gauss-Newton
Stars: ✭ 20 (-96.87%)
Mutual labels:  optimization, optimization-algorithms
Mather
zzllrr mather(an offline tool for Math learning, education and research)小乐数学,离线可用的数学学习(自学或教学)、研究辅助工具。计划覆盖数学全部学科的解题、作图、演示、探索工具箱。目前是演示Demo版(抛转引玉),但已经支持数学公式编辑显示,部分作图功能,部分学科,如线性代数、离散数学的部分解题功能。最终目标是推动专业数学家、编程专家、教育工作者、科普工作者共同打造出更加专业级的Mather数学工具
Stars: ✭ 270 (-57.68%)
Mutual labels:  mathematics, solver
FrankWolfe.jl
Julia implementation for various Frank-Wolfe and Conditional Gradient variants
Stars: ✭ 47 (-92.63%)
Mutual labels:  optimization, optimization-algorithms
Ifopt
An Eigen-based, light-weight C++ Interface to Nonlinear Programming Solvers (Ipopt, Snopt)
Stars: ✭ 372 (-41.69%)
Mutual labels:  eigen, optimization
Ensmallen
A header-only C++ library for numerical optimization --
Stars: ✭ 436 (-31.66%)
Mutual labels:  optimization-algorithms, optimization
gibbous
Convex optimization for java and scala, built on Apache Commons Math
Stars: ✭ 17 (-97.34%)
Mutual labels:  optimization, optimization-algorithms
Solid
🎯 A comprehensive gradient-free optimization framework written in Python
Stars: ✭ 546 (-14.42%)
Mutual labels:  optimization-algorithms, optimization
Vroom
Vehicle Routing Open-source Optimization Machine
Stars: ✭ 533 (-16.46%)
Mutual labels:  solver, optimization
Nonlinear-Optimization-Algorithms
MATLAB implementations of a variety of nonlinear programming algorithms.
Stars: ✭ 86 (-86.52%)
Mutual labels:  optimization, optimization-algorithms
ForBES
Generic and efficient MATLAB solver for nonsmooth optimization problems
Stars: ✭ 19 (-97.02%)
Mutual labels:  optimization, optimization-algorithms
procrustes
Python library for finding the optimal transformation(s) that makes two matrices as close as possible to each other.
Stars: ✭ 48 (-92.48%)
Mutual labels:  optimization, optimization-algorithms
Totsu
First-order conic solver for convex optimization problems
Stars: ✭ 18 (-97.18%)
Mutual labels:  optimization, solver
Ojalgo
oj! Algorithms
Stars: ✭ 336 (-47.34%)
Mutual labels:  optimization-algorithms, optimization
Teaching
Teaching Materials for Dr. Waleed A. Yousef
Stars: ✭ 435 (-31.82%)
Mutual labels:  mathematics, optimization

CppOptimizationLibrary (A header-only C++17 optimization library)

Build Status

It has been now 6 years since the initial release. I did some mistakes in the previous design of this library and some features felt a bit ad-hoc. Given that C++14 is around and C++17 will become mainstream, I will take the opportunity to correct some of these mistakes and simplify things here in this v2-branch.

This branch is under development.

For the previous fully-tested version please refer to the master-branch of this repository.

Have you ever looked for a C++ function fminsearch, which is easy to use without adding tons of dependencies and without editing many setting-structs and without dependencies?

Want a full example?

    using FunctionXd = cppoptlib::function::Function<double>;

    class Rosenbrock : public FunctionXd {
      public:
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW

        double operator()(const Eigen::VectorXd &x) {
            const double t1 = (1 - x[0]);
            const double t2 = (x[1] - x[0] * x[0]);
            return   t1 * t1 + 100 * t2 * t2;
        }
    };
    int main(int argc, char const *argv[]) {
        using Solver = cppoptlib::solver::Bfgs<Rosenbrock>;

        Rosenbrock f;
        Eigen::VectorXd x(2);
        x << -1, 2;

        // Evaluate
        auto state = f.Eval(x);
        std::cout << f(x) << " = " << state.value << std::endl;
        std::cout << state.x << std::endl;
        std::cout << state.gradient << std::endl;
        std::cout << state.hessian << std::endl;

        std::cout << cppoptlib::utils::IsGradientCorrect(f, x) << std::endl;
        std::cout << cppoptlib::utils::IsHessianCorrect(f, x) << std::endl;

        Solver solver;

        auto [solution, solver_state] = solver.Minimize(f, x);
        std::cout << "argmin " << solution.x.transpose() << std::endl;
        std::cout << "f in argmin " << solution.value << std::endl;
        std::cout << "iterations " << solver_state.num_iterations << std::endl;
        std::cout << "solver status " << solver_state.status << std::endl;
        return 0;
    }

To use another solver, simply replace BfgsSolver by another name.

Changes

  • Instead of nesting information in each class, this implementation will handle and update states of functions and solvers.
  • This will follow clang-format google-code-style and will be compliant cpplint.
  • This will drop Support for TensorFlow and Matlab (maybe Python will be an option).

References

L-BFGS-B: A LIMITED MEMORY ALGORITHM FOR BOUND CONSTRAINED OPTIMIZATION Richard H. Byrd, Peihuang Lu, Jorge Nocedal and Ciyou Zhu

L-BFGS: Numerical Optimization, 2nd ed. New York: Springer J. Nocedal and S. J. Wright

Citing this implementation

I see some interests in citing this implementation. Please use the following bibtex entry, if you consider to cite this implementation:

@misc{wieschollek2016cppoptimizationlibrary,
  title={CppOptimizationLibrary},
  author={Wieschollek, Patrick},
  year={2016},
  howpublished={\url{https://github.com/PatWie/CppNumericalSolvers}},
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].