Procedural Constraints and Goals MVP Proposal #667
JoelCourtney
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Elevator Pitch
Goals and constraints essentially just implement a very basic interface, either
SimulationResults -> List<Violation>
for constraints orSimulationResults -> List<Conflict>
for goals. The current eDSLs restrict these implementations to only use a small set of predefined operations. We try to make the operations general and robust, but so far they have not been satisfactory, and there’s not much reason to suspect that any specific set of operations would be “enough” (short of Turing completeness). Rather than maintain an endlessly growing list of operations, each one of which is surprisingly expensive for us to implement, we ought to have a system where the author can implement the interface with any algorithm - it might be daunting to learn, but that’s better than waiting for us to implement and release an operation that would otherwise be trivial if they could just write the code themselves.MVP checklist
Violations: why not just use spans? They can already have activity associations.Expression<Violation>
Goal
typetemporalContext
toInterval bounds
: there is noapplyWhen
in procedure-land, because that configuration is internal to the goalInterface design
We would need to provide a library for authors to use, and I expect it could be much smaller than the current packages. We wouldn’t need to provide/maintain an extra API, an AST and parsers, and all the tests that go with them.
Important bit: One of the major motivating factors (from my perspective) is ease of maintenance. When we need to change the procedural constraints/scheduling packages, it’ll be (no exaggeration) an order of magnitude easier than changing the eDSLs. If we try to directly reuse the existing data structures (profiles, windows, conflicts) without immediately deprecating the eDSLs, we will lose the main benefit of this effort. So for that reason I think we should implement a new package that can be changed independently of the eDSLs (which incidentally I’ve already mostly done for constraints, in my old lazy profile PR).
The skeleton of a constraint or goal would be pretty simple:
This is an MVP, so there is no evaluation bounds. It is assumed to be the simulation results bounds, but more control could be added in later (i.e. adding a second
Interval bounds
argument).Also, the constraint returns
Spans
, because it’s basically the same data structure. This is a pretty good concrete example of the motivations for the whole idea too: currently if you convert a boolean profile toSpans
, thetrue
segments become the spans, which is the opposite of what you’d want for a Constraint. This could be worked around by a.not()
, but for example lets assume that didn't exist:intoSpans
method to configure which segments turn into Spans, but doing the same task in the eDSL would take half to all of a day of dedicated work and need to be planned in a sprint.Keep in mind that procedural goals and constraints have access to the data they operate on. They don’t need to represent their operations in an AST for later evaluation. So we wouldn’t need to keep control flow operations like
ForEachActivity
in the interface: Java is the interface, and we wouldn’t use it if it didn’t already have for loops :).Future Work
Procedural constraints’ ease of use would be pretty much on par with the eDSL out of the box, because the eDSL interface methods typically represent a single operation mirrored exactly from the backend. Procedural goals are a different story. The general algorithm of a goal can be broken down into a few steps though, and we could provide shortcuts for common patterns.
But just to reiterate one last time - none of this future work expands the capabilities of procedural goals. All of the above would be possible in the MVP, and future work would only focus on making it simpler.
Beta Was this translation helpful? Give feedback.
All reactions