Skip to content

Commit

Permalink
Merge pull request #154 from JuliaReach/schillic/docs
Browse files Browse the repository at this point in the history
Add tutorial for adding a new solver
  • Loading branch information
schillic authored Nov 24, 2023
2 parents b9616ca + 3ec567b commit 50f2b46
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions docs/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,24 @@ savefig("tutorial-3d.png"); nothing # hide
```

![](tutorial-3d.png)

## Adding a new enclosure algorithm

To add a new enclosure algorithm, or *solver*, just add a corresponding struct (let us call it `MyEnclosure`) and extend the method `enclose`, as the following code snippet demonstrates.

```@example
using RangeEnclosures
import RangeEnclosures: enclose
using IntervalArithmetic: Interval
struct MyEnclosure end
function enclose(f::Function,
D::Union{Interval,IntervalBox},
solver::MyEnclosure; kwargs...)
# solver-specific implementation
end
nothing # hide
```

Note that the domain `D` can be of type `Interval` for univariate (``n = 1``) functions or of type `IntervalBox` for multivariate (``n > 1``) functions.
4 changes: 2 additions & 2 deletions paper/paper.tex
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ \subsection{The enclose API}
\vspace*{-3mm}
\begin{lstlisting}[language=Julia]
import RangeEnclosures: enclose
import IntervalArithmetic: Interval
using IntervalArithmetic: Interval
function enclose(f::Function,
dom::Union{Interval,IntervalBox},
D::Union{Interval,IntervalBox},
solver::MyEnclosure; kwargs...)
# solver-specific implementation
end
Expand Down

0 comments on commit 50f2b46

Please sign in to comment.