Fix check for the presence of ramsey_{model,policy} when ramsey_constraints is used
The existing check would incorrectly fail if ramsey_constraints appeared before ramsey_{model,policy}. Also, the check would not terminate the processing in case of error. Closes: #91fix-tolerance-parameters
parent
621134b8d8
commit
a431682697
|
@ -545,8 +545,7 @@ RamseyConstraintsStatement::RamseyConstraintsStatement(const SymbolTable &symbol
|
||||||
void
|
void
|
||||||
RamseyConstraintsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
RamseyConstraintsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||||
{
|
{
|
||||||
if (!mod_file_struct.ramsey_model_present && !mod_file_struct.ramsey_policy_present)
|
mod_file_struct.ramsey_constraints_present = true;
|
||||||
cerr << "ramsey_constraints: can only be used with ramsey_model or ramsey_policy" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -170,6 +170,12 @@ ModFile::checkPass(bool nostrict, bool stochastic)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mod_file_struct.ramsey_constraints_present && !mod_file_struct.ramsey_model_present && !mod_file_struct.ramsey_policy_present)
|
||||||
|
{
|
||||||
|
cerr << "ERROR: A ramsey_constraints block requires the presence of a ramsey_model or ramsey_policy statement" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
if ((mod_file_struct.osr_present && (!mod_file_struct.osr_params_present || !mod_file_struct.optim_weights_present))
|
if ((mod_file_struct.osr_present && (!mod_file_struct.osr_params_present || !mod_file_struct.optim_weights_present))
|
||||||
|| ((!mod_file_struct.osr_present || !mod_file_struct.osr_params_present) && mod_file_struct.optim_weights_present)
|
|| ((!mod_file_struct.osr_present || !mod_file_struct.osr_params_present) && mod_file_struct.optim_weights_present)
|
||||||
|| ((!mod_file_struct.osr_present || !mod_file_struct.optim_weights_present) && mod_file_struct.osr_params_present))
|
|| ((!mod_file_struct.osr_present || !mod_file_struct.optim_weights_present) && mod_file_struct.osr_params_present))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006-2021 Dynare Team
|
* Copyright © 2006-2022 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -149,6 +149,8 @@ public:
|
||||||
bool shocks_surprise_present{false};
|
bool shocks_surprise_present{false};
|
||||||
// Whether an occbin_constraints block appears
|
// Whether an occbin_constraints block appears
|
||||||
bool occbin_constraints_present{false};
|
bool occbin_constraints_present{false};
|
||||||
|
// Whether a ramsey_constraints block appears
|
||||||
|
bool ramsey_constraints_present{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Statement
|
class Statement
|
||||||
|
|
Loading…
Reference in New Issue