Skip to content

TPI could stop early and report when the outer loop has stalled #1177

Description

@marcelolafleur

I've been testing country calibrations, and when a TPI run stops making progress it would be useful to know right away — today the only stop besides success is maxiter, so a hopeless run burns its full budget before raising Transition path equlibrium not found, with no hint about why.

Example: an OG-PHL multi-industry reform at nu=0.4 ran to iteration 203 of 250 with the distance bouncing between 0.04 and 0.6 (tolerance 1e-05). Its best distance stopped improving before iteration 80 — everything after was waiting in hopelessness. The same model converges in 23 iterations at nu=0.2.

Proposal: a window check on the existing TPIdist_vec — if the best distance hasn't improved over the last N iterations, report a diagnosis. The message would distinguish bounded oscillation (suggest lowering nu, or TPI_outer_method="anderson") from monotone divergence (usually an inconsistent fiscal block, not a solver problem — lowering nu won't help). The behavior would be optional: either opt-in, or on by default with a warn-only mode that logs the diagnosis and lets the run continue. Works for both picard and anderson.

I'll draft a PR with this for review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions