From e018cdbc9183b68d5afc2e0af7d5639e52bc47a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Mon, 13 Jun 2016 02:41:23 +0200 Subject: [PATCH] Added translation of effects of PDDL actions. --- src/plasp/pddl/TranslatorASP.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/plasp/pddl/TranslatorASP.cpp b/src/plasp/pddl/TranslatorASP.cpp index af45d8d..3d609a0 100644 --- a/src/plasp/pddl/TranslatorASP.cpp +++ b/src/plasp/pddl/TranslatorASP.cpp @@ -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(effect); + + std::for_each(andExpression.arguments().cbegin(), andExpression.arguments().cend(), + [&](const auto *argument) + { + translateLiteral("postcondition", *argument); + }); + } + } + m_ostream << std::endl; }); }