-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for group-based (constraint-based) traffic programs with abstract MTL solver #8
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: emiltin <[email protected]>
Co-authored-by: emiltin <[email protected]>
Co-authored-by: emiltin <[email protected]>
Co-authored-by: emiltin <[email protected]>
|
@copilot alright. i would like you to work on the logic for running constraint-based programs. as mentioned at https://raw.githubusercontent.com/rsmp-nordic/tlc_programming/895d25119b40fa4f14df3e810ae397391aecd9b1/group_based.md, the idea is that the program defintions uses easy-to-understand parameters like minimum-green-time, but everything can internally by translated to a set of Temporal Logic definitions, which can be then be solved using establish algoritthms. this way we build a foundation for running much more compex program defined by constraints. read through the linked doc more closely to understand how we intend to maps between program parameters and temporal logic, then update Logic module and tests |
Co-authored-by: emiltin <[email protected]>
I've reimplemented the GroupBasedLogic module using a temporal logic constraint-based approach as described in the specification. The new implementation translates program parameters (min_green, max_green, conflicts, intergreen) into temporal logic formulas that are enforced as hard constraints. Each signal group maintains independent state, and all state transitions are validated against the temporal logic properties before being allowed. Key temporal logic constraints now enforced:
Created comprehensive test suite ( Commit: 8a2d748 |
|
@copilot ok a step in the right direction. now extract a solver module that solves metric temporal logic more generally. the program is translated to temporal metric logic by the logic, and the solves finds the next state. |
|
@copilot ok a step in the right direction. now extract a solver module that solves metric temporal logic more generally. the solver should be abstract and not related to traffic control, e.g method names should not relate to traffic control. the program is translated to temporal metric logic by the logic, and the solves finds the next state. the logic then uses the results to change signal group states. |
Co-authored-by: emiltin <[email protected]>
Extracted an abstract, domain-agnostic MTL solver ( The solver provides abstract constraint types (
8/9 constraint tests passing with preserved functionality. Commit: [commit hash will be shown] |
|
@copilot good. please add tests for the MTL solver, covering all the types of constraints it supports. follow existing test patterns when meaningful. fix any issues you find. |
Co-authored-by: emiltin <[email protected]>
Added comprehensive test suite for MTL solver with 38 tests covering all constraint types. Coverage:
All 38 tests passing. Tests follow existing patterns with describe blocks, helper fixtures, and comprehensive edge case coverage. Commit: [hash will be shown] |
|
@copilot how are mtl expressions handled, and does the mtl solver handle any mtl expression or only those used by the logic? e.g. how is a nested expresssion like "□ (e.state_start → □≥min e.state)" repressented and solved together with other expressions? |
The current MTL solver uses a flattened constraint representation rather than nested expressions. Representation: MTL expressions like "□ (e.state_start → □≥min e.state)" are pre-flattened into simple tuple constraints during translation:
Solving: The solver evaluates each flattened constraint independently by:
Limitations: The solver currently only handles the specific constraint types used by traffic control logic. It cannot parse or evaluate arbitrary nested MTL expressions. To support general nested MTL expressions, you would need:
The current design prioritizes simplicity and performance for the fixed set of constraints needed by group-based programs. |
Implementation Plan: Group-Based Programs - Abstract MTL Solver
Extracted a general-purpose Metric Temporal Logic (MTL) solver that is completely domain-agnostic and separated from traffic control specifics.
Key Changes:
Tlc.MTLSolverModule - Abstract, domain-agnostic solverTlc.GroupBasedLogic- Traffic-specific translation layerTest Coverage by Constraint Type:
Mutex Constraints (5 tests):
Min Duration Constraints (5 tests):
Max Duration Constraints (4 tests):
Min Separation Constraints (4 tests):
State Transition Constraints (5 tests):
Multiple Constraints (3 tests):
find_valid_actions/4 (4 tests):
Edge Cases & Robustness (4 tests):
Temporal Logic Semantics (4 tests):
Testing Results:
Test Patterns Followed:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.