Giter Club home page Giter Club logo

multiprecisionr2's Introduction

MultiPrecisionR2

Stable Dev Build Status Build Status Coverage

MultiPrecisionR2.jl is a package that implements a multi-precision version of the Quadratic Regularization (R2) algorithm, a first-order algorithm, for solving non-convex, continuous, smooth optimization problems. The Floating Point (FP) format is adapted dynamically during algorithm execution to use low precision FP formats as much as possible while ensuring convergence and numerical stability.

The package also implements multi-precision models FPMPNLPModel structure that derives from NLPModel implemented in NLPModels.jl. The interfaces for objective and gradient evaluations are extended to provide evaluation errors.

MultiPrecisionR2 can ensure numerical stability by using interval evaluations of the objective function and gradient. Interval evaluation relies on IntervalArithmetic.jl package to perform the interval evaluations.

Installation

using Pkg
Pkg.add("MultiPrecisionR2")

Minimal examples

using MultiPrecisionR2

FP = [Float16,Float32] # define floating point formats used by the algorithm for objective and gradient evaluation
f(x) = x[1]^2 + x[2]^2 # some objective function
x0 = ones(Float32,2) # initial point
mpmodel = FPMPNLPModel(f,x0,FP); # instanciate a Floating Point Multi Precision NLPModel (FPMPNLPModel)
stat = MPR2(mpmodel) # run the algorithm
using MultiPrecisionR2
using ADNLPModels
using OptimizationProblems
using OptimizationProblems.ADNLPProblems

FP = [Float16,Float32] # define floating point formats used by the algorithm for objective and gradient evaluation
s = :woods # select problem
nlp = eval(s)(n=12,type = Val(FP[end]), backend = :generic)
mpmodel = FPMPNLPModel(nlp,FP); # instanciate a Floating Point Multi Precision NLPModel (FPMPNLPModel)
stat = MPR2(mpmodel) # run the algorithm

Warnings

  1. MultiPrecisionR2 is designed to work with FP formats. Other format, such as fix point, might break the convergence property of the algorithm.
    • Interval evaluation might fail with rounding mode other than :accurate for FP formats other than Float32 and Float64. When using interval evaluation, it is recommended to call
using IntervalArithmetic
setrounding(Interval,:accurate)

before instanciating a FPMPNLPModel.

  1. If interval evaluation mode is used, interval evaluations of the objective and the gradient are automatically tested upon FPMPNLPModel instantiation. An error is thrown if the evaluation fails. This might happen for several reasons related to IntervalArithmetic.jl package.

Bug reports and discussions

If you think you found a bug, feel free to open an issue. Focused suggestions and requests can also be opened as issues. Before opening a pull request, start an issue or a discussion on the topic, please.

If you want to ask a question not suited for a bug report, feel free to start a discussion here. This forum is for general discussion about this repository and the JuliaSmoothOptimizers organization, so questions about any of our packages are welcome.

multiprecisionr2's People

Contributors

d-monnet avatar github-actions[bot] avatar tmigot 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.