Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #80

Merged
merged 6 commits into from
Jun 15, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 25 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

[![Build Status](https://github.com/JuliaReach/RangeEnclosures.jl/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/JuliaReach/RangeEnclosures.jl/actions/workflows/ci.yml?query=branch%3Amaster)
[![Docs latest](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliareach.github.io/RangeEnclosures.jl/latest/)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/JuliaReach/RangeEnclosures.jl/blob/master/LICENSE.md)
[![Docs dev](https://img.shields.io/badge/docs-dev-blue.svg)](http://juliareach.github.io/RangeEnclosures.jl/dev/)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](LICENSE)
[![Code coverage](http://codecov.io/github/JuliaReach/RangeEnclosures.jl/coverage.svg?branch=master)](https://codecov.io/github/JuliaReach/RangeEnclosures.jl?branch=master)
[![Join the chat at https://gitter.im/JuliaReach/Lobby](https://badges.gitter.im/JuliaReach/Lobby.svg)](https://gitter.im/JuliaReach/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Expand All @@ -13,112 +14,57 @@ real-valued functions.

## Resources

- [Manual](http://juliareach.github.io/RangeEnclosures.jl/latest/)
- [Docs latest](http://juliareach.github.io/RangeEnclosures.jl/latest/) -- documentation of the latest stable release
- [Docs dev](http://juliareach.github.io/RangeEnclosures.jl/dev/) -- documentation of the dev version of the package
- [Contributing](https://juliareach.github.io/RangeEnclosures.jl/latest/about/#Contributing-1)
- [Release notes of tagged versions](https://github.com/JuliaReach/RangeEnclosures.jl/releases)
- [Release notes of the development version](https://github.com/JuliaReach/RangeEnclosures.jl/wiki/Release-log-tracker)
lucaferranti marked this conversation as resolved.
Show resolved Hide resolved

## Installing

This package requires Julia v1.0 or later.
Refer to the [official documentation](https://julialang.org/downloads) on how to
install and run Julia on your system.

Depending on your needs, choose an appropriate command from the following list
and enter it in Julia's REPL.
To activate the `pkg` mode, type `]` (and to leave it, type `<backspace>`).

#### [Install the latest release version](https://julialang.github.io/Pkg.jl/v1/managing-packages/#Adding-registered-packages-1)

```julia
pkg> add RangeEnclosures
```

#### Install the latest development version

```julia
pkg> add RangeEnclosures#master
```

#### [Clone the package for development](https://julialang.github.io/Pkg.jl/v1/managing-packages/#Developing-packages-1)
From the Julia REPL type

```julia
pkg> dev RangeEnclosures
julia> using Pkg; Pkg.add(url="https://github.com/JuliaReach/RangeEnclosures.jl.git")
```

## Quickstart

An *enclosure* of the [range](https://en.wikipedia.org/wiki/Range_(mathematics)) of a function `f : dom ⊂ R^n -> R` is an interval
that contains the global minimum and maximum of `f` over its domain `dom`. `RangeEnclosures` can be used to find such bounds
using different methods, as in:

```julia
julia> using RangeEnclosures

julia> enclose(x -> -x^3/6 + 5x, 1 .. 4) # using the default solver
[-5.66667, 19.8334]
```
It is guaranteed that the global minimum (resp. global maximum) of `f(x) = -x^3/6 + 5x` on the interval `[1, 4]` is greater or equal than `-5.66667` (resp. smaller or equal than `19.8334`). Although interval arithmetic is very fast, the bounds obtained are not necessarily tight. Hence, it is often desired to employ different numerical approaches, available through different *solvers*.

`RangeEnclosures` exports the function `enclose` accepting a real-valued function `f`, either univariate or multivariate, over a hyperrectangular (i.e. box-shaped) domain. Without extra arguments, `enclose` uses the default solver (`IntervalArithmetic`) as in the above computation, although other solvers are available through extra arguments to `enclose`. The available solvers are: `:IntervalArithmetic`, `:IntervalOptimisation`, `:TaylorModels`, `:AffineArithmetic` (optional) and `:SumOfSquares` (only for polynomials).

This is a "meta" package in the sense that `enclose` calls one of the available solvers to do the optimization;
see the [documentation](http://juliareach.github.io/RangeEnclosures.jl/latest/)
or the examples below for the available options. The inputs to `enclose` are standard Julia functions and the domains are intervals
(resp. products of intervals): these are given as `Interval` (resp. `IntervalBox`)
types, both defined in `IntervalArithmetic`.

With the running example, using Taylor models substitution of order 4 gives:
that contains the global minimum and maximum of `f` over its domain `dom`. `RangeEnclosures` offers an API to easily bound the range of
a function with different algorithms. Here is a quick example, check the [docs](http://juliareach.github.io/RangeEnclosures.jl/latest/) for more.
lucaferranti marked this conversation as resolved.
Show resolved Hide resolved

```julia
julia> f(x) = -x^3/6 + 5x

julia> dom = 1 .. 4
[1, 4]

julia> enclose(f, dom, :TaylorModels, order=4)
[4.27083, 12.7084]
```
We can get tight bounds using interval (global) optimization,

```julia
julia> enclose(f, dom, :IntervalOptimisation)
[4.83299, 10.5448]
julia> enclose(f, dom, BranchAndBoundEnclosure())
[4.83333, 10.5709]
```
or polynomial optimization ([semidefinite programming](https://en.wikipedia.org/wiki/Semidefinite_programming)), by changing the solver:
```julia
julia> enclose(f, dom, :SumOfSquares)
[4.83333, 10.541]
```
In the last calculation, the default semidefinite programming (SDP) solver `SDPA` is used,
but you can pass in any other SDP solver accepted by `JuMP`. For instance, if you
have `MosekTools` (and a Mosek license) installed, and want the maximum
degree of the relaxation to be `4`, do:

```julia
julia> using MosekTools
## Authors

julia> enclose(f, dom, :SumOfSquares, order=4, backend=MosekTools.Mosek.Optimizer, QUIET=true)
[4.83333, 10.541]
```
(the optional `QUIET` argument is used to turn off the verbose mode).
- [Luca Ferranti](https://github.com/lucaferranti)
- [Marcelo Forets](https://github.com/mforets)
- [Christian Schilling](https://github.com/schillic)

Multivariate functions are handled similarly:
## Acknowledgements

```julia
julia> g(x, y) = (x + 2y - 7)^2 + (2x + y - 5)^2;
Huge thanks to all the [contributors](https://github.com/JuliaReach/RangeEnclosures.jl/graphs/contributors).

julia> dom = IntervalBox(-10..10, 2)
[-10, 10] × [-10, 10]
During Summer 2022, this project was financially supported by Google through the Google Summer of Code programme.
During Sumemr 2019, this project was financially supported by Julia throught the Julia Season of Contributions programme.

julia> enclose(g, dom, :IntervalArithmetic)
[0, 2594]
In addition, we are grateful to the following persons for enlightening discussions
during the preparation of this package:

julia> enclose(g, dom, :SumOfSquares, order=5, backend=MosekTools.Mosek.Optimizer, QUIET=true)
[9.30098e-07, 2594]
```
The result returned by interval arithmetic substitution in this example is actually tight.
- [Luis Benet](https://github.com/lbenet)
- [Benoît Legat](https://github.com/blegat/)
- [David P. Sanders](https://github.com/dpsanders/)

<!--
## Acknowledgements

If you use `RangeEnclosures.jl`, consider acknowledging or citing the Julia package
Expand All @@ -132,3 +78,4 @@ during the preparation of this package:
- [Luis Benet](https://github.com/lbenet)
- [Benoît Legat](https://github.com/blegat/)
- [David P. Sanders](https://github.com/dpsanders/)
-->