Skip to content

ltm: module stocks reached only through internal feedback are ignored #282

Closed as not planned

Description

@bpowers

When a feedback loop passes through a module, LTM adds the module's internal stocks to the loop's stock list, but only stocks that sit on a simple path from the module's input to its output.
A stock that affects the output only through an internal feedback loop hanging off that path is not added.

Example

A user module with input -> a -> output, where a also depends on stock_b and stock_b's inflow depends on a.
A parent loop through this module gets no internal stocks, because stock_b is not on the input -> a -> output path.

Why it matters

Probably not at all.
The input-to-output path in this example has no stock on it, so a parent-level cycle through the module is simultaneous end to end: it is an algebraic loop at the parent level, not a feedback loop through state.
Leaving stock_b out is arguably the right answer.

The enriched stock list is used in one place that changes results: a pinned loop is rejected if it contains no stock, and module-internal stocks count.
It does not affect cycle partitions, since module-internal stocks never appear in the parent's partition map.
Every built-in module (SMOOTH, DELAY, TREND) has its stocks on the direct path.
No real model has this shape.

Fix

None recommended.
If a real model shows a loop wrongly treated as stockless, collect every stock reachable from the nodes on the path (simple, may over-count).

Pointers

  • src/simlin-engine/src/ltm/graph.rs (enrich_with_module_stocks, all_module_stocks)
  • src/simlin-engine/src/db/ltm/pinned.rs (the "contains no stock" check)

Activity

  1. added
    ltm
    on May 1, 2026
  2. changed the title [-]LTM: module stock enrichment misses stocks reachable only through internal feedback cycles[/-] [+]ltm: module stocks reached only through internal feedback are ignored[/+] on Oct 12, 2026
  3. added
    wontfix
    on Oct 12, 2026
  4. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing as won't fix.

    In the issue's own example the input-to-output path has no stock, so the parent cycle is algebraic and leaving the stock out is arguably correct; the stock list only affects the pinned-loop 'no stock' check, all built-in modules are fine, and no real model has this shape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ltmwontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions