Removed Reference expressions.

This commit is contained in:
Patrick Lühne 2016-06-13 01:38:56 +02:00
parent 1c8af793c2
commit 680206b40b
13 changed files with 134 additions and 150 deletions

View File

@ -59,11 +59,6 @@ class PrimitiveType;
using PrimitiveTypePointer = std::unique_ptr<PrimitiveType>;
using PrimitiveTypes = std::vector<PrimitiveTypePointer>;
template<class Type>
class Reference;
template<class Type>
using ReferencePointer = std::unique_ptr<Reference<Type>>;
class Variable;
using VariablePointer = std::unique_ptr<Variable>;
using Variables = std::vector<VariablePointer>;
@ -86,7 +81,6 @@ class Expression
PredicateDeclaration,
Predicate,
PrimitiveType,
Reference,
Variable
};

View File

@ -29,12 +29,16 @@ class Binary: public ExpressionCRTP<Derived>
ExpressionContext &expressionContext, ExpressionParser parseExpression);
public:
const Expression *leftArgument() const;
const Expression *rightArgument() const;
const std::array<const Expression *, 2> &arguments() const;
private:
ExpressionPointer m_leftArgument;
ExpressionPointer m_rightArgument;
template<size_t i>
void setArgument(const Expression *argument);
template<size_t i>
void setArgument(ExpressionPointer &&argument);
std::array<const Expression *, 2> m_arguments;
std::array<ExpressionPointer, 2> m_argumentStorage;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -59,8 +63,8 @@ std::unique_ptr<Derived> Binary<Derived>::parse(Context &context,
// Assume that expression identifier (imply, exists, etc.) is already parsed
// Parse arguments of the expression
expression->m_leftArgument = parseExpression(context, expressionContext);
expression->m_rightArgument = parseExpression(context, expressionContext);
expression->setArgument<0>(parseExpression(context, expressionContext));
expression->setArgument<1>(parseExpression(context, expressionContext));
parser.expect<std::string>(")");
@ -70,17 +74,33 @@ std::unique_ptr<Derived> Binary<Derived>::parse(Context &context,
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Derived>
const Expression *Binary<Derived>::leftArgument() const
template<size_t i>
void Binary<Derived>::setArgument(const Expression *expression)
{
return m_leftArgument.get();
static_assert(i <= 2, "Index out of range");
m_argumentStorage[i] = nullptr;
m_arguments[i] = expression;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Derived>
const Expression *Binary<Derived>::rightArgument() const
template<size_t i>
void Binary<Derived>::setArgument(ExpressionPointer &&expression)
{
return m_rightArgument.get();
static_assert(i <= 2, "Index out of range");
m_argumentStorage[i] = std::move(expression);
m_arguments[i] = m_argumentStorage[i].get();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Derived>
const std::array<const Expression *, 2> &Binary<Derived>::arguments() const
{
return m_arguments;
}
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -29,10 +29,14 @@ class NAry: public ExpressionCRTP<Derived>
ExpressionContext &expressionContext, ExpressionParser parseExpression);
public:
const Expressions &arguments() const;
const std::vector<const Expression *> &arguments() const;
private:
Expressions m_arguments;
void addArgument(const Expression *argument);
void addArgument(ExpressionPointer &&argument);
std::vector<const Expression *> m_arguments;
Expressions m_argumentStorage;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -61,7 +65,7 @@ std::unique_ptr<Derived> NAry<Derived>::parse(Context &context,
// Parse arguments of the expression
while (parser.currentCharacter() != ')')
{
expression->m_arguments.emplace_back(parseExpression(context, expressionContext));
expression->addArgument(parseExpression(context, expressionContext));
parser.skipWhiteSpace();
}
@ -77,7 +81,24 @@ std::unique_ptr<Derived> NAry<Derived>::parse(Context &context,
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Derived>
const Expressions &NAry<Derived>::arguments() const
void NAry<Derived>::addArgument(const Expression *argument)
{
m_arguments.emplace_back(argument);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Derived>
void NAry<Derived>::addArgument(ExpressionPointer &&argument)
{
m_argumentStorage.emplace_back(std::move(argument));
m_arguments.emplace_back(m_argumentStorage.back().get());
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Derived>
const std::vector<const Expression *> &NAry<Derived>::arguments() const
{
return m_arguments;
}

View File

@ -28,10 +28,16 @@ class Not: public ExpressionCRTP<Not>
ExpressionParser parseExpression);
public:
const Expression &argument() const;
Not();
const Expression *argument() const;
private:
ExpressionPointer m_argument;
void setArgument(const Expression *argument);
void setArgument(ExpressionPointer &&argument);
const Expression *m_argument;
ExpressionPointer m_argumentStorage;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -56,7 +62,7 @@ NotPointer Not::parse(Context &context, ExpressionContext &expressionContext,
context.parser.skipWhiteSpace();
// Parse argument
expression->m_argument = parseExpression(context, expressionContext);
expression->setArgument(parseExpression(context, expressionContext));
parser.expect<std::string>(")");

View File

@ -26,7 +26,7 @@ class Predicate: public ExpressionCRTP<Predicate>
public:
const std::string &name() const;
const Expressions &arguments() const;
const std::vector<const Expression *> &arguments() const;
bool isDeclared() const;
@ -38,7 +38,7 @@ class Predicate: public ExpressionCRTP<Predicate>
bool m_isDeclared;
std::string m_name;
Expressions m_arguments;
std::vector<const Expression *> m_arguments;
};
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1,70 +0,0 @@
#ifndef __PLASP__PDDL__EXPRESSIONS__REFERENCE_H
#define __PLASP__PDDL__EXPRESSIONS__REFERENCE_H
#include <boost/assert.hpp>
#include <plasp/pddl/Expression.h>
#include <plasp/utils/Parser.h>
namespace plasp
{
namespace pddl
{
namespace expressions
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Reference
//
////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: refactor without reference wrapper
template<class Type>
class Reference: public ExpressionCRTP<Reference<Type>>
{
public:
static const Expression::Type ExpressionType = Expression::Type::Reference;
Reference(const Type *value);
const Type *value() const;
private:
Reference();
const Type *m_value;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Type>
Reference<Type>::Reference()
: m_value{nullptr}
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Type>
Reference<Type>::Reference(const Type *value)
: m_value{value}
{
BOOST_ASSERT(m_value != nullptr);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Type>
const Type *Reference<Type>::value() const
{
return m_value;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}
#endif

View File

@ -16,7 +16,7 @@ namespace expressions
//
////////////////////////////////////////////////////////////////////////////////////////////////////
ExpressionPointer parseExistingPrimitiveType(Context &context,
const Expression *parseExistingPrimitiveType(Context &context,
ExpressionContext &expressionContext);
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -11,7 +11,6 @@
#include <plasp/pddl/expressions/Or.h>
#include <plasp/pddl/expressions/Predicate.h>
#include <plasp/pddl/expressions/PredicateDeclaration.h>
#include <plasp/pddl/expressions/Reference.h>
#include <plasp/utils/IO.h>
#include <plasp/utils/ParserException.h>

View File

@ -13,9 +13,32 @@ namespace expressions
//
////////////////////////////////////////////////////////////////////////////////////////////////////
const Expression &Not::argument() const
Not::Not()
: m_argument{nullptr}
{
return *m_argument;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Not::setArgument(const Expression *argument)
{
m_argumentStorage = nullptr;
m_argument = argument;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Not::setArgument(ExpressionPointer &&argument)
{
m_argumentStorage = std::move(argument);
m_argument = m_argumentStorage.get();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
const Expression *Not::argument() const
{
return m_argument;
}
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -6,7 +6,6 @@
#include <plasp/pddl/Identifier.h>
#include <plasp/pddl/Problem.h>
#include <plasp/pddl/expressions/Constant.h>
#include <plasp/pddl/expressions/Reference.h>
#include <plasp/pddl/expressions/Variable.h>
namespace plasp
@ -69,8 +68,7 @@ PredicatePointer Predicate::parse(Context &context, ExpressionContext &expressio
if (context.parser.currentCharacter() == '?')
{
const auto *variable = Variable::parseAndFind(context, expressionContext);
auto variableReference = std::make_unique<Reference<Variable>>(variable);
predicate->m_arguments.emplace_back(std::move(variableReference));
predicate->m_arguments.emplace_back(variable);
}
// Parse constants
else
@ -78,8 +76,7 @@ PredicatePointer Predicate::parse(Context &context, ExpressionContext &expressio
const auto *constant = (expressionContext.problem == nullptr)
? Constant::parseAndFind(context, expressionContext.domain)
: Constant::parseAndFind(context, *expressionContext.problem);
auto constantReference = std::make_unique<Reference<Constant>>(constant);
predicate->m_arguments.emplace_back(std::move(constantReference));
predicate->m_arguments.emplace_back(constant);
}
context.parser.skipWhiteSpace();
@ -134,8 +131,7 @@ PredicatePointer Predicate::parse(Context &context, const Problem &problem)
// Parse objects and constants
const auto *constant = Constant::parseAndFind(context, problem);
auto constantReference = std::make_unique<Reference<Constant>>(constant);
predicate->m_arguments.emplace_back(std::move(constantReference));
predicate->m_arguments.emplace_back(constant);
}
// TODO: check that signature matches one of the declared ones
@ -168,7 +164,7 @@ const std::string &Predicate::name() const
////////////////////////////////////////////////////////////////////////////////////////////////////
const Expressions &Predicate::arguments() const
const std::vector<const Expression *> &Predicate::arguments() const
{
return m_arguments;
}

View File

@ -5,7 +5,6 @@
#include <plasp/pddl/ExpressionContext.h>
#include <plasp/pddl/Identifier.h>
#include <plasp/pddl/expressions/Constant.h>
#include <plasp/pddl/expressions/Reference.h>
#include <plasp/pddl/expressions/Variable.h>
namespace plasp

View File

@ -3,7 +3,6 @@
#include <plasp/pddl/Context.h>
#include <plasp/pddl/ExpressionContext.h>
#include <plasp/pddl/expressions/PrimitiveType.h>
#include <plasp/pddl/expressions/Reference.h>
namespace plasp
{
@ -18,11 +17,9 @@ namespace expressions
//
////////////////////////////////////////////////////////////////////////////////////////////////////
ExpressionPointer parseExistingPrimitiveType(Context &context, ExpressionContext &expressionContext)
const Expression *parseExistingPrimitiveType(Context &context, ExpressionContext &expressionContext)
{
auto *primitiveType = PrimitiveType::parseAndFind(context, expressionContext.domain);
return std::make_unique<Reference<PrimitiveType>>(primitiveType);
return PrimitiveType::parseAndFind(context, expressionContext.domain);
}
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -11,7 +11,6 @@
#include <plasp/pddl/expressions/Not.h>
#include <plasp/pddl/expressions/Predicate.h>
#include <plasp/pddl/expressions/PrimitiveType.h>
#include <plasp/pddl/expressions/Reference.h>
using namespace plasp::pddl;
@ -49,11 +48,11 @@ TEST(PDDLParserTests, ParseBlocksWorldDomain)
ASSERT_EQ(on.name(), "on");
ASSERT_EQ(on.arguments().size(), 2u);
ASSERT_EQ(on.arguments()[0]->name(), "x");
const auto *onArgument0Type = dynamic_cast<const expressions::PrimitiveType *>(on.arguments()[0]->type());
ASSERT_EQ(onArgument0Type, &block);
const auto &onArgument0Type = dynamic_cast<const expressions::PrimitiveType &>(*on.arguments()[0]->type());
ASSERT_EQ(&onArgument0Type, &block);
ASSERT_EQ(on.arguments()[1]->name(), "y");
const auto onArgument1Type = dynamic_cast<const expressions::PrimitiveType *>(on.arguments()[1]->type());
ASSERT_EQ(onArgument1Type, &block);
const auto &onArgument1Type = dynamic_cast<const expressions::PrimitiveType &>(*on.arguments()[1]->type());
ASSERT_EQ(&onArgument1Type, &block);
const auto &handempty = *domain.predicates()[3];
@ -75,7 +74,7 @@ TEST(PDDLParserTests, ParseBlocksWorldDomain)
const auto &pickUpPre0 = dynamic_cast<const expressions::Predicate &>(*pickUpPre.arguments()[0]);
ASSERT_EQ(pickUpPre0.name(), "clear");
ASSERT_EQ(pickUpPre0.arguments().size(), 1u);
const auto &pickUpPre00 = *dynamic_cast<const expressions::Reference<expressions::Variable> &>(*pickUpPre0.arguments()[0]).value();
const auto &pickUpPre00 = dynamic_cast<const expressions::Variable &>(*pickUpPre0.arguments()[0]);
ASSERT_EQ(pickUpPre00.name(), "x");
ASSERT_EQ(pickUpPre00.type(), &block);
ASSERT_EQ(&pickUpPre00, pickUp.parameters()[0].get());
@ -86,10 +85,10 @@ TEST(PDDLParserTests, ParseBlocksWorldDomain)
const auto &pickUpEff = dynamic_cast<const expressions::And &>(*pickUp.effect());
ASSERT_EQ(pickUpEff.arguments().size(), 4u);
const auto &pickUpEff0 = dynamic_cast<const expressions::Not &>(*pickUpEff.arguments()[0]);
const auto &pickUpEff00 = dynamic_cast<const expressions::Predicate &>(pickUpEff0.argument());
const auto &pickUpEff00 = dynamic_cast<const expressions::Predicate &>(*pickUpEff0.argument());
ASSERT_EQ(pickUpEff00.name(), "ontable");
ASSERT_EQ(pickUpEff00.arguments().size(), 1u);
const auto &pickUpEff000 = *dynamic_cast<const expressions::Reference<expressions::Variable> &>(*pickUpEff00.arguments()[0]).value();
const auto &pickUpEff000 = dynamic_cast<const expressions::Variable &>(*pickUpEff00.arguments()[0]);
ASSERT_EQ(pickUpEff000.name(), "x");
ASSERT_EQ(pickUpEff000.type(), &block);
}
@ -125,14 +124,14 @@ TEST(PDDLParserTests, ParseBlocksWorldProblem)
const auto &facts = problem.initialState().facts();
ASSERT_EQ(facts.size(), 9u);
const auto &fact0 = *dynamic_cast<const expressions::Predicate *>(facts[0].get());
const auto &fact0 = dynamic_cast<const expressions::Predicate &>(*facts[0].get());
ASSERT_EQ(fact0.name(), "clear");
ASSERT_EQ(fact0.arguments().size(), 1u);
const auto &fact00 = *dynamic_cast<const expressions::Reference<expressions::Constant> *>(fact0.arguments()[0].get())->value();
const auto &fact00 = dynamic_cast<const expressions::Constant &>(*fact0.arguments()[0]);
ASSERT_EQ(fact00.name(), "c");
ASSERT_NE(fact00.type(), nullptr);
ASSERT_EQ(fact00.type()->name(), "block");
const auto &fact8 = *dynamic_cast<const expressions::Predicate *>(facts[8].get());
const auto &fact8 = dynamic_cast<const expressions::Predicate &>(*facts[8].get());
ASSERT_EQ(fact8.name(), "handempty");
ASSERT_EQ(fact8.arguments().size(), 0u);
@ -140,19 +139,19 @@ TEST(PDDLParserTests, ParseBlocksWorldProblem)
const auto &goal = dynamic_cast<const expressions::And &>(problem.goal());
ASSERT_EQ(goal.arguments().size(), 3u);
const auto &goal0 = *dynamic_cast<expressions::Predicate *>(goal.arguments()[0].get());
const auto &goal0 = dynamic_cast<const expressions::Predicate &>(*goal.arguments()[0]);
ASSERT_EQ(goal0.name(), "on");
ASSERT_EQ(goal0.arguments().size(), 2u);
const auto &goal00 = *dynamic_cast<expressions::Reference<expressions::Constant> *>(goal0.arguments()[0].get())->value();
const auto &goal00 = dynamic_cast<const expressions::Constant &>(*goal0.arguments()[0]);
ASSERT_EQ(goal00.name(), "d");
const auto &goal01 = *dynamic_cast<expressions::Reference<expressions::Constant> *>(goal0.arguments()[1].get())->value();
const auto &goal01 = dynamic_cast<const expressions::Constant &>(*goal0.arguments()[1]);
ASSERT_EQ(goal01.name(), "c");
const auto &goal2 = *dynamic_cast<expressions::Predicate *>(goal.arguments()[2].get());
const auto &goal2 = dynamic_cast<const expressions::Predicate &>(*goal.arguments()[2]);
ASSERT_EQ(goal2.name(), "on");
ASSERT_EQ(goal2.arguments().size(), 2u);
const auto &goal20 = *dynamic_cast<expressions::Reference<expressions::Constant> *>(goal2.arguments()[0].get())->value();
const auto &goal20 = dynamic_cast<const expressions::Constant &>(*goal2.arguments()[0]);
ASSERT_EQ(goal20.name(), "b");
const auto &goal21 = *dynamic_cast<expressions::Reference<expressions::Constant> *>(goal2.arguments()[1].get())->value();
const auto &goal21 = dynamic_cast<const expressions::Constant &>(*goal2.arguments()[1]);
ASSERT_EQ(goal21.name(), "a");
}
@ -200,22 +199,22 @@ TEST(PDDLParserTests, ParseStorageDomain)
ASSERT_EQ(on.name(), "on");
ASSERT_EQ(on.arguments().size(), 2u);
ASSERT_EQ(on.arguments()[0]->name(), "c");
const auto onArgument0Type = dynamic_cast<const expressions::PrimitiveType *>(on.arguments()[0]->type());
ASSERT_EQ(onArgument0Type, &crate);
const auto &onArgument0Type = dynamic_cast<const expressions::PrimitiveType &>(*on.arguments()[0]->type());
ASSERT_EQ(&onArgument0Type, &crate);
ASSERT_EQ(on.arguments()[1]->name(), "s");
const auto onArgument1Type = dynamic_cast<const expressions::PrimitiveType *>(on.arguments()[1]->type());
ASSERT_EQ(onArgument1Type, &storearea);
const auto &onArgument1Type = dynamic_cast<const expressions::PrimitiveType &>(*on.arguments()[1]->type());
ASSERT_EQ(&onArgument1Type, &storearea);
const auto &in = *domain.predicates()[1];
ASSERT_EQ(in.name(), "in");
ASSERT_EQ(in.arguments().size(), 2u);
ASSERT_EQ(in.arguments()[0]->name(), "x");
const auto inArgument0Type = dynamic_cast<const expressions::Either *>(in.arguments()[0]->type());
ASSERT_EQ(inArgument0Type->arguments().size(), 2u);
const auto inArgument0Type0 = dynamic_cast<const expressions::Reference<expressions::PrimitiveType> *>(inArgument0Type->arguments()[0].get())->value();
ASSERT_EQ(inArgument0Type0, &storearea);
const auto inArgument0Type1 = dynamic_cast<const expressions::Reference<expressions::PrimitiveType> *>(inArgument0Type->arguments()[1].get())->value();
ASSERT_EQ(inArgument0Type1, &crate);
const auto &inArgument0Type = dynamic_cast<const expressions::Either &>(*in.arguments()[0]->type());
ASSERT_EQ(inArgument0Type.arguments().size(), 2u);
const auto &inArgument0Type0 = dynamic_cast<const expressions::PrimitiveType &>(*inArgument0Type.arguments()[0]);
ASSERT_EQ(&inArgument0Type0, &storearea);
const auto &inArgument0Type1 = dynamic_cast<const expressions::PrimitiveType &>(*inArgument0Type.arguments()[1]);
ASSERT_EQ(&inArgument0Type1, &crate);
// Actions
ASSERT_EQ(domain.actions().size(), 5u);
@ -232,17 +231,17 @@ TEST(PDDLParserTests, ParseStorageDomain)
const auto &dropPre2 = dynamic_cast<const expressions::Predicate &>(*dropPre.arguments()[2]);
ASSERT_EQ(dropPre2.name(), "lifting");
ASSERT_EQ(dropPre2.arguments().size(), 2u);
const auto &dropPre21 = *dynamic_cast<const expressions::Reference<expressions::Variable> &>(*dropPre2.arguments()[1]).value();
const auto &dropPre21 = dynamic_cast<const expressions::Variable &>(*dropPre2.arguments()[1]);
ASSERT_EQ(dropPre21.name(), "c");
ASSERT_EQ(dropPre21.type(), &crate);
const auto &dropEff = dynamic_cast<const expressions::And &>(*drop.effect());
ASSERT_EQ(dropEff.arguments().size(), 5u);
const auto &dropEff2 = dynamic_cast<const expressions::Not &>(*dropEff.arguments()[2]);
const auto &dropEff20 = dynamic_cast<const expressions::Predicate &>(dropEff2.argument());
const auto &dropEff20 = dynamic_cast<const expressions::Predicate &>(*dropEff2.argument());
ASSERT_EQ(dropEff20.name(), "clear");
ASSERT_EQ(dropEff20.arguments().size(), 1u);
const auto &dropEff200 = *dynamic_cast<const expressions::Reference<expressions::Variable> &>(*dropEff20.arguments()[0]).value();
const auto &dropEff200 = dynamic_cast<const expressions::Variable &>(*dropEff20.arguments()[0]);
ASSERT_EQ(dropEff200.name(), "a1");
ASSERT_EQ(dropEff200.type(), &storearea);
}
@ -278,17 +277,17 @@ TEST(PDDLParserTests, ParseStorageProblem)
const auto &facts = problem.initialState().facts();
ASSERT_EQ(facts.size(), 10u);
const auto &fact0 = *dynamic_cast<const expressions::Predicate *>(facts[0].get());
const auto &fact0 = dynamic_cast<const expressions::Predicate &>(*facts[0].get());
ASSERT_EQ(fact0.name(), "in");
ASSERT_EQ(fact0.arguments().size(), 2u);
const auto &fact01 = *dynamic_cast<const expressions::Reference<expressions::Constant> *>(fact0.arguments()[1].get())->value();
const auto &fact01 = dynamic_cast<const expressions::Constant &>(*fact0.arguments()[1]);
ASSERT_EQ(fact01.name(), "depot0");
ASSERT_NE(fact01.type(), nullptr);
ASSERT_EQ(fact01.type()->name(), "depot");
const auto &fact9 = *dynamic_cast<const expressions::Predicate *>(facts[9].get());
const auto &fact9 = dynamic_cast<const expressions::Predicate &>(*facts[9].get());
ASSERT_EQ(fact9.name(), "available");
ASSERT_EQ(fact9.arguments().size(), 1u);
const auto &fact90 = *dynamic_cast<const expressions::Reference<expressions::Constant> *>(fact9.arguments()[0].get())->value();
const auto &fact90 = dynamic_cast<const expressions::Constant &>(*fact9.arguments()[0]);
ASSERT_EQ(fact90.name(), "hoist0");
ASSERT_NE(fact90.type(), nullptr);
ASSERT_EQ(fact90.type()->name(), "hoist");
@ -297,12 +296,12 @@ TEST(PDDLParserTests, ParseStorageProblem)
const auto &goal = dynamic_cast<const expressions::And &>(problem.goal());
ASSERT_EQ(goal.arguments().size(), 1u);
const auto &goal0 = *dynamic_cast<expressions::Predicate *>(goal.arguments()[0].get());
const auto &goal0 = dynamic_cast<const expressions::Predicate &>(*goal.arguments()[0]);
ASSERT_EQ(goal0.name(), "in");
ASSERT_EQ(goal0.arguments().size(), 2u);
const auto &goal00 = *dynamic_cast<expressions::Reference<expressions::Constant> *>(goal0.arguments()[0].get())->value();
const auto &goal00 = dynamic_cast<const expressions::Constant &>(*goal0.arguments()[0]);
ASSERT_EQ(goal00.name(), "crate0");
const auto &goal01 = *dynamic_cast<expressions::Reference<expressions::Constant> *>(goal0.arguments()[1].get())->value();
const auto &goal01 = dynamic_cast<const expressions::Constant &>(*goal0.arguments()[1]);
ASSERT_EQ(goal01.name(), "depot0");
}