Fixed incorrect output format of conditional effects with SAS.

This commit is contained in:
Patrick Lühne 2016-08-26 15:50:39 +02:00
parent dd33e47dd9
commit 568945c7a8
2 changed files with 22 additions and 16 deletions

View File

@ -1,5 +1,11 @@
# Change Log # Change Log
## (unreleased)
Bug Fixes:
* fixes incorrect output format of conditional effects with SAS
## 3.0.2 (2016-08-18) ## 3.0.2 (2016-08-18)
Features: Features:

View File

@ -171,34 +171,34 @@ void TranslatorASP::translateActions() const
{ {
const auto &conditions = effect.conditions(); 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") << "("; m_outputStream << utils::RuleName("postcondition") << "(";
operator_.printPredicateAsASP(m_outputStream); operator_.printPredicateAsASP(m_outputStream);
if (conditions.empty()) if (conditions.empty())
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Reserved("unconditional") << "), "; m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Reserved("unconditional") << "), ";
else else
{
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), "; m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), ";
currentEffectID++;
}
effect.postcondition().variable().printNameAsASPPredicate(m_outputStream); effect.postcondition().variable().printNameAsASPPredicate(m_outputStream);
m_outputStream << ", "; m_outputStream << ", ";
effect.postcondition().value().printAsASPPredicate(m_outputStream); effect.postcondition().value().printAsASPPredicate(m_outputStream);
m_outputStream << ")." << std::endl; 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") << "("; m_outputStream << utils::RuleName("costs") << "(";