Added functions for checking PDDL requirements.
This commit is contained in:
@@ -206,6 +206,16 @@ bool Domain::hasRequirement(Requirement::Type requirementType) const
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Domain::checkRequirement(Requirement::Type requirementType) const
|
||||
{
|
||||
if (hasRequirement(requirementType))
|
||||
return;
|
||||
|
||||
throw ConsistencyException("Requirement \"" + Requirement(requirementType).toPDDL() + "\" used but never declared");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Domain::computeDerivedRequirements()
|
||||
{
|
||||
const auto addRequirementUnique =
|
||||
|
@@ -190,6 +190,18 @@ bool Problem::hasRequirement(Requirement::Type requirementType) const
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Problem::checkRequirement(Requirement::Type requirementType) const
|
||||
{
|
||||
m_domain.checkRequirement(requirementType);
|
||||
|
||||
if (hasRequirement(requirementType))
|
||||
return;
|
||||
|
||||
throw ConsistencyException("Requirement \"" + Requirement(requirementType).toPDDL() + "\" used but never declared");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Problem::computeDerivedRequirements()
|
||||
{
|
||||
const auto addRequirementUnique =
|
||||
|
@@ -101,24 +101,24 @@ Requirement::Type Requirement::type() const
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Requirement::printAsPDDL(std::ostream &ostream) const
|
||||
std::string Requirement::toPDDL() const
|
||||
{
|
||||
const auto match = requirementTypesToPDDL.left.find(m_type);
|
||||
|
||||
BOOST_ASSERT(match != requirementTypesToPDDL.left.end());
|
||||
|
||||
ostream << match->second;
|
||||
return match->second;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Requirement::printAsASP(std::ostream &ostream) const
|
||||
std::string Requirement::toASP() const
|
||||
{
|
||||
const auto match = requirementTypesToASP.left.find(m_type);
|
||||
|
||||
BOOST_ASSERT(match != requirementTypesToASP.left.end());
|
||||
|
||||
ostream << match->second;
|
||||
return match->second;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user