HANK: robustify steady-state input validation

This merge request improves the initialization and validation procedures for steady states in heterogeneous-agent models. It introduces a new high-level routine, initialize_steady_state, which validates the user-provided steady state using check_steady_state_input, computes the policy function values for Lagrange multipliers associated with binding complementarity constraints, and stores all necessary objects—including the processed steady state, tensor-product sizes, and interpolation matrices—into oo_.hank. This significantly simplifies the setup and enhances the robustness of downstream computations.

To support this, I modify check_steady_state_input to correctly handle cases where users optionally provide policy functions for multipliers (i.e., fields beginning with MULT_L_ or MULT_U_). Previously, their presence would lead to spurious "redundant variable" errors. This change ensures proper treatment of these optional fields without altering the core consistency checks.

A new routine, compute_steady_state_residuals, is also added to compute the residuals of the aggregate and heterogeneous blocks at the provided steady state. It uses sparse residual routines (dynamic_resid, dynamic_het1_resid).

In addition, minor improvements were made to error message formatting in several helper routines (check_fun, check_missingredundant, check_permutation), ensuring consistency and clarity for end users.

Beyond the minor improvements to error messages, this merge request depends on preprocessor!114 (merged), which introduces preprocessor-side change to unfold complementarity conditions using Lagrange multipliers in the heterogeneous part of the model.

Edited by Normann Rion

Merge request reports

Loading