-
Notifications
You must be signed in to change notification settings - Fork 22
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
[AERIE-1953] Interval split operation for Windows and Spans #260
Conversation
733e55c
to
94be979
Compare
Marking as draft because I'm about to open a PR for basic Spans. Will implement Spans.split as well. |
...erver/src/main/java/gov/nasa/jpl/aerie/merlin/server/models/ConstraintsCompilationError.java
Outdated
Show resolved
Hide resolved
constraints/src/main/java/gov/nasa/jpl/aerie/constraints/time/Windows.java
Outdated
Show resolved
Hide resolved
a3276e9
to
1c042eb
Compare
I've marked ready for review now that this PR includes Spans! This change introduces the |
76013d4
to
a250971
Compare
361d2a9
to
6fb824c
Compare
6fb824c
to
2830bae
Compare
2830bae
to
3f98ca6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks again for finding the user code runner bug!
3f98ca6
to
57f6d40
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have one (quite fundamental) question but otherwise all of this looks good to me.
constraints/src/main/java/gov/nasa/jpl/aerie/constraints/time/Spans.java
Outdated
Show resolved
Hide resolved
Ok! Now that nullable windows is merged, the situation for split is a little different. I'm thinking since windows gaps mean "unknown" instead of "undefined", it would technically be unknown where to split a window if a Additionally, I'd like to make the inclusivity of any generated internal edges be configurable, with the defaults being
example code: export default(): Constraint {
let unsplitWindows = /* some external profile expression with gaps */;
let splitWindows = unsplitWindows
.assignGaps(false)
.split(3, Inclusivity.Exclusive, Inclusivity.Exclusive)
.windows()
.select(unsplitWindows);
// do whatever with your shiny new windows object
} At some point if performance becomes a concern it may be helpful to implement a @adrienmaillard @dyst5422 @Twisol any thoughts? |
I think my first concern is what "N equally-sized windows" means if you happen to have a profile like (I know we use MIN_VALUE right now and not a proper -inf, but MIN_VALUE itself is a completely arbitrary value.) |
I suppose as long as we're trying to represent infinite intervals on a finite domain, simply leaving windows that touch |
D'you think there are any valid use-cases for calling |
I can't think of any, so I'll add that check and throw an error. If such a use case ever comes up, it'll be very easy and I've left a comment explaining what to do. |
57f6d40
to
f453353
Compare
f453353
to
4930dca
Compare
4930dca
to
9ce6c3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work.
Description
Implements the
split(N)
operation, which splits each window into N equally sized sub-windows by removing N-1 points in the middle. Instantaneous point windows are left unchanged.In practice since windows are defined in microseconds, the sub-windows might not be exactly equal, because the last sub-window might be up to N-1 microns longer than the others if the original duration is not a multiple of N. Also, if the original window is M microns long where M < N (however unlikely that might be), only M sub-windows will be produced.
Commits:
chooseP(your parser, nullP)
with some extra processing that turns it intoOptional<your parser's output>
.CodeLocation
record in ConstraintsCompilationError to have nullable fields, because runtime errors don't report code locationVerification
Plenty of tests, see last commit.
Documentation
The API method is doc-commented. I'll update wiki after approval but before merge.