Further simplified the output of the PDDL variable value facts.

This commit is contained in:
Patrick Lühne 2016-08-18 00:00:50 +02:00
parent 363070b579
commit 5e28dd046b

View File

@ -130,10 +130,7 @@ void TranslatorASP::translateTypes() const
void TranslatorASP::translatePredicates() const
{
m_outputStream
<< utils::Heading2("variables") << std::endl
<< utils::RuleName("boolean") << "(" << utils::Boolean("true") << ")." << std::endl
<< utils::RuleName("boolean") << "(" << utils::Boolean("false") << ")." << std::endl;
m_outputStream << utils::Heading2("variables");
const auto &predicates = m_description.domain().predicates();
@ -166,30 +163,20 @@ void TranslatorASP::translatePredicates() const
this->translateVariablesBody(predicate->arguments());
m_outputStream << "." << std::endl;
m_outputStream
<< utils::RuleName("contains") << "("
<< utils::Keyword("variable") << "(";
printPredicateName(predicate);
m_outputStream << "), " << utils::Keyword("value") << "(";
printPredicateName(predicate);
m_outputStream << ", " << utils::Variable("B") << "))";
this->translateVariablesBody(predicate->arguments());
// TODO: clean up
if (predicate->arguments().empty())
m_outputStream << " :- ";
else
m_outputStream << ", ";
m_outputStream << utils::RuleName("boolean") << "(" << utils::Variable("B") << ")." << std::endl;
m_outputStream << ".";
});
m_outputStream
<< std::endl << std::endl
<< utils::RuleName("boolean") << "(" << utils::Boolean("true") << ")." << std::endl
<< utils::RuleName("boolean") << "(" << utils::Boolean("false") << ")." << std::endl
<< std::endl
<< utils::RuleName("contains") << "("
<< utils::Keyword("variable") << "(" << utils::Variable("X") << "), "
<< utils::Keyword("value") << "(" << utils::Variable("X") << ", " << utils::Variable("B") << ")) :- "
<< utils::RuleName("variable") << "(" << utils::Keyword("variable") << "(" << utils::Variable("X") << ")), "
<< utils::RuleName("boolean") << "(" << utils::Variable("B") << ")."
<< std::endl;
}
////////////////////////////////////////////////////////////////////////////////////////////////////