Git Product home page Git Product logo

lbfgslite.jl's Introduction

LBFGSLite

Stable Dev Build Status Coverage Aqua

Julia port of the LBFGS-Lite C++ header-only library for unconstrained optimization.

Features

From LBFGS-Lite:

Usage

Minimize the function

$$ f(x) = 1 + \frac{1}{2}(\sin^2 x_1 + \sin^2 x_2) $$

starting from x₀ = [-2.0, 1.0] using optimize:

function fg!(x, dx)
    @. dx = sin(x) * cos(x)
    return 1 + sum(abs2  sin, x) / 2
end

x₀ = Float64[-2.0, 1.0]
params = LBFGSParams{Float64}()
x, fx, st = optimize(fg!, x₀, params)

@assert isapprox(x, [-π, 0.0]; atol = 1e-6)
@assert isapprox(fx, 1.0; atol = 1e-12)
@assert Int(st) == 0

Preallocate a workspace and solve the problem in-place using optimize!:

x = copy(x₀) # will be overwritten
params = LBFGSParams{Float64}()
work = LBFGSWorkspace(x, params) # allocate buffers
_, fx, st = optimize!(fg!, x, work, params)

@assert isapprox(x, [-π, 0.0]; atol = 1e-6)
@assert isapprox(fx, 1.0; atol = 1e-12)
@assert Int(st) == 0

lbfgslite.jl's People

Contributors

jondeuce avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.