Skip to content

Report the size and location of a resource-constraint failure in TPI - #1213

Open
arihantlodha-cmd wants to merge 2 commits into
PSLmodels:masterfrom
arihantlodha-cmd:rc-error-diagnostics
Open

Report the size and location of a resource-constraint failure in TPI#1213
arihantlodha-cmd wants to merge 2 commits into
PSLmodels:masterfrom
arihantlodha-cmd:rc-error-diagnostics

Conversation

@arihantlodha-cmd

Copy link
Copy Markdown
Contributor

When a transition path fails the resource-constraint check, the error is a bare Transition path equlibrium not found (RC_error) with no indication of how large the violation is or which period it is in. Working out whether a failure is a benign boundary artifact or a real calibration problem meant reloading the saved TPI_vars.pkl and profiling resource_constraint_error by hand.

This puts the diagnostic in the message: the maximum absolute resource-constraint error, the period it occurs in, and the tolerance, plus a one-line note on how to read it (a violation confined to the first or last periods is usually an initial- or terminal-boundary artifact; one spread across the path points to an inconsistent calibration). It mirrors the existing outer-loop stall messages, which already name the likely cause. Also fixes the equlibrium typo in that message.

Message-only change: it does not alter when the check fires, only what it reports when it does.

When the transition path fails the resource-constraint check, the error was
a bare 'equilibrium not found (RC_error)' with no indication of how large the
violation was or where it occurred, so diagnosing it meant reloading the
saved path and profiling resource_constraint_error by hand. This puts the
maximum absolute error, the period it occurs in, and the tolerance in the
message, and notes how to read it: a violation confined to the first or last
periods is usually an initial- or terminal-boundary artifact, while one
spread across the path points to an inconsistent calibration. Also fixes the
'equlibrium' typo in that message.
@codecov-commenter

codecov-commenter commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.09%. Comparing base (a30defc) to head (8ff15ac).

Files with missing lines Patch % Lines
ogcore/TPI.py 83.33% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1213      +/-   ##
==========================================
+ Coverage   74.07%   74.09%   +0.02%     
==========================================
  Files          22       22              
  Lines        5920     5925       +5     
==========================================
+ Hits         4385     4390       +5     
  Misses       1535     1535              
Flag Coverage Δ
unittests 74.09% <83.33%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ogcore/TPI.py 35.82% <83.33%> (+0.57%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Codecov flagged the new resource-constraint diagnostic lines as uncovered.
Pull the message construction out of run_TPI into a small _rc_error_message
helper and add test_rc_error_message, which checks it names the largest
violation, the period it occurs in, and the tolerance. No behavior change.
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.

2 participants