-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from JuliaReach/mforets/79
#79 - Update IVPs interface for TMJets
- Loading branch information
Showing
7 changed files
with
105 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@testset "TMJets with a linear IVP" begin | ||
prob, tspan = exponential_1d() | ||
sol = solve(prob, tspan=tspan, TMJets()) | ||
@test sol.alg isa TMJets | ||
end | ||
|
||
@testset "TMJets interface" begin | ||
prob, tspan = vanderpol() | ||
|
||
# default algorithm for nonlinear systems | ||
sol = solve(prob, tspan=tspan) | ||
@test sol.alg isa TMJets | ||
|
||
# pass the algorithm explicitly | ||
sol = solve(prob, tspan=tspan, TMJets()) | ||
@test sol.alg isa TMJets | ||
|
||
# TODO: try different options | ||
end | ||
|
||
#= | ||
alg = TMJets(abs_tol=1e-10, orderT=10, orderQ=2) | ||
# reach mode | ||
sol = solve(P, T=7.0, alg) | ||
@test set(sol[1]) isa Hyperrectangle # check default set representation | ||
=# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function exponential_1d() | ||
s = @system(x' = -x) | ||
x0 = Interval(0.4, 0.5) | ||
prob = InitialValueProblem(s, x0) | ||
tspan = (0.0, 1.0) | ||
return prob, tspan | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# ======================================= | ||
# Van der Pol oscillator | ||
# #include("models/lotka_volterra.jl") | ||
# https://en.wikipedia.org/wiki/Van_der_Pol_oscillator | ||
# Number of state variables: 2 | ||
# ======================================= | ||
|
||
@taylorize function vanderPol!(dx, x, params, t) | ||
local μ = 1.0 | ||
dx[1] = x[2] | ||
dx[2] = (μ * x[2]) * (1 - x[1]^2) - x[1] | ||
return dx | ||
end | ||
|
||
function vanderpol() | ||
X0 = Hyperrectangle(low=[1.25, 2.35], high=[1.55, 2.45]) | ||
prob = @ivp(x' = vanderPol!(x), dim: 2, x(0) ∈ X0) | ||
tspan = (0.0, 5.0) | ||
|
||
return prob, tspan | ||
end | ||
|
||
#= | ||
OLD | ||
# check mode | ||
property = (t, x) -> x[2] <= 2.75 | ||
sol = solve(P, T=7.0, property=property, alg) | ||
# test set representation option | ||
sol = solve(P, T=7.0, setrep=:Hyperrectangle, alg) | ||
@test set(sol[1]) isa Hyperrectangle | ||
sol = solve(P, T=7.0, setrep=:IntervalBox, alg) | ||
@test set(sol[1]) isa IntervalBox | ||
sol = solve(P, T=7.0, setrep=:Zonotope, alg) | ||
@test set(sol[1]) isa Zonotope | ||
sol = solve(P, T=7.0, setrep=:TaylorModel, alg) | ||
@test set(sol[1]) isa TaylorModel | ||
=# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters