Skip to content

Commit

Permalink
Fixed the MADP parser to parse 'start include/exclude' according to P…
Browse files Browse the repository at this point in the history
…OMDP.org
  • Loading branch information
TheGreatfpmK committed Feb 14, 2024
1 parent aa4b37c commit 54209ce
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,23 +326,30 @@ class ParserPOMDPFormat_Spirit :
AddStartState (ParserPOMDPFormat_Spirit* po){_m_po = po;}
void operator()(iterator_t str, iterator_t end) const
{
if(_m_po->_m_lp_type != STRING)
{
std::stringstream ss; ss << "SetStartState::operator()(iterator_t str, iterator_t end) - expected a string as last parsed type! (at"<<str.get_position() <<")"<<std::endl;
throw E(ss);
}
try
// code here changed by Filip Macak to allow for start include/exclude to work with state indeces
if(_m_po->_m_lp_type == UINT)
{
Index sI = _m_po->GetPOMDPDiscrete()->GetStateIndexByName(
_m_po->_m_lp_string);
_m_po->_m_startStateListSI.push_back(sI);
_m_po->_m_startStateListSI.push_back(_m_po->_m_lp_uint);
}
catch(E e)
else if(_m_po->_m_lp_type != STRING)
{
std::stringstream ss; ss << e.SoftPrint() << "(at"<<
str.get_position() <<")"<<std::endl;
std::stringstream ss; ss << "SetStartState::operator()(iterator_t str, iterator_t end) - expected a string or uint as last parsed type! (at"<<str.get_position() <<")"<<std::endl;
throw E(ss);
}
else {
try
{
Index sI = _m_po->GetPOMDPDiscrete()->GetStateIndexByName(
_m_po->_m_lp_string);
_m_po->_m_startStateListSI.push_back(sI);
}
catch(E e)
{
std::stringstream ss; ss << e.SoftPrint() << "(at"<<
str.get_position() <<")"<<std::endl;
throw E(ss);
}
}
};
void operator()(const unsigned int& i) const
{
Expand Down

0 comments on commit 54209ce

Please sign in to comment.