Commit 2a2da609 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

ms-sbvar: enforce consecutive chain numbers for markov_switching

parent 7ec25ee2
/*
* Copyright (C) 2003-2011 Dynare Team
* Copyright (C) 2003-2012 Dynare Team
*
* This file is part of Dynare.
*
......@@ -1427,6 +1427,16 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(const OptionsList &options_li
void
MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct)
{
OptionsList::num_options_t::const_iterator itChain = options_list.num_options.find("ms.chain");
assert(itChain != options_list.num_options.end());
int chainNumber = atoi(itChain->second.c_str());
if (++mod_file_struct.last_markov_switching_chain != chainNumber)
{
cerr << "ERROR: The markov_switching chain option takes consecutive integers "
<< "beginning at 1." << endl;
exit(EXIT_FAILURE);
}
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("ms.restrictions");
if (it_num != options_list.num_options.end())
{
......
/*
* Copyright (C) 2006-2011 Dynare Team
* Copyright (C) 2006-2012 Dynare Team
*
* This file is part of Dynare.
*
......@@ -50,7 +50,8 @@ ModFileStructure::ModFileStructure() :
corr_prior_statement_present(false),
options_statement_present(false),
std_options_statement_present(false),
corr_options_statement_present(false)
corr_options_statement_present(false),
last_markov_switching_chain(0)
{
}
......
/*
* Copyright (C) 2006-2011 Dynare Team
* Copyright (C) 2006-2012 Dynare Team
*
* This file is part of Dynare.
*
......@@ -100,6 +100,8 @@ public:
bool std_options_statement_present;
//! Whether there is a corr options statement present
bool corr_options_statement_present;
//! Last chain number for Markov Switching statement
int last_markov_switching_chain;
};
class Statement
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment