diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 7d917e3555776308c56225f420173908cb790d0c..38b0e8ba0af4873554b644226e67689bc110c55f 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -785,6 +785,7 @@ void PlannerObjectiveStatement::checkPass(ModFileStructure &mod_file_struct) { assert(model_tree->equation_number() == 1); + mod_file_struct.planner_objective_present = true; } void diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc index 44a7225d5bb645b0810b76a560834012abed36f0..1499e8dc8b26cb61efea22aa905f4e14a139b978 100644 --- a/preprocessor/ModFile.cc +++ b/preprocessor/ModFile.cc @@ -123,6 +123,13 @@ ModFile::checkPass() exit(EXIT_FAILURE); } + if ((mod_file_struct.ramsey_policy_present && !mod_file_struct.planner_objective_present) + || (!mod_file_struct.ramsey_policy_present && mod_file_struct.planner_objective_present)) + { + cerr << "ERROR: A planner_objective statement must be used with a ramsey_policy statement and vice versa." << endl; + exit(EXIT_FAILURE); + } + if (mod_file_struct.simul_present && stochastic_statement_present) { cerr << "ERROR: A .mod file cannot contain both a simul command and one of {stoch_simul, estimation, osr, ramsey_policy}" << endl; diff --git a/preprocessor/Statement.cc b/preprocessor/Statement.cc index 8cff67d989ac1268067c73f24212a7f41d0f4a55..c9b294522146efb6525966499c2e9b387849e3cf 100644 --- a/preprocessor/Statement.cc +++ b/preprocessor/Statement.cc @@ -27,6 +27,7 @@ ModFileStructure::ModFileStructure() : estimation_present(false), osr_present(false), ramsey_policy_present(false), + planner_objective_present(false), order_option(0), bvar_present(false), svar_identification_present(false), diff --git a/preprocessor/Statement.hh b/preprocessor/Statement.hh index 27a8b3d2a7a04f946cfb64aeda98b23a8f71fcc1..2778771bb2cd3489a1dbf5a56e658fd9ccd29ca1 100644 --- a/preprocessor/Statement.hh +++ b/preprocessor/Statement.hh @@ -46,6 +46,8 @@ public: bool osr_present; //! Whether a ramsey_policy statement is present bool ramsey_policy_present; + //! Whether a planner_objective statement is present + bool planner_objective_present; //! The value of the "order" option of stoch_simul, estimation, osr, ramsey_policy //! Derivation order /*! First initialized to zero. If user sets order option somewhere in the MOD file, it will be equal to the maximum of order options. Otherwise will default to 2 */