Started implementing PDDL normalization.
This commit is contained in:
@@ -82,6 +82,14 @@ class ParserException : public Exception
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class NormalizationException : public Exception
|
||||
{
|
||||
public:
|
||||
using Exception::Exception;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
24
lib/pddlparse/include/pddlparse/Normalize.h
Normal file
24
lib/pddlparse/include/pddlparse/Normalize.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef __PDDL_PARSE__NORMALIZE_H
|
||||
#define __PDDL_PARSE__NORMALIZE_H
|
||||
|
||||
#include <pddlparse/AST.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedAST.h>
|
||||
#include <pddlparse/detail/normalization/Description.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Normalize
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using detail::normalize;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@@ -133,6 +133,7 @@ struct Problem
|
||||
|
||||
Domain *domain;
|
||||
std::string name;
|
||||
DerivedPredicateDeclarations derivedPredicates;
|
||||
ConstantDeclarations objects;
|
||||
InitialState initialState;
|
||||
std::experimental::optional<Goal> goal;
|
||||
|
@@ -66,6 +66,9 @@ using ast::AtPointer;
|
||||
using ast::Either;
|
||||
using ast::EitherPointer;
|
||||
using ast::Exists;
|
||||
using ast::ExistsPointer;
|
||||
using ast::ForAll;
|
||||
using ast::ForAllPointer;
|
||||
using ast::Not;
|
||||
using ast::NotPointer;
|
||||
using ast::When;
|
||||
@@ -170,7 +173,7 @@ namespace detail
|
||||
using EffectT = Variant<
|
||||
AtomicFormula,
|
||||
AndPointer<Effect>,
|
||||
ast::ForAllPointer<Effect>,
|
||||
ForAllPointer<Effect>,
|
||||
NotPointer<Effect>,
|
||||
WhenPointer<Precondition, ConditionalEffect>>;
|
||||
}
|
||||
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__ACTION_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__ACTION_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Action
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::ActionPointer normalize(ast::ActionPointer &&domain, normalizedAST::DerivedPredicateDeclarations &derivedPredicates);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__ATOMIC_FORMULA_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__ATOMIC_FORMULA_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AtomicFormula
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::AtomicFormula normalize(ast::AtomicFormula &&atomicFormula);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__DESCRIPTION_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__DESCRIPTION_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Description
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::Description normalize(ast::Description &&description);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__DOMAIN_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__DOMAIN_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Domain
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::DomainPointer normalize(ast::DomainPointer &&domain);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__EFFECT_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__EFFECT_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Effect
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::Effect normalize(ast::Effect &&effect);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
26
lib/pddlparse/include/pddlparse/detail/normalization/Fact.h
Normal file
26
lib/pddlparse/include/pddlparse/detail/normalization/Fact.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__FACT_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__FACT_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Fact
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::Fact normalize(ast::Fact &&fact);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__INITIAL_STATE_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__INITIAL_STATE_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InitialState
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::InitialState normalize(ast::InitialState &&initialState);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__LITERAL_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__LITERAL_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Literal
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::Literal normalize(ast::Literal &&literal);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__PRECONDITION_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__PRECONDITION_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Precondition
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::Precondition normalize(ast::Precondition &&precondition, normalizedAST::DerivedPredicateDeclarations &derivedPredicates);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,26 @@
|
||||
#ifndef __PDDL_PARSE__DETAIL__NORMALIZATION__PROBLEM_H
|
||||
#define __PDDL_PARSE__DETAIL__NORMALIZATION__PROBLEM_H
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Context.h>
|
||||
#include <pddlparse/NormalizedASTForward.h>
|
||||
|
||||
namespace pddl
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Problem
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
normalizedAST::ProblemPointer normalize(ast::ProblemPointer &&problem, normalizedAST::Domain *domain);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user