Added translation of effects of PDDL actions.
This commit is contained in:
parent
e2b8fd2880
commit
e018cdbc91
@ -333,6 +333,29 @@ void TranslatorASP::translateActions() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Effect
|
||||||
|
if (action->effect())
|
||||||
|
{
|
||||||
|
const auto &effect = *action->effect();
|
||||||
|
|
||||||
|
if (effect.expressionType() == Expression::Type::Predicate
|
||||||
|
|| effect.expressionType() == Expression::Type::Not)
|
||||||
|
{
|
||||||
|
translateLiteral("postcondition", effect);
|
||||||
|
}
|
||||||
|
// Assuming a conjunction
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto &andExpression = dynamic_cast<const expressions::And &>(effect);
|
||||||
|
|
||||||
|
std::for_each(andExpression.arguments().cbegin(), andExpression.arguments().cend(),
|
||||||
|
[&](const auto *argument)
|
||||||
|
{
|
||||||
|
translateLiteral("postcondition", *argument);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_ostream << std::endl;
|
m_ostream << std::endl;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user