Skip to content

Commit

Permalink
Merge pull request #152 from JuliaReach/schillic/spellcheck
Browse files Browse the repository at this point in the history
Spell check
  • Loading branch information
schillic authored Nov 3, 2023
2 parents a6e57c2 + d02688e commit 38e697c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Spell Check

on: [pull_request]

jobs:
typos-check:
name: check spelling
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@master
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[files]
extend-exclude = ["paper/juliacon.*", "paper/ref.bib"]
2 changes: 1 addition & 1 deletion paper/jlcode.sty
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ morestring=[s]{L"}{"},%
% defining the \addlitjlbase and \addlitjlstring commands,
% which help a user to fix some of the known managable issues
% which help a user to fix some of the known manageable issues
\def\addToLiterate#1{%
\protected@edef\lst@literate{%
\unexpanded\expandafter{\lst@literate}\unexpanded{#1}}}
Expand Down
16 changes: 8 additions & 8 deletions src/branchandbound.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# univariate case
@inline function enclose(f::Function, X::Interval, ba::BranchAndBoundEnclosure;
@inline function enclose(f::Function, X::Interval, bab::BranchAndBoundEnclosure;
df=Base.Fix1(ForwardDiff.derivative, f))
return _branch_bound(ba, f, X, df)
return _branch_bound(bab, f, X, df)
end

# multivariate case
@inline function enclose(f::Function, X::IntervalBox, ba::BranchAndBoundEnclosure;
@inline function enclose(f::Function, X::IntervalBox, bab::BranchAndBoundEnclosure;
df=t -> ForwardDiff.gradient(f, t.v))
return _branch_bound(ba, f, X, df)
return _branch_bound(bab, f, X, df)
end

function _branch_bound(ba::BranchAndBoundEnclosure, f::Function, X::Interval_or_IntervalBox, df;
function _branch_bound(bab::BranchAndBoundEnclosure, f::Function, X::Interval_or_IntervalBox, df;
initial=emptyinterval(first(X)),
cnt=1)
dfX = df(X)
Expand All @@ -19,13 +19,13 @@ function _branch_bound(ba::BranchAndBoundEnclosure, f::Function, X::Interval_or_

fX = f(X) # TODO: allow user to choose how to evaluate this (mean value, natural enclosure)
# if tolerance or maximum number of iteration is met, return current enclosure
if diam(fX) <= ba.tol || cnt == ba.maxdepth
if diam(fX) <= bab.tol || cnt == bab.maxdepth
return hull(fX, initial)
end

X1, X2 = bisect(X)
y1 = _branch_bound(ba, f, X1, df; initial=initial, cnt=cnt + 1)
return _branch_bound(ba, f, X2, df; initial=y1, cnt=cnt + 1)
y1 = _branch_bound(bab, f, X1, df; initial=initial, cnt=cnt + 1)
return _branch_bound(bab, f, X2, df; initial=y1, cnt=cnt + 1)
end

function _monotonicity_check(f::Function, X::Interval, dfX::Interval)
Expand Down

0 comments on commit 38e697c

Please sign in to comment.