Skip to content
This repository was archived by the owner on Apr 25, 2026. It is now read-only.

Use IntervalArithmetic package for intervals#25

Draft
Ratfink wants to merge 18 commits into
mainfrom
intervals
Draft

Use IntervalArithmetic package for intervals#25
Ratfink wants to merge 18 commits into
mainfrom
intervals

Conversation

@Ratfink
Copy link
Copy Markdown
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.

Ratfink added 11 commits March 29, 2023 13:39
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ordering of dimensions is not consistent across parts of the package Use an interval package instead of rolling our own intervals

2 participants