Skip to content

Fix false positive algebraic loop in interconnect for MIMO feedthrough (#1257) - #1258

Open
paneendrakumar0 wants to merge 1 commit into
python-control:mainfrom
paneendrakumar0:fix-interconnect-mimo-algebraic-loop-1257
Open

paneendrakumar0 wants to merge 1 commit into
python-control:mainfrom
paneendrakumar0:fix-interconnect-mimo-algebraic-loop-1257

Conversation

@paneendrakumar0

Copy link
Copy Markdown

Fixes #1257.

Summary of Changes

In InterconnectedSystem._compute_static_io, the maximum number of iterations allowed for fixed-point signal propagation was previously bounded by len(self.syslist) + 1.

While an acyclic feedthrough path visits each subsystem block at most once in SISO interconnections, in MIMO systems with direct feedthrough, an acyclic path can traverse through different input/output channels of the same block multiple times (for example, decentralized PI control coupled to a 2x2 plant with direct feedthrough). Because len(self.syslist) + 1 was exceeded before reaching the convergence check, ct.interconnect raised RuntimeError: algebraic loop detected even when the interconnection was well-posed and strictly free of algebraic loops.

This PR updates the iteration bound:

cycle_count = max(len(self.syslist), ninputs) + 1

where ninputs is the total number of internal subsystem inputs across self.syslist.

Testing

  • Added test_interconnect_mimo_feedthrough_no_algebraic_loop: verifies the 2x2 MIMO plant with decentralized PI control interconnects without error and matches the analytical closed-loop poles from ct.feedback.
  • Added test_interconnect_algebraic_loop_detection: verifies that true algebraic loops (such as static positive feedback around feedthrough blocks) continue to be correctly detected and raise RuntimeError("algebraic loop detected").
  • All tests in control/tests/interconnect_test.py, control/tests/iosys_test.py, control/tests/statesp_test.py, and control/tests/nlsys_test.py pass cleanly (1045 passed).

python-control#1257)

In InterconnectedSystem._compute_static_io, the iteration bound
cycle_count was previously capped at len(self.syslist) + 1. For
MIMO systems with direct feedthrough, an acyclic feedthrough path can
traverse multiple channels of the same subsystem block more than once,
requiring more propagation passes than the number of subsystems.

Update cycle_count bound to max(len(self.syslist), ninputs) + 1,
where ninputs is the total number of internal subsystem inputs.
Add unit regression tests covering MIMO feedthrough without algebraic loops
and true algebraic loop detection.

Fixes python-control#1257.

Signed-off-by: paneendrakumar0 <paneendra100@gmail.com>
@slivingston
slivingston self-requested a review October 18, 2026 18:25
@slivingston

Copy link
Copy Markdown
Member

@paneendrakumar0 Can you disclose your use of AI tools, if any? Please read https://numpy.org/doc/stable/dev/ai_policy.html

@paneendrakumar0

Copy link
Copy Markdown
Author

Hi @slivingston,

Thanks for pointing me to the policy! Yes, I used an AI assistant (Google Antigravity / Gemini) during the development of this PR to assist with searching the repository, analyzing the iteration loop bound in InterconnectedSystem._compute_static_io, and formatting the regression test case.

In accordance with the NumPy AI Policy:

Understanding and verification: I have fully read, reviewed, and verified the mathematical logic and implementation myself. The root cause is that for MIMO interconnected systems with direct feedthrough (such as decentralized control of multi-channel plants), acyclic signal propagation paths can visit multiple distinct input/output channels of the same block sequentially, requiring up to ninputs + 1 iterations (or topological signal ordering) rather than len(self.syslist) + 1 (which assumed SISO blocks).
Correctness & testing: I verified the fix locally against the full test suite (pytest control/tests/, 1,045/1,045 tests passing), including the newly added regression test in interconnect_test.py that confirms closed-loop poles match standard feedback connections while true algebraic loops continue to be correctly detected.
Ownership & responsibility: I take full responsibility for the code and will address any feedback or follow-up changes requested during review.

Please let me know if you would like any adjustments to the approach or additional test coverage!

@slivingston

Copy link
Copy Markdown
Member

@paneendrakumar0 Are you using an AI agent that automatically opened this PR and produced the above comment?

@paneendrakumar0

Copy link
Copy Markdown
Author

Hi @slivingston,

No, it was not automatically opened by any bot. I(Paneendra) is doing all the tests and posting here manually.

Since you asked me for disclosure about NumPy policy, I have used some AI to help me draft the disclosure statement in such a way that it adheres to the policy checklist, hence sounding like a template. But, Iam the who is investigating the problem, writing and testing the code, and handling this PR.

Just so you know, I use the AI only for checking and doing changes in the code after me. And I am not even at the stage where I can use Agentic AI or something like AGent or Bot that auto repiles or comments in a PR:).

I am here just to handle this PR discussion, so please let me know your thoughts on this!

@slivingston

slivingston commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

@paneendrakumar0 Thanks for explaining! I will review this soon.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.747% (-0.01%) from 94.757% — paneendrakumar0:fix-interconnect-mimo-algebraic-loop-1257 into python-control:main

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

interconnect reports "algebraic loop detected" for MIMO systems with feedthrough that have no (or a well-posed) algebraic loop

3 participants