Skip to content
Snippets Groups Projects
Commit fe6f8ee2 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Ramsey policy: compute FOC *after* removing leads/lags of two or more.

Otherwise, on big models with lots of leads/lags (like GPM7), the Lagrangian
can be so huge that the preprocessor requires an insane amount of memory.
parent daf4cb14
No related branches found
No related tags found
No related merge requests found
......@@ -330,26 +330,6 @@ ModFile::transformPass(bool nostrict)
dynamic_model.removeTrendVariableFromEquations();
}
if (mod_file_struct.ramsey_model_present)
{
StaticModel *planner_objective = NULL;
for (vector<Statement *>::iterator it = statements.begin(); it != statements.end(); it++)
{
PlannerObjectiveStatement *pos = dynamic_cast<PlannerObjectiveStatement *>(*it);
if (pos != NULL)
planner_objective = pos->getPlannerObjective();
}
assert(planner_objective != NULL);
ramsey_model_orig_eqn_nbr = dynamic_model.equation_number();
/*
clone the model then clone the new equations back to the original because
we have to call computeDerivIDs (in computeRamseyPolicyFOCs and computingPass)
*/
dynamic_model.cloneDynamic(ramsey_FOC_equations_dynamic_model);
ramsey_FOC_equations_dynamic_model.computeRamseyPolicyFOCs(*planner_objective);
ramsey_FOC_equations_dynamic_model.replaceMyEquations(dynamic_model);
}
if (mod_file_struct.stoch_simul_present
|| mod_file_struct.estimation_present
......@@ -371,6 +351,27 @@ ModFile::transformPass(bool nostrict)
dynamic_model.substituteEndoLagGreaterThanTwo(true);
}
if (mod_file_struct.ramsey_model_present)
{
StaticModel *planner_objective = NULL;
for (vector<Statement *>::iterator it = statements.begin(); it != statements.end(); it++)
{
PlannerObjectiveStatement *pos = dynamic_cast<PlannerObjectiveStatement *>(*it);
if (pos != NULL)
planner_objective = pos->getPlannerObjective();
}
assert(planner_objective != NULL);
ramsey_model_orig_eqn_nbr = dynamic_model.equation_number();
/*
clone the model then clone the new equations back to the original because
we have to call computeDerivIDs (in computeRamseyPolicyFOCs and computingPass)
*/
dynamic_model.cloneDynamic(ramsey_FOC_equations_dynamic_model);
ramsey_FOC_equations_dynamic_model.computeRamseyPolicyFOCs(*planner_objective);
ramsey_FOC_equations_dynamic_model.replaceMyEquations(dynamic_model);
}
if (differentiate_forward_vars)
dynamic_model.differentiateForwardVars(differentiate_forward_vars_subset);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment