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

Add hybrid lotka-volterra model #196

Merged
merged 7 commits into from
May 23, 2020
Merged

Add hybrid lotka-volterra model #196

merged 7 commits into from
May 23, 2020

Conversation

mforets
Copy link
Member

@mforets mforets commented May 23, 2020

No description provided.

@mforets
Copy link
Member Author

mforets commented May 23, 2020

Note : this branch requires to checkout LazySets#mforets/union

@mforets
Copy link
Member Author

mforets commented May 23, 2020

This plot captures the overapproximation of a Taylor model reach-set using a box (blue) and a zonotope (red). I was interesecting these with B_ext in order to prove disjointness. As it is seen in the plot, the flowpipe actually has left much earlier, which we can prove either using the zonotope overapprox, or computing a tighter continuous solution eg. by splitting.

Screenshot from 2020-05-23 14-29-46

@mforets mforets changed the title WIP LV hybrid Add hybrid lotka-volterra example May 23, 2020
@mforets mforets changed the title Add hybrid lotka-volterra example Add hybrid lotka-volterra model May 23, 2020
@mforets
Copy link
Member Author

mforets commented May 23, 2020

Here is a sample result: (abs_tol=1e-12)

Screenshot from 2020-05-23 19-07-03

Playing with the parameter choices one can get smaller final states; there are mainly 2 options:

  • abs_tol the initial abs tolerance for the adaptive TMJets algorithm: smaller => more accurate
  • nsplit the number of sets in which the initial state X0 is split: if it's larger => wrapping effects are smaller so the result is more accurate

For instance the following plot was obtained with abs_tol=1e-16 and nsplit=10:

Screenshot from 2020-05-23 19-23-04

Runtime is 3.3sec and 12.5sec respectively.

@mforets mforets merged commit 9db1e84 into master May 23, 2020
@lbenet
Copy link
Collaborator

lbenet commented May 23, 2020

Beautiful!

@mforets
Copy link
Member Author

mforets commented May 23, 2020

The intersection time can be obtained with the following function:

solz = overapproximate(sol, Zonotope);
intersecting_reachsets = []
for (i, Fi) in enumerate(solz)
    for (j, Xj) in enumerate(Fi)
        !isdisjoint(Xj, B_ext) && push!(intersecting_reachsets, (i, j))
    end
end

times = [tspan(solz[ind[1]][ind[2]]) for ind in intersecting_reachsets];
tmin = minimum(tstart, times)
tmax = maximum(tend, times)
tmax - tmin

Here we detect, for each flowpipe, those reach-sets that intersect the outer approximation of the ball. Then takes the minimum (resp. maximum) times so we have a proof for an upper bound on the intersection time.

The results obtained for the settings in my previous comment are 0.21554 and 0.17176 respectively.

@mforets
Copy link
Member Author

mforets commented May 23, 2020

We can also see that there are flowpipes which never intersected the guard:

[isdisjoint(s, B_ext) for s in solz]
12-element Array{Bool,1}:
 1
 1
 1
 1
 1
 0
 0
 0
 0
 0
 0
 0

Here you see 12 flowpipes because:

  • The waiting list initially had 10 sets (since i used nsplit=10)
  • For the first jump we convexify => add a new element to the waiting list => a new Flowpipe is computed
  • For the second jump (from inside to outside the ball) we convexify a gain and add a new flowpipe

@mforets mforets deleted the mforets/lv_hybrid branch June 17, 2020 11:07
@mforets mforets restored the mforets/lv_hybrid branch June 17, 2020 11:07
@mforets mforets deleted the mforets/lv_hybrid branch June 17, 2020 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants