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

Auto-format script #122

Merged
merged 2 commits into from
Jun 24, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
29 changes: 29 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Format
on:
schedule:
- cron: '0 0 * * 6' # every Saturday at 0:00
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install JuliaFormatter and format
run: |
julia -e 'import Pkg; Pkg.add("JuliaFormatter")'
julia -e 'using JuliaFormatter; format(".")'

# https://github.com/marketplace/actions/create-pull-request
# https://github.com/peter-evans/create-pull-request#reference-example
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Format .jl files
title: 'Automatic JuliaFormatter.jl run'
branch: auto-juliaformatter-pr
delete-branch: true
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
37 changes: 29 additions & 8 deletions benchmark/Daisy/daisy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ e = Interval(-10.0, 8.0)
f = Interval(1.0, 2.0)

# Dictionary to hold the vector of relative precision intervals for each benchmark
RELPREC = Dict{String, Any}()
RELPREC = Dict{String,Any}()

# Dictionaries to store data and reference values
DAISY = Dict{String, Any}()
DAISY = Dict{String,Any}()

# load functions
include("univariate.jl")
Expand All @@ -40,13 +40,34 @@ for name in keys(DAISY)
RESULTS[name]["order $ord"] = BenchmarkGroup()
RELPREC[name]["order $ord"] = Dict()

RESULTS[name]["order $ord"]["Taylor Model subs."] = @benchmarkable enclose($func, $dom, :TaylorModels, order=$ord, normalize=false)
RELPREC[name]["order $ord"]["Taylor Model subs."] = relative_precision(enclose(func, dom, :TaylorModels, order=ord, normalize=false), ref)
RESULTS[name]["order $ord"]["Taylor Model subs."] = @benchmarkable enclose($func, $dom,
:TaylorModels,
order=$ord,
normalize=false)
RELPREC[name]["order $ord"]["Taylor Model subs."] = relative_precision(enclose(func, dom,
:TaylorModels;
order=ord,
normalize=false),
ref)

RESULTS[name]["order $ord"]["Normalized Taylor Model subs."] = @benchmarkable enclose($func, $dom, :TaylorModels, order=$ord, normalize=true)
RELPREC[name]["order $ord"]["Normalized Taylor Model subs."] = relative_precision(enclose(func, dom, :TaylorModels, order=ord, normalize=true), ref)
RESULTS[name]["order $ord"]["Normalized Taylor Model subs."] = @benchmarkable enclose($func,
$dom,
:TaylorModels,
order=$ord,
normalize=true)
RELPREC[name]["order $ord"]["Normalized Taylor Model subs."] = relative_precision(enclose(func,
dom,
:TaylorModels;
order=ord,
normalize=true),
ref)

RESULTS[name]["order $ord"]["Interval Arithmetic subs."] = @benchmarkable enclose($func, $dom, :IntervalArithmetic)
RELPREC[name]["order $ord"]["Interval Arithmetic subs."] = relative_precision(enclose(func, dom, :IntervalArithmetic), ref)
RESULTS[name]["order $ord"]["Interval Arithmetic subs."] = @benchmarkable enclose($func,
$dom,
:IntervalArithmetic)
RELPREC[name]["order $ord"]["Interval Arithmetic subs."] = relative_precision(enclose(func,
dom,
:IntervalArithmetic),
ref)
end
end
81 changes: 42 additions & 39 deletions benchmark/Daisy/multivariate.jl
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
# ======================
# Multivariate functions
# ======================
DAISY["himmilbeau"] = Dict("dom" => a×b,
"numvars" => 2,
"vars" => "x1 x2",
"f" => ((x1, x2) -> (x1*x1 + x2 - 11)*(x1 * x1 + x2 - 11) + (x1 + x2*x2 - 7)*(x1 + x2*x2 - 7)),
"ref" => Interval(85.46830677734748, 221.7338939301446) # MOSEK deg 6
)
DAISY["himmilbeau"] = Dict("dom" => a × b,
"numvars" => 2,
"vars" => "x1 x2",
"f" => ((x1, x2) -> (x1 * x1 + x2 - 11) * (x1 * x1 + x2 - 11) +
(x1 + x2 * x2 - 7) * (x1 + x2 * x2 - 7)),
"ref" => Interval(85.46830677734748, 221.7338939301446))

DAISY["kepler1"] = Dict("dom" => a×b×c×d×e×f,
"numvars" => 6,
"vars" => "x1 x2 x3 x4 x5 x6",
"f" => ((x1, x2, x3, x4, x5, x6) -> x2 * x5 + x3 * x6 - x2 * x3 - x5 * x6 + x1 * (-x1 + x2 + x3 - x4 + x5 + x6)),
"ref" => Interval(-5.255935494810441, 7.321362422825775) # MOSEK deg 6
)
DAISY["kepler1"] = Dict("dom" => a × b × c × d × e × f,
"numvars" => 6,
"vars" => "x1 x2 x3 x4 x5 x6",
"f" => ((x1, x2, x3, x4, x5, x6) -> x2 * x5 + x3 * x6 - x2 * x3 - x5 * x6 +
x1 * (-x1 + x2 + x3 - x4 + x5 + x6)),
"ref" => Interval(-5.255935494810441, 7.321362422825775))

DAISY["kepler2"] = Dict("dom" => a×b×c×d,
"numvars" => 4,
"vars" => "x1 x2 x3 x4",
"f" => ((x1, x2, x3, x4) -> x1 * x4 * (-x1 + x2 + x3 - x4) +
x2 * (x1 - x2 + x3 + x4) + x3 * (x1 + x2 - x3 + x4) -x2 * x3 * x4 - x1 * x3 - x1 * x2 - x4),
"ref" => Interval(-195.36974909125482, 78.3669520644375) # MOSEK deg 6
)
DAISY["kepler2"] = Dict("dom" => a × b × c × d,
"numvars" => 4,
"vars" => "x1 x2 x3 x4",
"f" => ((x1, x2, x3, x4) -> x1 * x4 * (-x1 + x2 + x3 - x4) +
x2 * (x1 - x2 + x3 + x4) +
x3 * (x1 + x2 - x3 + x4) - x2 * x3 * x4 -
x1 * x3 - x1 * x2 - x4),
"ref" => Interval(-195.36974909125482, 78.3669520644375))

DAISY["kepler3"] = Dict("dom" => a×b×c×d×e×f,
"numvars" => 6,
"vars" => "x1 x2 x3 x4 x5 x6",
"f" => ((x1, x2, x3, x4, x5, x6) -> x1 * x4 * (-x1 + x2 + x3 - x4 + x5 + x6) +
x2 * x5 * (x1 - x2 + x3 + x4 - x5 + x6) +x3* x6 * (x1 + x2 - x3 + x4 + x5 - x6) -
x2 * x3 * x4 -x1* x3* x5 - x1 * x2 * x6 - x4 * x5 * x6),
"ref" => Interval(-309.8484155131222, 17.982082401462407) # MOSEK deg 6
)
DAISY["kepler3"] = Dict("dom" => a × b × c × d × e × f,
"numvars" => 6,
"vars" => "x1 x2 x3 x4 x5 x6",
"f" => ((x1, x2, x3, x4, x5, x6) -> x1 * x4 *
(-x1 + x2 + x3 - x4 + x5 + x6) +
x2 * x5 *
(x1 - x2 + x3 + x4 - x5 + x6) +
x3 * x6 * (x1 + x2 - x3 + x4 + x5 - x6) -
x2 * x3 * x4 - x1 * x3 * x5 -
x1 * x2 * x6 - x4 * x5 * x6),
"ref" => Interval(-309.8484155131222, 17.982082401462407))

DAISY["Rigidbody1"] = Dict("dom" => a×b×c,
"numvars" => 3,
"vars" => "x1 x2 x3",
"f" => ((x1, x2, x3) -> -x1*x2 - 2*x2*x3 - x1 - x3),
"ref" => Interval(-20.786552979420335, -0.540012836551535) # MOSEK deg 6
)
DAISY["Rigidbody1"] = Dict("dom" => a × b × c,
"numvars" => 3,
"vars" => "x1 x2 x3",
"f" => ((x1, x2, x3) -> -x1 * x2 - 2 * x2 * x3 - x1 - x3),
"ref" => Interval(-20.786552979420335, -0.540012836551535))

DAISY["Rigidbody2"] = Dict("dom" => a×b×c,
"numvars" => 3,
"vars" => "x1 x2 x3",
"f" => ((x1, x2, x3) -> 2*(x1*x2*x3) + (3*x3*x3) - x2*(x1*x2*x3) + (3*x3*x3) - x2),
"ref" => Interval(68.81138021006673, 359.98566570476504) # MOSEK deg 6
)
DAISY["Rigidbody2"] = Dict("dom" => a × b × c,
"numvars" => 3,
"vars" => "x1 x2 x3",
"f" => ((x1, x2, x3) -> 2 * (x1 * x2 * x3) + (3 * x3 * x3) -
x2 * (x1 * x2 * x3) + (3 * x3 * x3) - x2),
"ref" => Interval(68.81138021006673, 359.98566570476504))
35 changes: 15 additions & 20 deletions benchmark/Daisy/univariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,26 @@

# (*) can be checked by hand
DAISY["sine"] = Dict("dom" => a,
"numvars" => 1,
"f" => (x -> sin(x)),
"ref" => Interval(-1.0, 0.977530117665097) # (*)
)
"numvars" => 1,
"f" => (x -> sin(x)),
"ref" => Interval(-1.0, 0.977530117665097))

DAISY["bspline0"] = Dict("dom" => a,
"numvars" => 1,
"f" => (x -> (1 - x) * (1 - x) * (1 - x) / 6.0),
"ref" => Interval(0.36616666666666675, 27.729166666666668) # (*)
)
"numvars" => 1,
"f" => (x -> (1 - x) * (1 - x) * (1 - x) / 6.0),
"ref" => Interval(0.36616666666666675, 27.729166666666668))

DAISY["bspline1"] = Dict("dom" => a,
"numvars" => 1,
"f" => (x -> (3*x*x*x - 6*x*x + 4) / 6.0),
"ref" => Interval(-65.14583333333333, 0.5631666666666667) # (*)
)
"numvars" => 1,
"f" => (x -> (3 * x * x * x - 6 * x * x + 4) / 6.0),
"ref" => Interval(-65.14583333333333, 0.5631666666666667))

DAISY["bspline2"] = Dict("dom" => a,
"numvars" => 1,
"f" => (x -> (-3*x*x*x + 3*x*x + 3*x + 1) / 6.0),
"ref" => Interval(0.07516666666666667, 53.604166666666664) # (*)
)
"numvars" => 1,
"f" => (x -> (-3 * x * x * x + 3 * x * x + 3 * x + 1) / 6.0),
"ref" => Interval(0.07516666666666667, 53.604166666666664))

DAISY["bspline3"] = Dict("dom" => a,
"numvars" => 1,
"f" => (x -> -x*x*x / 6.0),
"ref" => Interval(0.0045, 15.1875) # (*)
)
"numvars" => 1,
"f" => (x -> -x * x * x / 6.0),
"ref" => Interval(0.0045, 15.1875))
34 changes: 13 additions & 21 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,17 @@ using Documenter, RangeEnclosures

include("init.jl")

makedocs(
sitename = "RangeEnclosures.jl",
modules = [RangeEnclosures],
format = Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true",
assets = ["assets/aligned.css"]),
doctest = false,
strict = true,
pages = [
"Home" => "index.md",
"Tutorial" => "tutorial.md",
"Library" => Any[
"Types" => "lib/types.md",
"Methods" => "lib/methods.md"],
"About" => "about.md"
]
)
makedocs(; sitename="RangeEnclosures.jl",
modules=[RangeEnclosures],
format=Documenter.HTML(; prettyurls=get(ENV, "CI", nothing) == "true",
assets=["assets/aligned.css"]),
doctest=false,
strict=true,
pages=["Home" => "index.md",
"Tutorial" => "tutorial.md",
"Library" => Any["Types" => "lib/types.md",
"Methods" => "lib/methods.md"],
"About" => "about.md"])

deploydocs(
repo = "github.com/JuliaReach/RangeEnclosures.jl.git",
push_preview=true
)
deploydocs(; repo="github.com/JuliaReach/RangeEnclosures.jl.git",
push_preview=true)