You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ltm: enumerate variable-level loops first, expand only cross-element subgraph #482
model_element_loop_circuits in src/simlin-engine/src/db_analysis.rs enumerates circuits directly on the element graph. For a pure-A2A model with V variables over an N-element dimension, every variable-level cycle inflates to N element-level cycles that build_element_level_loops then collapses back to one A2A loop. Cost is multiplicative when it should be additive in N.
The 2026-04-25 per-reference graph refactor removed the spurious N x N edges that made FixedIndex models worst-case, but the structural multiplication for pure-A2A loops remains. Dense-feedback A2A subgraphs still trip the MAX_LTM_SCC_NODES = 50 auto-flip gate sooner than variable-level enumeration would.
Locations
src/simlin-engine/src/db_analysis.rs:1497-1508 -- model_element_loop_circuits calls find_indexed_circuits_with_limit(usize::MAX) on the element graph directly
src/simlin-engine/src/db_ltm.rs::build_element_level_loops -- the collapsing step
Suggested fix
Enumerate cycles at the variable level first.
Tag each cycle's edges by RefShape: same-element (A2A pass-through), cross-element, or scalar.
For cycles that are pure same-element, emit one Loop per cycle with dimensions set; do not enter the element-level enumerator.
Only run element-level enumeration on the cross-element subgraph (or cycles whose tag set is mixed/cross-element).
Cost becomes additive in N for pure-A2A loops instead of multiplicative; SCC width stays below the auto-flip threshold for many real models.
Activity
engine: deprecate legacy element-only loop circuits + update gate doc…
engine: address minor review feedback on ltm tiered enumeration
doc: design note for variable-level ltm loop enumeration (#482)
engine: gate ltm auto-flip on variable+slow-path scc not full element…
doc: capture measurements and update ltm tiered enumeration docs (#482)
engine: deprecate legacy element-only loop circuits + update gate doc…
engine: address minor review feedback on ltm tiered enumeration