Add generic any-witness strategy for constrained path search - #18
Merged
Conversation
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.
Summary
This PR adds a generic Any witness (fast) strategy to bounded, Declare-constrained path search.
The existing Shortest paths strategy remains the default and preserves deterministic shortest-first behavior. The new strategy prioritizes candidates that have made greater progress toward satisfying and exercising the configured Declare constraints.
Users can request one or more witnesses. Any-witness results are returned in deterministic heuristic discovery order and are not guaranteed to be shortest.
Motivation
Shortest-first exploration can spend a large part of the candidate budget enumerating shallow prefixes that make little progress toward the configured constraints.
This is especially expensive for highly branching state spaces and target-free constrained searches, where finding any satisfying execution is often more useful than proving that the returned execution is shortest.
The new strategy provides a faster alternative without introducing graph- or model-specific knowledge.
Changes
Search strategy
PathSearchStrategywith:shortestany-witnessshortestas the default for backward compatibility.Any-witness prioritization
Any-witness search prioritizes candidates using generic Declare-monitor progress:
The heuristic does not contain model-specific transition names, data fields, or constraint assumptions.
Multiple witnesses
Loop handling and path identity
1produces loopless paths.Persistence and UI
shortest.Documentation
Performance observation
For the ThalesDemo constrained-search example:
This is approximately a 508x reduction in expanded candidates for that example.
This result is an observation for the tested graph and constraints, not a general performance guarantee.
Compatibility
shortest.Tests
Added focused coverage verifying that:
1.2.Validation completed:
npm testnpm run lintnpm run buildnpm run build:offlineFocused path-search result:
Manual verification
Limitations