bug fix: check that osr, osr_params and optim_weights appear together
parent
d430ea8e43
commit
f8a717b496
|
@ -629,6 +629,12 @@ OsrParamsStatement::OsrParamsStatement(const SymbolList &symbol_list_arg) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OsrParamsStatement::checkPass(ModFileStructure &mod_file_struct)
|
||||||
|
{
|
||||||
|
mod_file_struct.osr_params_present = true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
OsrParamsStatement::writeOutput(ostream &output, const string &basename) const
|
OsrParamsStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
{
|
{
|
||||||
|
@ -681,6 +687,12 @@ OptimWeightsStatement::OptimWeightsStatement(const var_weights_t &var_weights_ar
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OptimWeightsStatement::checkPass(ModFileStructure &mod_file_struct)
|
||||||
|
{
|
||||||
|
mod_file_struct.optim_weights_present = true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
OptimWeightsStatement::writeOutput(ostream &output, const string &basename) const
|
OptimWeightsStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -185,6 +185,7 @@ private:
|
||||||
const SymbolList symbol_list;
|
const SymbolList symbol_list;
|
||||||
public:
|
public:
|
||||||
OsrParamsStatement(const SymbolList &symbol_list_arg);
|
OsrParamsStatement(const SymbolList &symbol_list_arg);
|
||||||
|
virtual void checkPass(ModFileStructure &mod_file_struct);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -308,6 +309,7 @@ public:
|
||||||
OptimWeightsStatement(const var_weights_t &var_weights_arg,
|
OptimWeightsStatement(const var_weights_t &var_weights_arg,
|
||||||
const covar_weights_t &covar_weights_arg,
|
const covar_weights_t &covar_weights_arg,
|
||||||
const SymbolTable &symbol_table_arg);
|
const SymbolTable &symbol_table_arg);
|
||||||
|
virtual void checkPass(ModFileStructure &mod_file_struct);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,14 @@ ModFile::checkPass()
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.optim_weights_present) && mod_file_struct.osr_params_present))
|
||||||
|
{
|
||||||
|
cerr << "ERROR: The osr statement must be used with osr_params and optim_weights." << 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;
|
||||||
|
|
|
@ -26,6 +26,8 @@ ModFileStructure::ModFileStructure() :
|
||||||
stoch_simul_present(false),
|
stoch_simul_present(false),
|
||||||
estimation_present(false),
|
estimation_present(false),
|
||||||
osr_present(false),
|
osr_present(false),
|
||||||
|
osr_params_present(false),
|
||||||
|
optim_weights_present(false),
|
||||||
ramsey_policy_present(false),
|
ramsey_policy_present(false),
|
||||||
planner_objective_present(false),
|
planner_objective_present(false),
|
||||||
order_option(0),
|
order_option(0),
|
||||||
|
|
|
@ -44,6 +44,10 @@ public:
|
||||||
bool estimation_present;
|
bool estimation_present;
|
||||||
//! Whether an osr statement is present
|
//! Whether an osr statement is present
|
||||||
bool osr_present;
|
bool osr_present;
|
||||||
|
//! Whether an osr params statement is present
|
||||||
|
bool osr_params_present;
|
||||||
|
//! Whether an optim weight statement is present
|
||||||
|
bool optim_weights_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
|
//! Whether a planner_objective statement is present
|
||||||
|
|
Loading…
Reference in New Issue