Introduce conditional planner rules (ConditionalCascadesRule)#4332
Open
RobertBrunel wants to merge 1 commit into
Open
Introduce conditional planner rules (ConditionalCascadesRule)#4332RobertBrunel wants to merge 1 commit into
ConditionalCascadesRule)#4332RobertBrunel wants to merge 1 commit into
Conversation
RobertBrunel
commented
Jul 10, 2026
|
|
||
| @Override | ||
| public boolean execute() { | ||
| if (super.execute()) { |
Contributor
Author
There was a problem hiding this comment.
Should we also take into account shouldExecute() here, and immediately prune all the inner rules if false?
if (!shouldExecute()) {
return false;
}
A conditional rule bundles an ordered list of inner rules. It acts as one rule that receives special treatment by the planner. The inner rules are tried in order, stopping as soon as one rule yielded a new expression and falling through to the next rule only when the current on made no progress. In other words, each inner rule runs only under the “condition” that no prior rule made any progress. In effect, only the _first_ useful rule is applied. The motivation behind this is that, by carefully grouping strictly prioritized or mutually exclusive transformations this way, we can substantially prune the planner search space and reduce the memo size. This change adds only the `ConditionalCascadesRule` abstraction and the necessary planner plumbing to dispatch such rules. It is not added to any rule set. * Add a new `ConditionalCascadesRule` class, as well as `ConditionalExplorationCascadesRule` and `ConditionalImplementationCascadesRule` subclasses. * Add a corresponding `ConditionalTransformExpression` task that implements the mechanism of trying the rules in the conditional chain one at a time. * Change all `Task.execute()` implementations to return a boolean signaling whether the task made progress. * Propagate that boolean through `executeRuleCall()` so the surrounding `Transform` task can report whether any change to the planner state was made. Co-authored-by: Normen Seemann <nseemann@apple.com>
a9beb9d to
e8c2340
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A conditional rule bundles an ordered list of inner rules. It acts as one rule that receives special treatment by the planner. The inner rules are tried in order, stopping as soon as one rule yielded a new expression and falling through to the next rule only when the current on made no progress. In other words, each inner rule runs only under the “condition” that no prior rule made any progress. In effect, only the first useful rule is applied.
The motivation behind this is that, by carefully grouping strictly prioritized or mutually exclusive transformations this way, we can substantially prune the planner search space and reduce the memo size.
This change adds only the
ConditionalCascadesRuleabstraction and the necessary planner plumbing to dispatch such rules. It is not added to any rule set.ConditionalCascadesRuleclass, as well asConditionalExplorationCascadesRuleandConditionalImplementationCascadesRulesubclasses.ConditionalTransformExpressiontask that implements the mechanism of trying the rules in the conditional chain one at a time.Task.execute()implementations to return a boolean signaling whether the task made progress.executeRuleCall()so the surroundingTransformtask can report whether any change to the planner state was made.