Skip to content

Commit

Permalink
Update all benchmarks a bit again and re-run them all
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Nov 15, 2023
1 parent bb3652d commit 7003e58
Show file tree
Hide file tree
Showing 67 changed files with 13,449 additions and 16,496 deletions.
11 changes: 5 additions & 6 deletions benchmarks/hodgkinhuxley.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ using LinearAlgebra, Statistics, Distributions
using DiffEqDevTools, SciMLBase, OrdinaryDiffEq, Plots, SimpleUnPack
using ProbNumDiffEq

# Plotting theme
theme(:dao;
Plots.theme(
:dao;
markerstrokewidth=0.5,
legend=:outertopright,
bottom_margin=5Plots.mm,
size = (1000, 400),
xticks = 10.0 .^ (-16:1:16),
yticks = 10.0 .^ (-6:1:5),
margin=5Plots.mm,
xticks=10.0 .^ (-16:1:16),
yticks=10.0 .^ (-6:1:5),
)
```

Expand Down
9 changes: 4 additions & 5 deletions benchmarks/lotkavolterra.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ using LinearAlgebra, Statistics, Distributions
using DiffEqDevTools, ParameterizedFunctions, SciMLBase, OrdinaryDiffEq, Plots
using ProbNumDiffEq

# Plotting theme
theme(:dao;
Plots.theme(
:dao;
markerstrokewidth=0.5,
legend=:outertopright,
bottom_margin=5Plots.mm,
size = (1000, 600),
xticks = 10.0 .^ (-16:1:16),
margin=5Plots.mm,
xticks=10.0 .^ (-16:1:16),
)
```

Expand Down
13 changes: 5 additions & 8 deletions benchmarks/multi-language-wrappers.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@ using ODEInterface, ODEInterfaceDiffEq, Sundials, SciPyDiffEq, deSolveDiffEq, MA
using LoggingExtras

using ProbNumDiffEq
```

```julia
# Plotting theme
theme(:dao;
Plots.theme(
:dao;
markerstrokewidth=0.5,
legend=:outertopright,
bottom_margin=5Plots.mm,
size = (1000, 400),
xticks = 10.0 .^ (-16:1:16),
yticks = 10.0 .^ (-6:1:5),
margin=5Plots.mm,
xticks=10.0 .^ (-16:1:16),
yticks=10.0 .^ (-6:1:5),
)
```

Expand Down
15 changes: 7 additions & 8 deletions benchmarks/pleiades.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ using DiffEqDevTools, ParameterizedFunctions, SciMLBase, OrdinaryDiffEq, Sundial
using ModelingToolkit
using ProbNumDiffEq

# Plotting theme
theme(:dao;
Plots.theme(
:dao;
markerstrokewidth=0.5,
legend=:outertopright,
bottom_margin=5Plots.mm,
size = (1000, 400),
xticks = 10.0 .^ (-16:1:16)
margin=5Plots.mm,
xticks=10.0 .^ (-16:1:16),
)
```

Expand Down Expand Up @@ -129,12 +128,12 @@ plot(wp,
### Calibration

```julia
# We can only evaluate calibration for the PN solvers
_wp = WorkPrecisionSet(wp.wps[1:end-3], wp.N-3, wp.abstols, wp.reltols, wp.prob, wp.setups[1:end-3],
wp.names[1:end-3], wp.error_estimate, wp.numruns)
plot(_wp; x=:final, y=:chi2_final,
color=[1 2 2 2 2],
linestyle=[:dash :solid :solid :dash :dash],
alpha=[1 1 1 1 1],
color=[1 1 1 1 2 2 2 2],
linestyle=[:solid :solid :dash :dash :solid :solid :dash :dash],
)
function plot_chisq_interval!(df, q=0.01)
dist = Chisq(df)
Expand Down
31 changes: 22 additions & 9 deletions benchmarks/rober.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@ Adapted from
[SciMLBenchmarks.jl](https://docs.sciml.ai/SciMLBenchmarksOutput/stable/DAE/ROBERDAE/).

```julia
using LinearAlgebra, Statistics
using LinearAlgebra, Statistics, Distributions
using DiffEqDevTools, ParameterizedFunctions, SciMLBase, OrdinaryDiffEq, Sundials, Plots
using ModelingToolkit
using ProbNumDiffEq

# Plotting theme
theme(:dao;
Plots.theme(
:dao;
markerstrokewidth=0.5,
legend=:outertopright,
bottom_margin=5Plots.mm,
size = (1000, 400),
xticks = 10.0 .^ (-16:1:16)
margin=5Plots.mm,
xticks=10.0 .^ (-16:1:16),
)
```

Expand All @@ -41,7 +40,7 @@ mmprob = ODEProblem(sys,[],(0.0,1e5))
daeprob = DAEProblem(sys,[D(y₁)=>-0.04, D(y₂)=>0.04, D(y₃)=>0.0],[],(0.0,1e5)) # can't handle this yet
odaeprob = ODAEProblem(structural_simplify(sys),[],(0.0,1e5)) # can't handle this yet

ref_sol = solve(daeprob,IDA(),abstol=1/10^14,reltol=1/10^14,dense=false)
ref_sol = solve(daeprob,IDA(),abstol=1/10^14,reltol=1/10^14)
plot(ref_sol, idxs=[y₁,y₂,y₃], title="ROBER Solution", legend=false, ylims=(0, 1), xticks=:auto)
```

Expand Down Expand Up @@ -70,13 +69,27 @@ wp = WorkPrecisionSet(
save_everystep = SAVE_EVERYSTEP,
numruns = 10,
maxiters = Int(1e7),
timeseries_errors = false,
verbose = false,
)

plot(wp, palette=Plots.palette([:blue, :red], length(_setups)))
```

### Calibration

```julia
plot(wp; x=:final, y=:chi2_final, yguide="Chi-squared (final)",
palette=Plots.palette([:blue, :red], length(_setups)))

function plot_chisq_interval!(df, q=0.01)
dist = Chisq(df)
low, high, mid = quantile(dist, [q, 1-q])..., mean(dist)
hline!([low, high], linestyle=:dash, color=:black, label="",
fill_between=[high nothing], fillcolor=:green, fillalpha=0.15)
hline!([mid], linestyle=:solid, color=:black, label="")
end
plot_chisq_interval!(3)
```


## Appendix

Expand Down
17 changes: 11 additions & 6 deletions benchmarks/runall.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
using Weave
ENV["GKSwstype"] = "nul"
set_chunk_defaults!(
:fig_width=>9,
:fig_height=>5,
)

FILES = [
"lotkavolterra.jmd",
"hodgkinhuxley.jmd",
# "vanderpol.jmd",
# "rober.jmd",
# "pleiades.jmd",
# "multi-language-wrappers.jmd",
"vanderpol.jmd",
"rober.jmd",
"pleiades.jmd",
"multi-language-wrappers.jmd",
]

filedir = @__DIR__
Expand All @@ -21,5 +25,6 @@ for file in FILES
)
end

delete!(ENV, "GKSwstype");
nothing;
restore_chunk_defaults!()
delete!(ENV, "GKSwstype")
nothing
842 changes: 421 additions & 421 deletions docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
398 changes: 198 additions & 200 deletions docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
388 changes: 194 additions & 194 deletions docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7003e58

Please sign in to comment.