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

Fix return times function for continuous systems #278

Merged
merged 17 commits into from
Sep 24, 2022
Merged

Conversation

Datseris
Copy link
Member

@Datseris Datseris commented Sep 18, 2022

This PR aims to:

  1. Improve source code clarity of return times for discrete systems
  2. Overall better organize tests for return times
  3. Fix return times for continuous systems, which never really worked well and was also super slow. To this end we have
    • Re-written the source code from scratch.
    • Offer two algoritms: linear interpolation, or integrator-based interpolation with minimization for finding closest point and then rootfinding for finding the crossings.
    • Linear interpolation works only for spheres (in the future one could contribute code for rectangle crossing I guess.
    • High precision interpolation uses Optim.jl and Roots.jl.
    • Serious tests are now also done for continuous systems.
  4. Performance increase for continuous systems: TODO; write by how much.

Only todo left is to make it work for hyperrectangles in continuous systems.

@Datseris Datseris added the rare-events Rare events and extreme values label Sep 19, 2022
Comment on lines +180 to +191
import Optim, Roots
function closest_trajectory_point(integ, u0, metric, method::CrossingAccurateInterpolation)
# use Optim.jl to find minimum of the function
f = (t) -> evaluate(metric, integ(t), u0)
# Then find minimum of `f` in limits `(tprev, t)`
optim = Optim.optimize(
f, integ.tprev, integ.t, Optim.Brent();
store_trace=false, abs_tol = method.abstol, rel_tol = method.reltol,
)
tmin, dmin = Optim.minimizer(optim), Optim.minimum(optim)
return tmin, dmin
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KalelR here is the code snippet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rare-events Rare events and extreme values
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant