bug fix: check that planner_objective and ramsey_policy statements appear together
parent
d96ce473a8
commit
6d0b8e559e
|
@ -785,6 +785,7 @@ void
|
||||||
PlannerObjectiveStatement::checkPass(ModFileStructure &mod_file_struct)
|
PlannerObjectiveStatement::checkPass(ModFileStructure &mod_file_struct)
|
||||||
{
|
{
|
||||||
assert(model_tree->equation_number() == 1);
|
assert(model_tree->equation_number() == 1);
|
||||||
|
mod_file_struct.planner_objective_present = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -123,6 +123,13 @@ ModFile::checkPass()
|
||||||
exit(EXIT_FAILURE);
|
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)
|
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;
|
cerr << "ERROR: A .mod file cannot contain both a simul command and one of {stoch_simul, estimation, osr, ramsey_policy}" << endl;
|
||||||
|
|
|
@ -27,6 +27,7 @@ ModFileStructure::ModFileStructure() :
|
||||||
estimation_present(false),
|
estimation_present(false),
|
||||||
osr_present(false),
|
osr_present(false),
|
||||||
ramsey_policy_present(false),
|
ramsey_policy_present(false),
|
||||||
|
planner_objective_present(false),
|
||||||
order_option(0),
|
order_option(0),
|
||||||
bvar_present(false),
|
bvar_present(false),
|
||||||
svar_identification_present(false),
|
svar_identification_present(false),
|
||||||
|
|
|
@ -46,6 +46,8 @@ public:
|
||||||
bool osr_present;
|
bool osr_present;
|
||||||
//! Whether a ramsey_policy statement is present
|
//! Whether a ramsey_policy statement is present
|
||||||
bool ramsey_policy_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
|
//! The value of the "order" option of stoch_simul, estimation, osr, ramsey_policy
|
||||||
//! Derivation order
|
//! 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 */
|
/*! 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 */
|
||||||
|
|
Loading…
Reference in New Issue