allowing for different number of periods in conditional_forecast_path
parent
63a334cfd3
commit
680fb72d0d
|
@ -450,13 +450,12 @@ ConditionalForecastPathsStatement::checkPass(ModFileStructure &mod_file_struct,
|
||||||
for (auto elem : elems)
|
for (auto elem : elems)
|
||||||
// Period1 < Period2, as enforced in ParsingDriver::add_period()
|
// Period1 < Period2, as enforced in ParsingDriver::add_period()
|
||||||
this_path_length = max(this_path_length, elem.period2);
|
this_path_length = max(this_path_length, elem.period2);
|
||||||
if (path_length == -1)
|
path_length = max(this_path_length, path_length);
|
||||||
path_length = this_path_length;
|
// else if (path_length != this_path_length)
|
||||||
else if (path_length != this_path_length)
|
// {
|
||||||
{
|
// cerr << "conditional_forecast_paths: all constrained paths must have the same length!" << endl;
|
||||||
cerr << "conditional_forecast_paths: all constrained paths must have the same length!" << endl;
|
// exit(EXIT_FAILURE);
|
||||||
exit(EXIT_FAILURE);
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +464,7 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
|
||||||
{
|
{
|
||||||
assert(path_length > 0);
|
assert(path_length > 0);
|
||||||
output << "constrained_vars_ = [];" << endl
|
output << "constrained_vars_ = [];" << endl
|
||||||
<< "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl;
|
<< "constrained_paths_ = NaN(" << paths.size() << ", " << path_length << ");" << endl;
|
||||||
|
|
||||||
int k = 1;
|
int k = 1;
|
||||||
for (auto it = paths.begin();
|
for (auto it = paths.begin();
|
||||||
|
@ -475,7 +474,6 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
|
||||||
output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
|
output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
|
||||||
else
|
else
|
||||||
output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
|
output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
|
||||||
|
|
||||||
const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
|
const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
|
||||||
for (auto elem : elems)
|
for (auto elem : elems)
|
||||||
for (int j = elem.period1; j <= elem.period2; j++)
|
for (int j = elem.period1; j <= elem.period2; j++)
|
||||||
|
|
Loading…
Reference in New Issue