Added check that typing requirement is not added by PDDL problem.

This commit is contained in:
Patrick Lühne 2016-06-07 16:34:15 +02:00
parent 188165bc4d
commit 27e76fc035
3 changed files with 9 additions and 1 deletions

View File

@ -31,6 +31,7 @@ class Problem
const std::string &name() const; const std::string &name() const;
const Requirements &requirements() const; const Requirements &requirements() const;
bool hasRequirement(Requirement::Type requirementType) const;
expressions::Constants &objects(); expressions::Constants &objects();
const expressions::Constants &objects() const; const expressions::Constants &objects() const;
@ -41,7 +42,6 @@ class Problem
void parseSection(); void parseSection();
void parseRequirementSection(); void parseRequirementSection();
bool hasRequirement(Requirement::Type requirementType) const;
void computeDerivedRequirements(); void computeDerivedRequirements();
void parseDomainSection(); void parseDomainSection();

View File

@ -140,6 +140,12 @@ void Description::checkConsistency()
if (!m_domain->isDeclared()) if (!m_domain->isDeclared())
throw ConsistencyException("No PDDL domain specified"); throw ConsistencyException("No PDDL domain specified");
if (m_problem->hasRequirement(Requirement::Type::Typing)
&& !m_domain->hasRequirement(Requirement::Type::Typing))
{
throw ConsistencyException("PDDL problems may not add the \"typing\" requirement");
}
m_domain->checkConsistency(); m_domain->checkConsistency();
m_problem->checkConsistency(); m_problem->checkConsistency();
} }

View File

@ -344,6 +344,8 @@ void Domain::parseActionSection()
void Domain::checkConsistency() void Domain::checkConsistency()
{ {
// TODO: implement requirement declaration checking
// Verify that typing requirement is correctly declared if used // Verify that typing requirement is correctly declared if used
if (!m_primitiveTypes.empty() && !hasRequirement(Requirement::Type::Typing)) if (!m_primitiveTypes.empty() && !hasRequirement(Requirement::Type::Typing))
{ {