-
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
Procedural constraints annotation processor + build logic #1611
base: develop
Are you sure you want to change the base?
Conversation
This PR is currently orphaned, pair programming hosted by @mattdailis prior to handoff. This PR has compiled a constraint w/o arguments, so it's potentially close. @JoelCourtney to add example constraints to this branch Decision to be made: support non-records or updating docs? @JoelCourtney proposing to just update docs and allow non-records later. Let's start with only records and double-back for non-record support. |
db9d10f
to
4dc61a6
Compare
State of PR: The annotation processor worked without any extra work. It was actually so good at combining the scheduling / constraints workflows that the gradle task can't tell them apart, and the original
I haven't made the equivalent of the scheduler's |
...ling/src/main/kotlin/gov/nasa/ammos/aerie/procedural/scheduling/SchedulingProcedureMapper.kt
Outdated
Show resolved
Hide resolved
cefb4ec
to
81e7fd7
Compare
5291317
to
29b501a
Compare
29b501a
to
60626ae
Compare
60626ae
to
aea67e7
Compare
aea67e7
to
b2ee0d9
Compare
|
while(currentAnchorId != null && anchoredToStart){ | ||
currentActivityDirective = completeMapOfDirectives.get(currentAnchorId); | ||
currentAnchorId = currentActivityDirective.anchorId(); | ||
|
||
if (currentAnchorId.equals(firstId)) { |
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.
This line needs to be reversed to avoid a NPE: if(firstId.equals(currentAnchorId)
This is because we know for a fact that firstId
is not null, as we otherwise wouldn't have entered the while loop, but we expect currentAnchorId
to become null at some point, assuming there is no cycle.
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.
Additionally, I'm not sure if tracking a single id (as opposed to the set of all seen ids so far) is sufficient to detect a cycle, as the cycle may start further up than the initial directive id. If it is, could you please break down why it is?
For context, the database uses the "set of all seen ids" approach to detecting cycles.
Set
proposal based on what I did to get tests working on my branch:
final var seenIds = new HashSet<ActivityDirectiveId>();
seenIds.add(currentAnchorId);
while(currentAnchorId != null && anchoredToStart){
currentActivityDirective = completeMapOfDirectives.get(currentAnchorId);
currentAnchorId = currentActivityDirective.anchorId();
if (seenIds.contains(currentAnchorId)) {
throw new IllegalStateException("Anchor ID cycle detected on " + currentAnchorId);
}
//...
This fix belongs in #1611 but I want tests on my branch to pass
Description
This PR does a few things related to procedural constraints workflow:
ConstraintProcedure
annotation and handles it together with scheduling procedures in the same processor.EditablePlan
,Plan
, andSImulationResults
interfaces for stateless-aerie plan objects.ObeyConservationOfBanana
and tests it using plan stubs and stateless simulation. This is less a test of the constraint itself, and more a test-that-testing-is-actually-possible kind of thing.Verification
Documentation
I still need to update the procedural constraints docs.
Future work
We now have nearly everything for a full-loop external scheduler run. Once we make a plan serializer, you could make a driver that loads a plan from file, runs a series of constraints and goals (with simulation), and outputs a result plan.