diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc index 89161214635ceb549df7c9f78f80c4f618645250..b2a66eea287fa9c94763d272c053fe0f494e7cde 100644 --- a/preprocessor/ModFile.cc +++ b/preprocessor/ModFile.cc @@ -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);