diff --git a/CHANGELOG.md b/CHANGELOG.md index f2ba8e5..ff055f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## (unreleased) + +Bug Fixes: + +* fixes incorrect output format of conditional effects with SAS + ## 3.0.2 (2016-08-18) Features: diff --git a/src/plasp/sas/TranslatorASP.cpp b/src/plasp/sas/TranslatorASP.cpp index 09e96b5..94edfc3 100644 --- a/src/plasp/sas/TranslatorASP.cpp +++ b/src/plasp/sas/TranslatorASP.cpp @@ -171,34 +171,34 @@ void TranslatorASP::translateActions() const { const auto &conditions = effect.conditions(); - std::for_each(conditions.cbegin(), conditions.cend(), - [&](const auto &condition) - { - // Conditions of conditional effects - m_outputStream << utils::RuleName("precondition") << "("; - operator_.printPredicateAsASP(m_outputStream); - m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), "; - condition.variable().printNameAsASPPredicate(m_outputStream); - m_outputStream << ", "; - condition.value().printAsASPPredicate(m_outputStream); - m_outputStream << ")." << std::endl; - }); - m_outputStream << utils::RuleName("postcondition") << "("; operator_.printPredicateAsASP(m_outputStream); if (conditions.empty()) m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Reserved("unconditional") << "), "; else - { m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), "; - currentEffectID++; - } effect.postcondition().variable().printNameAsASPPredicate(m_outputStream); m_outputStream << ", "; effect.postcondition().value().printAsASPPredicate(m_outputStream); m_outputStream << ")." << std::endl; + + std::for_each(conditions.cbegin(), conditions.cend(), + [&](const auto &condition) + { + // Conditions of conditional effects + m_outputStream + << utils::RuleName("precondition") << "(" + << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), "; + condition.variable().printNameAsASPPredicate(m_outputStream); + m_outputStream << ", "; + condition.value().printAsASPPredicate(m_outputStream); + m_outputStream << ")." << std::endl; + }); + + if (!conditions.empty()) + currentEffectID++; }); m_outputStream << utils::RuleName("costs") << "(";