numeric-optimization-ad: Wrapper of numeric-optimization package for using with AD package

[ algorithms, bsd3, library, math, optimisation, optimization ] [ Propose Tags ] [ Report a vulnerability ]

Modules

[Index] [Quick Jump]

Flags

Manual Flags

NameDescriptionDefault
build-examples

Build example programs

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1
Change log CHANGELOG.md
Dependencies ad (>=4.3.6 && <4.6), base (>=4.12 && <5), data-default-class, hmatrix (>=0.20.0.0), numeric-optimization (>=0.1.0.0 && <0.2.0.0), numeric-optimization-ad, primitive (>=0.6.4.0), reflection (>=2.1.5), vector (>=0.12.0.2 && <0.14) [details]
Tested with ghc ==9.4.5, ghc ==9.2.7, ghc ==9.0.2, ghc ==8.10.7, ghc ==8.8.4, ghc ==8.6.5
License BSD-3-Clause
Copyright Copyright (c) 2023 Masahiro Sakai
Author Masahiro Sakai
Maintainer masahiro.sakai@gmail.com
Category Math, Algorithms, Optimisation, Optimization
Home page https://github.com/msakai/nonlinear-optimization-ad#readme
Bug tracker https://github.com/msakai/nonlinear-optimization-ad/issues
Source repo head: git clone https://github.com/msakai/nonlinear-optimization-ad
Uploaded by MasahiroSakai at 2023-06-03T08:34:01Z
Distributions NixOS:0.1.0.1
Executables rosenbrock-ad
Downloads 122 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-06-03 [all 1 reports]

Readme for numeric-optimization-ad-0.1.0.1

[back to package description]

numeric-optimization-ad

Hackage Hackage Deps License

Wrapper of numeric-optimization package for using with ad package

Example Usage

{-# LANGUAGE FlexibleContexts #-}
import Numeric.Optimization.AD

main :: IO ()
main = do
  result <- minimize LBFGS def rosenbrock Nothing [] [-3,-4]
  print (resultSuccess result)  -- True
  print (resultSolution result)  -- [0.999999999009131,0.9999999981094296]
  print (resultValue result)  -- 1.8129771632403013e-18

-- https://en.wikipedia.org/wiki/Rosenbrock_function
rosenbrock :: Floating a => [a] -> a
-- rosenbrock :: Reifies s Tape => [Reverse s Double] -> Reverse s Double
rosenbrock [x,y] = sq (1 - x) + 100 * sq (y - sq x)

sq :: Floating a => a -> a
sq x = x ** 2