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

Use IntervalArithmetic package for intervals #25

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft

Conversation

Ratfink
Copy link
Owner

@Ratfink Ratfink commented Apr 3, 2023

This PR closes #8 by rewriting the package to use IntervalArithmetic.jl for intervals instead of matrices. In addition to bringing semantic types, this actually improves performance by around 2–3× for bounded_runs_iter.

There are still a few changes I'd like to do in this branch prior to merging:

  • Rewrite safety.jl to use IntervalBox n-dimensional intervals
    • Basic functionality
    • safety_margin parameter (needs testing)
  • Update demo control_timing_safety.jl notebook for new API
  • Allow evol function family to take IntervalBoxes in addition to vectors
  • Ensure dimensions of matrices are consistent (fixes Ordering of dimensions is not consistent across parts of the package #24)
  • Test probablesafety.jl after updating evol family

Added bonus: I also added a ULS method for overapproximating reachable sets, like in the paper. It's really simple to implement, it turns out.

They're not needed now that we're using intervals, which have their own
hull function.
The old method was unused now that everything's being changed to take
IntervalBoxes, so I decided this was more useful.  Now, it returns a
3-dimensional array obtained from calling the individual method on each
element of the vector, effectively concatenating the
automatically-vectorized version on the third dimension.
This order, with each column as a state vector, matches functions like
lsim from ControlSystems, and offers better cache behavior with Julia's
matrix ordering.  It also matches many uses of the function, which
immediately transposed its return value.
@shengjiex98
Copy link
Collaborator

shengjiex98 commented Jul 6, 2023

Seems like this is hanging on the safety_margin section. Since there are some issues with the safety_margin implementation #26, I think we can skip checking for safety_margin entirely for now and I will try to rewrite it using the new implementation based on the IntervalArithmetic.jl package.

@Ratfink
Copy link
Owner Author

Ratfink commented Apr 22, 2024

I went ahead and fixed the safety_margin code so it at least doesn't cause an exception. Whatever bug existed before may still persist, but otherwise I think this is ready to merge. Seems like CI is having some issues right now, and we probably still have documentation to update, so I'll give it a bit.

@Ratfink
Copy link
Owner Author

Ratfink commented Apr 23, 2024

Actually, no! This whole branch has been obsoleted by IntervalArithmetic 0.22, which removed the IntervalBox type in favor of simply using vectors of intervals. I'll have to rewrite this to match the new API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants