Switching SAS translator output format to multi-valued variable representation.

This commit is contained in:
Patrick Lühne 2016-05-23 15:36:23 +02:00
parent 6e37721243
commit 02a5b11884

View File

@ -70,11 +70,13 @@ void TranslatorASP::translate(std::ostream &ostream) const
std::for_each(initialStateFacts.cbegin(), initialStateFacts.cend(), std::for_each(initialStateFacts.cbegin(), initialStateFacts.cend(),
[&](const auto &fact) [&](const auto &fact)
{ {
if (fact.value() == Value::None || fact.value().sign() == Value::Sign::Negative) if (fact.value() == Value::None)
return; return;
ostream << "initialState("; ostream << "initialState(";
fact.value().printAsASP(ostream); fact.variable().printNameAsASP(ostream);
ostream << ", ";
fact.value().printAsASPPredicateBody(ostream);
ostream << ")." << std::endl; ostream << ")." << std::endl;
}); });
@ -90,6 +92,8 @@ void TranslatorASP::translate(std::ostream &ostream) const
return; return;
ostream << "goal("; ostream << "goal(";
fact.variable().printNameAsASP(ostream);
ostream << ", ";
fact.value().printAsASPPredicateBody(ostream); fact.value().printAsASPPredicateBody(ostream);
ostream << ")." << std::endl; ostream << ")." << std::endl;
}); });
@ -147,6 +151,8 @@ void TranslatorASP::translate(std::ostream &ostream) const
ostream << "precondition("; ostream << "precondition(";
operator_.predicate().printAsASP(ostream); operator_.predicate().printAsASP(ostream);
ostream << ", "; ostream << ", ";
precondition.variable().printNameAsASP(ostream);
ostream << ", ";
precondition.value().printAsASPPredicateBody(ostream); precondition.value().printAsASPPredicateBody(ostream);
ostream << ")." << std::endl; ostream << ")." << std::endl;
}); });
@ -162,6 +168,8 @@ void TranslatorASP::translate(std::ostream &ostream) const
ostream << "postcondition("; ostream << "postcondition(";
operator_.predicate().printAsASP(ostream); operator_.predicate().printAsASP(ostream);
ostream << ", "; ostream << ", ";
effect.postcondition().variable().printNameAsASP(ostream);
ostream << ", ";
effect.postcondition().value().printAsASPPredicateBody(ostream); effect.postcondition().value().printAsASPPredicateBody(ostream);
ostream << ")." << std::endl; ostream << ")." << std::endl;
}); });
@ -184,6 +192,8 @@ void TranslatorASP::translate(std::ostream &ostream) const
[&](const auto &fact) [&](const auto &fact)
{ {
ostream << "mutexGroupFact(mutexGroup" << i << ", "; ostream << "mutexGroupFact(mutexGroup" << i << ", ";
fact.variable().printNameAsASP(ostream);
ostream << ", ";
fact.value().printAsASPPredicateBody(ostream); fact.value().printAsASPPredicateBody(ostream);
ostream << ")." << std::endl; ostream << ")." << std::endl;
}); });