From 420e80e5386fb215b77d4b89d9605b6be310d228 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 23 Jun 2016 20:50:17 +0200
Subject: [PATCH] discretionary_policy: Call steady_state-file to make sure
 that parameter dependence is correctly handled

Prevents cryptic crashes due to NaN in derivatives of objective function
---
 matlab/discretionary_policy_1.m | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/matlab/discretionary_policy_1.m b/matlab/discretionary_policy_1.m
index c7fc88888d..931d3b596f 100644
--- a/matlab/discretionary_policy_1.m
+++ b/matlab/discretionary_policy_1.m
@@ -60,6 +60,12 @@ else
     lead_lag_incidence = M_.lead_lag_incidence;
 end
 
+%call steady_state_file if present to update parameters
+if options_.steadystate_flag
+    % explicit steady state file
+    [junk,M_.params,info] = evaluate_steady_state_file(oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_, ...
+                                                   options_,0);
+end
 [U,Uy,W] = feval([M_.fname,'_objective_static'],zeros(endo_nbr,1),[], M_.params);
 if any(any(Uy~=0))
     error(['discretionary_policy: the objective function must have zero ' ...
-- 
GitLab