NuriKit v0.1.0b2
Loading...
Searching...
No Matches
nuri::LBfgs< Impl > Class Template Reference

L-BFGS(-B) minimizer. More...

#include <nuri/algo/optim.h>

Inheritance diagram for nuri::LBfgs< Impl >:
Collaboration diagram for nuri::LBfgs< Impl >:

Public Member Functions

 LBfgs (MutRef< ArrayXd > x, Impl &&impl, const int m=10)
 Prepare L-BFGS(-B) minimization algorithm.
template<class FuncGrad>
LbfgsResult minimize (FuncGrad fg, double factr=1e+7, double pgtol=1e-5, int maxiter=15000, int maxls=20)
 Minimize a function using L-BFGS(-B) algorithm.

Detailed Description

template<class Impl>
class nuri::LBfgs< Impl >

L-BFGS(-B) minimizer.

See also
l_bfgs_b, l_bfgs

References:

  • RH Byrd, P Lu, J Nocedal and C Zhu. SIAM J. Sci. Stat. Comput. 1995, 16 (5), 1190-1208. DOI:10.1137/0916069
  • C Zhu, RH Byrd, J Nocedal. ACM Trans. Math. Softw. 1997, 23 (4), 550-560. DOI:10.1145/279232.279236
  • JL Morales, J Nocedal. ACM Trans. Math. Softw. 2011, 38 (1), 7. DOI:10.1145/2049662.2049669

This implementation is based on the C implementation of L-BFGS-B in the SciPy library, which is a translation of the original Fortran code by Ciyou Zhu, Richard Byrd, and Jorge Noceda. Both are released under the BSD 3-Clause License and the original license is included below.

Copyright (c) 2011 Ciyou Zhu, Richard Byrd, Jorge Nocedal and Jose Luis
Morales.
Copyright (c) 2001-2002 Enthought, Inc. 2003-2024, SciPy Developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Constructor & Destructor Documentation

◆ LBfgs()

template<class Impl>
nuri::LBfgs< Impl >::LBfgs ( MutRef< ArrayXd > x,
Impl && impl,
const int m = 10 )
inline

Prepare L-BFGS(-B) minimization algorithm.

Parameters
xInitial guess. Will be modified in-place.
implImplementation object.
mThe maximum number of variable metric corrections used to define the limited memory matrix.

Member Function Documentation

◆ minimize()

template<class Impl>
template<class FuncGrad>
LbfgsResult nuri::LBfgs< Impl >::minimize ( FuncGrad fg,
double factr = 1e+7,
double pgtol = 1e-5,
int maxiter = 15000,
int maxls = 20 )

Minimize a function using L-BFGS(-B) algorithm.

Template Parameters
FuncGradFunction object that computes the function value and gradient. Function value should be returned and gradient should be updated in the input gradient vector.
Parameters
fgFunction object.
factrStop when function value changes by less than this factor times the machine precision.
pgtolStop when the projected gradient is less than this value.
maxiterMaximum number of iterations.
maxlsMaximum number of line search steps.
Returns
A struct with the result code, number of iterations, final function value, and final gradient.

The documentation for this class was generated from the following file: