Making sure that PDDL predicates contain only primitive types for the time being.
This commit is contained in:
parent
89bb54a3ec
commit
639b7646c9
@ -23,9 +23,10 @@ class TranslatorASP
|
||||
|
||||
void translate(std::ostream &ostream) const;
|
||||
|
||||
private:
|
||||
void checkSupport() const;
|
||||
|
||||
void translateDomain(std::ostream &ostream) const;
|
||||
|
||||
|
||||
void translateProblem(std::ostream &ostream) const;
|
||||
|
||||
const Description &m_description;
|
||||
|
@ -20,8 +20,31 @@ TranslatorASP::TranslatorASP(const Description &description)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TranslatorASP::checkSupport() const
|
||||
{
|
||||
// Check for "either" types
|
||||
const auto &predicates = m_description.domain().predicates();
|
||||
|
||||
std::for_each(predicates.cbegin(), predicates.cend(),
|
||||
[&](const auto &predicate)
|
||||
{
|
||||
const auto &arguments = predicate->arguments();
|
||||
|
||||
std::for_each(arguments.cbegin(), arguments.cend(),
|
||||
[&](const auto ¶meter)
|
||||
{
|
||||
if (parameter->type()->expressionType() != Expression::Type::PrimitiveType)
|
||||
throw utils::TranslatorException("Only primitive types supported currently");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TranslatorASP::translate(std::ostream &ostream) const
|
||||
{
|
||||
checkSupport();
|
||||
|
||||
translateDomain(ostream);
|
||||
|
||||
if (m_description.containsProblem())
|
||||
|
Reference in New Issue
Block a user