patrick
/
plasp
Archived
1
0
Fork 0

Added translation of effects of PDDL actions.

This commit is contained in:
Patrick Lühne 2016-06-13 02:41:23 +02:00
parent e2b8fd2880
commit e018cdbc91
1 changed files with 23 additions and 0 deletions

View File

@ -333,6 +333,29 @@ void TranslatorASP::translateActions() const
}
}
// Effect
if (action->effect())
{
const auto &effect = *action->effect();
if (effect.expressionType() == Expression::Type::Predicate
|| effect.expressionType() == Expression::Type::Not)
{
translateLiteral("postcondition", effect);
}
// Assuming a conjunction
else
{
const auto &andExpression = dynamic_cast<const expressions::And &>(effect);
std::for_each(andExpression.arguments().cbegin(), andExpression.arguments().cend(),
[&](const auto *argument)
{
translateLiteral("postcondition", *argument);
});
}
}
m_ostream << std::endl;
});
}