Fix “planner_discount” option of “discretionary_policy”

Since fe0c781c06, the discount factor would
always be equal to one.

Ref. dynare#1699
issue#70
Sébastien Villemot 2020-01-30 15:42:39 +01:00
parent 3fec11b183
commit ee972d9638
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 10 additions and 4 deletions

View File

@ -2222,14 +2222,20 @@ ParsingDriver::evaluate_planner_objective()
void
ParsingDriver::discretionary_policy()
{
/* The logic here is different from “ramsey_policy” and “ramsey_model”,
because we want to allow several instances of discretionary_policy in
the same .mod file. */
if (!mod_file->symbol_table.exists("optimal_policy_discount_factor"))
{
declare_parameter("optimal_policy_discount_factor");
init_param("optimal_policy_discount_factor", data_tree->One);
}
declare_parameter("optimal_policy_discount_factor");
if (!planner_discount)
planner_discount = data_tree->One;
init_param("optimal_policy_discount_factor", planner_discount);
mod_file->addStatement(make_unique<DiscretionaryPolicyStatement>(symbol_list, options_list));
symbol_list.clear();
options_list.clear();
planner_discount = nullptr;
}
void