Renaming to not confuse expression simplification and reduction.
This commit is contained in:
parent
dd621fcd5c
commit
79d449d0df
@ -110,7 +110,7 @@ class Expression
|
||||
virtual Type expressionType() const = 0;
|
||||
|
||||
ExpressionPointer normalized();
|
||||
virtual ExpressionPointer simplified();
|
||||
virtual ExpressionPointer reduced();
|
||||
virtual ExpressionPointer negationNormalized();
|
||||
ExpressionPointer negated();
|
||||
|
||||
|
@ -37,7 +37,7 @@ class At: public ExpressionCRTP<At>
|
||||
void setArgument(ExpressionPointer argument);
|
||||
ExpressionPointer argument() const;
|
||||
|
||||
ExpressionPointer simplified() override;
|
||||
ExpressionPointer reduced() override;
|
||||
ExpressionPointer negationNormalized() override;
|
||||
|
||||
void print(std::ostream &ostream) const override;
|
||||
|
@ -31,7 +31,7 @@ class Binary: public ExpressionCRTP<Derived>
|
||||
void setArgument(size_t i, ExpressionPointer argument);
|
||||
const std::array<ExpressionPointer, 2> &arguments() const;
|
||||
|
||||
ExpressionPointer simplified() override;
|
||||
ExpressionPointer reduced() override;
|
||||
ExpressionPointer negationNormalized() override;
|
||||
|
||||
void print(std::ostream &ostream) const override;
|
||||
@ -91,13 +91,13 @@ const std::array<ExpressionPointer, 2> &Binary<Derived>::arguments() const
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class Derived>
|
||||
inline ExpressionPointer Binary<Derived>::simplified()
|
||||
inline ExpressionPointer Binary<Derived>::reduced()
|
||||
{
|
||||
for (size_t i = 0; i < m_arguments.size(); i++)
|
||||
{
|
||||
BOOST_ASSERT(m_arguments[i]);
|
||||
|
||||
m_arguments[i] = m_arguments[i]->simplified();
|
||||
m_arguments[i] = m_arguments[i]->reduced();
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -24,7 +24,7 @@ class Imply: public Binary<Imply>
|
||||
static const std::string Identifier;
|
||||
|
||||
public:
|
||||
ExpressionPointer simplified() override;
|
||||
ExpressionPointer reduced() override;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -33,7 +33,7 @@ class NAry: public ExpressionCRTP<Derived>
|
||||
Expressions &arguments();
|
||||
const Expressions &arguments() const;
|
||||
|
||||
ExpressionPointer simplified() override;
|
||||
ExpressionPointer reduced() override;
|
||||
ExpressionPointer negationNormalized() override;
|
||||
|
||||
void print(std::ostream &ostream) const override;
|
||||
@ -121,13 +121,13 @@ Expressions &NAry<Derived>::arguments()
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class Derived>
|
||||
inline ExpressionPointer NAry<Derived>::simplified()
|
||||
inline ExpressionPointer NAry<Derived>::reduced()
|
||||
{
|
||||
for (size_t i = 0; i < m_arguments.size(); i++)
|
||||
{
|
||||
BOOST_ASSERT(m_arguments[i]);
|
||||
|
||||
m_arguments[i] = m_arguments[i]->simplified();
|
||||
m_arguments[i] = m_arguments[i]->reduced();
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -32,7 +32,7 @@ class Not: public ExpressionCRTP<Not>
|
||||
void setArgument(ExpressionPointer argument);
|
||||
ExpressionPointer argument() const;
|
||||
|
||||
ExpressionPointer simplified() override;
|
||||
ExpressionPointer reduced() override;
|
||||
ExpressionPointer negationNormalized() override;
|
||||
|
||||
void print(std::ostream &ostream) const override;
|
||||
|
@ -26,12 +26,12 @@ namespace pddl
|
||||
|
||||
ExpressionPointer Expression::normalized()
|
||||
{
|
||||
return simplified()->negationNormalized();
|
||||
return reduced()->negationNormalized();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ExpressionPointer Expression::simplified()
|
||||
ExpressionPointer Expression::reduced()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ ExpressionPointer At::argument() const
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ExpressionPointer At::simplified()
|
||||
ExpressionPointer At::reduced()
|
||||
{
|
||||
throw utils::TranslatorException("“at” predicates currently not supported");
|
||||
throw utils::TranslatorException("reducing “at” predicates currently not supported");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -21,13 +21,13 @@ const std::string Imply::Identifier = "imply";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ExpressionPointer Imply::simplified()
|
||||
ExpressionPointer Imply::reduced()
|
||||
{
|
||||
BOOST_ASSERT(m_arguments[0]);
|
||||
BOOST_ASSERT(m_arguments[1]);
|
||||
|
||||
m_arguments[0] = m_arguments[0]->simplified();
|
||||
m_arguments[1] = m_arguments[1]->simplified();
|
||||
m_arguments[0] = m_arguments[0]->reduced();
|
||||
m_arguments[1] = m_arguments[1]->reduced();
|
||||
|
||||
auto notArgument0 = NotPointer(new Not);
|
||||
notArgument0->setArgument(m_arguments[0]);
|
||||
@ -36,7 +36,7 @@ ExpressionPointer Imply::simplified()
|
||||
orExpression->addArgument(notArgument0);
|
||||
orExpression->addArgument(m_arguments[1]);
|
||||
|
||||
return orExpression->simplified();
|
||||
return orExpression;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -37,11 +37,11 @@ ExpressionPointer Not::argument() const
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ExpressionPointer Not::simplified()
|
||||
ExpressionPointer Not::reduced()
|
||||
{
|
||||
BOOST_ASSERT(m_argument);
|
||||
|
||||
m_argument = m_argument->simplified();
|
||||
m_argument = m_argument->reduced();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ using namespace plasp::pddl;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(PDDLNormalizationTests, Simplify)
|
||||
TEST(PDDLNormalizationTests, Reduced)
|
||||
{
|
||||
auto n1 = expressions::NotPointer(new expressions::Not);
|
||||
auto n2 = expressions::NotPointer(new expressions::Not);
|
||||
@ -31,7 +31,7 @@ TEST(PDDLNormalizationTests, Simplify)
|
||||
n1->setArgument(n2);
|
||||
|
||||
std::stringstream output;
|
||||
n1->simplified()->print(output);
|
||||
n1->reduced()->print(output);
|
||||
|
||||
ASSERT_EQ(output.str(), "(not (not (and (or (or (not (a)) (b)) (c)) (d))))");
|
||||
}
|
||||
|
Reference in New Issue
Block a user