NASA-AMMOS / aerie

A software framework for modeling spacecraft.
https://nasa-ammos.github.io/aerie-docs/
MIT License
73 stars 19 forks source link

Stateless Aerie - Scheduling #1506

Open dandelany opened 4 months ago

dandelany commented 4 months ago

Description

Per discussions with @ewferg, some users would like an officially-supported way to use Aerie's simulation and scheduling engines as a simpler "stateless" and "headless" program.

Requirements

We don't yet have all of the requirements or implementation fully planned out yet, but I wanted to open this to track our progress. I will meet with @ewferg soon to discuss - please comment here or in Slack if you're interested in participating. As a starting point, here's a rough draft of some requirements:

  1. Users should be able to run Aerie's simulation engine alone in a stateless way, by running a command and providing two inputs: a mission model JAR file, and an Aerie plan file containing activity directives. Aerie should run the simulation, output any useful results (grounded activity instances, profiles, other TBD?) and exit.
  2. Users should also be able to run scheduling alone statelessly, by running a command and providing a mission model, an Aerie plan, and scheduling goals as inputs. Aerie should execute the scheduling goals (possibly running more simulations in the process), output useful results, and exit.
  3. For a reasonably small model/plan/set of goals (to be defined), stateless simulation should be able to run in < 10 seconds, and stateless scheduling should run in < 30 seconds, to be competitive with existing tools that users are using today instead of Aerie.

Notes & Questions

ewferg commented 4 months ago

A couple additional notes and questions to consider:

joshhaug commented 4 months ago

Seconding this use case. A headless Aerie would make it a much more viable drop-in replacement in legacy ops planning toolchains. I’m particularly thinking of SMAP, but there are likely several other missions that could use such a feature.

Exposing some standard driver interface that lets a user run procedural scheduling, perform a simulation, grab the decomposed activities’ computed attributes, export resource timelines, etc. would be very useful.

Some of this wrapper code has definitely been implemented on a per-adaptation level, but having it as part of the core would be stellar.

dandelany commented 3 months ago

Met with Aerie developers today to start sketching out implementation details for this... Some conclusions from this:

ewferg commented 3 months ago

I just want to throw one more thing out there that I think is reasonable to include in our trade space. While we could implement a standalone command line stateless Aerie, it may be sufficient enough to provide a template that users could use to build their own command line utility. This template would include a basic main() function, helper functions to orchestrate simulation and scheduling (and potentially constraint checking in the future), and helper functions for reading/writing data. This would require users to use an IDE to build their own stateless Aerie, but give them more control to design their stateless Aerie to meet their specific needs.

For example, in the SMAP use case, plan and simulation data output is actually not what's important to them. Instead it's sequences embedded in contributed attributes within activities. In this example, SMAP could design their stateless Aerie to simply write out the sequences, which would require some mission-specific code, instead of having to write a separate script to do that work. Admittedly another way to do this would be to write a scheduling procedure that writes out the sequences and run that procedure last, which could be done with a generic stateless Aerie utility that provided an orchestration script. This, in fact, is the way that APGen worked via command line.

Another question I have is whether a user could bundle model and procedure jars together so as not to have to input a bunch of procedure jars separately into a command line utility. It's not uncommon to have 10s (maybe even 100s) of scheduling procedures and dealing with all of those separately would be painful.

Mythicaeda commented 3 months ago

Headless Aerie is now demoable for simulation, complete with JSON Sim Results. Open tasks:

Mythicaeda commented 3 months ago

Discussed briefly with @JoelCourtney what ought to be expected from scheduling. We agreed that an updated plan.json makes sense as the default output, with an additional flag to optionally write the final sim results to a file. Scheduling goal satisfaction did not come up.

mattdailis commented 3 months ago

Suggestion from demos: Consider adding a validate subcommand that runs validation on each activity in the plan.json

dandelany commented 2 months ago

To recap some past progress since the last update:

We met today to talk about next steps for supporting running procedural scheduling goals using Stateless Aerie. Meeting notes:

dandelany commented 2 months ago

One small issue we noticed with Stateless Aerie during testing with @Mythicaeda today: When you run a simulation, the events portion of the SimulationResults object that gets returned is supposed to look like:

{ ..., "events": [ EVENTS HERE ] }

Instead, it currently returns this wrapped format:

{ ..., "events": { "event": [ EVENTS HERE ] } }