From 27e76fc03522d382c52da33984309eb0cfd586ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 7 Jun 2016 16:34:15 +0200 Subject: [PATCH] Added check that typing requirement is not added by PDDL problem. --- include/plasp/pddl/Problem.h | 2 +- src/plasp/pddl/Description.cpp | 6 ++++++ src/plasp/pddl/Domain.cpp | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/plasp/pddl/Problem.h b/include/plasp/pddl/Problem.h index 7a4c434..4ffb2ce 100644 --- a/include/plasp/pddl/Problem.h +++ b/include/plasp/pddl/Problem.h @@ -31,6 +31,7 @@ class Problem const std::string &name() const; const Requirements &requirements() const; + bool hasRequirement(Requirement::Type requirementType) const; expressions::Constants &objects(); const expressions::Constants &objects() const; @@ -41,7 +42,6 @@ class Problem void parseSection(); void parseRequirementSection(); - bool hasRequirement(Requirement::Type requirementType) const; void computeDerivedRequirements(); void parseDomainSection(); diff --git a/src/plasp/pddl/Description.cpp b/src/plasp/pddl/Description.cpp index e14ce9b..27d2557 100644 --- a/src/plasp/pddl/Description.cpp +++ b/src/plasp/pddl/Description.cpp @@ -140,6 +140,12 @@ void Description::checkConsistency() if (!m_domain->isDeclared()) 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_problem->checkConsistency(); } diff --git a/src/plasp/pddl/Domain.cpp b/src/plasp/pddl/Domain.cpp index c1cd60f..340c819 100644 --- a/src/plasp/pddl/Domain.cpp +++ b/src/plasp/pddl/Domain.cpp @@ -344,6 +344,8 @@ void Domain::parseActionSection() void Domain::checkConsistency() { + // TODO: implement requirement declaration checking + // Verify that typing requirement is correctly declared if used if (!m_primitiveTypes.empty() && !hasRequirement(Requirement::Type::Typing)) {