Compare commits
30 Commits
v3.0.2-rc.
...
v3.0.2
Author | SHA1 | Date | |
---|---|---|---|
b44c04d3c0 | |||
220b9959a3 | |||
f8ec341015 | |||
3ceeb3ae40 | |||
56f0091f1e | |||
ec886e345b | |||
786eabb748 | |||
fa18dc7979 | |||
136f9ed00a | |||
e312740629 | |||
31d0a1fb38 | |||
ca30f8a815 | |||
21c337e0fa | |||
8251652445 | |||
5e28dd046b | |||
363070b579 | |||
63ed1299ec | |||
7bd483cd7e | |||
91019f52aa | |||
69a26cb22f | |||
cdb06fa5bf | |||
9c76ce7174 | |||
676dc44619 | |||
b8a3019e5b | |||
e0a15849df | |||
ef57f27c6a | |||
169c5ae8e9 | |||
760143a4a2 | |||
b100bcd446 | |||
04ddbaabae |
@@ -1,15 +1,18 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## (unreleased)
|
## 3.0.2 (2016-08-18)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
* unified translation format for SAS and PDDL files
|
* unified translation format for SAS and PDDL files
|
||||||
* documentation of `plasp`’s output format
|
* documentation of `plasp`’s output format
|
||||||
|
* improved output syntax highlighting
|
||||||
|
* uses ASP string literals to avoid escaping PDDL identifiers
|
||||||
|
|
||||||
Bug Fixes:
|
Bug Fixes:
|
||||||
|
|
||||||
* fixes minor formatting issues in SAS translation
|
* fixes minor formatting issues in SAS translation
|
||||||
|
* fixes issue with unsupported expression negations
|
||||||
|
|
||||||
## 3.0.1 (2016-06-14)
|
## 3.0.1 (2016-06-14)
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic")
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||||
add_definitions(-std=c++14)
|
add_definitions(-std=c++14)
|
||||||
|
|
||||||
option(BUILD_TESTS "Build unit tests" ON)
|
option(BUILD_TESTS "Build unit tests" OFF)
|
||||||
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
|
@@ -50,13 +50,13 @@ $ plasp [files] [options]
|
|||||||
|
|
||||||
`plasp` automatically detects the language of the input program.
|
`plasp` automatically detects the language of the input program.
|
||||||
|
|
||||||
See [command-line interface](doc/command-line-interface.md) for more detail.
|
See [command-line interface](doc/command-line-interface.md) for more details.
|
||||||
|
|
||||||
## Output Format
|
## Output Format
|
||||||
|
|
||||||
`plasp` provides a uniform output format for SAS and PDDL input problems.
|
`plasp` provides a uniform output format for SAS and PDDL input problems.
|
||||||
|
|
||||||
See [output format](doc/output-format.md) for more detail.
|
See [output format](doc/output-format.md) for more details.
|
||||||
|
|
||||||
If you want to write your own meta encoding for `plasp`’s output, this [simple example encoding](encodings/sequential-incremental.lp) gets you started.
|
If you want to write your own meta encoding for `plasp`’s output, this [simple example encoding](encodings/sequential-incremental.lp) gets you started.
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ If you want to write your own meta encoding for `plasp`’s output, this [simple
|
|||||||
|
|
||||||
`plasp` requires `boost` and is built via CMake and a C++ compiler.
|
`plasp` requires `boost` and is built via CMake and a C++ compiler.
|
||||||
|
|
||||||
See [building instructions](doc/building-instructions.md) for more detail.
|
See [building instructions](doc/building-instructions.md) for more details.
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (variablesMap.count("version"))
|
if (variablesMap.count("version"))
|
||||||
{
|
{
|
||||||
std::cout << "plasp version 3.0.2-rc.1" << std::endl;
|
std::cout << "plasp version 3.0.2" << std::endl;
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,7 +33,8 @@ $ git submodule init
|
|||||||
$ git submodule update
|
$ git submodule update
|
||||||
```
|
```
|
||||||
|
|
||||||
Afterward, build and run the tests as follows:
|
Afterward, enable the flag `BUILD_TESTS` in your CMake configuration.
|
||||||
|
Finally, build and run the tests as follows:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make run-tests
|
$ make run-tests
|
||||||
|
@@ -66,12 +66,17 @@ The feature requirement predicates may be used in meta encodings to warn about u
|
|||||||
% declares a <type>
|
% declares a <type>
|
||||||
type(type(<name>)).
|
type(type(<name>)).
|
||||||
|
|
||||||
|
% specifies that <type 1> inherits <type 2>
|
||||||
|
inherits(type(<type 1>), type(<type 2>)).
|
||||||
|
|
||||||
% specifies <constant> to be of type type(<name>)
|
% specifies <constant> to be of type type(<name>)
|
||||||
has(<constant>, type(<name>)).
|
has(<constant>, type(<name>)).
|
||||||
```
|
```
|
||||||
|
|
||||||
[Variables](#variables), [constants](#constants-objects), and [objects](#constants-objects) may be typed. Types are only available with PDDL and if typing is enabled.
|
[Variables](#variables), [constants](#constants-objects), and [objects](#constants-objects) may be typed. Types are only available with PDDL and if typing is enabled.
|
||||||
|
|
||||||
|
`plasp` automatically generates all matching `has` predicates for objects with types that inherit other types.
|
||||||
|
|
||||||
### Variables
|
### Variables
|
||||||
|
|
||||||
```prolog
|
```prolog
|
||||||
@@ -151,7 +156,7 @@ initialState(<variable>, <value>).
|
|||||||
|
|
||||||
The initial state contains all [variable](#variables) assignments that hold before executing any [actions](#actions).
|
The initial state contains all [variable](#variables) assignments that hold before executing any [actions](#actions).
|
||||||
|
|
||||||
Note that with PDDL, the initial state might not assign values to all variables. Instead, unassigned values have to be assigned `false` manually.
|
Note that with PDDL, `plasp` sets all unspecified initial state variables to `false` in order to make the initial state total.
|
||||||
|
|
||||||
### Goal
|
### Goal
|
||||||
|
|
||||||
@@ -190,12 +195,14 @@ axiomRule(axiomRule(<number>)).
|
|||||||
precondition(<axiom rule>, <variable>, <value>).
|
precondition(<axiom rule>, <variable>, <value>).
|
||||||
|
|
||||||
% defines that after applying <axiom rule>, <variable> is assigned <value>
|
% defines that after applying <axiom rule>, <variable> is assigned <value>
|
||||||
postcondition(<axiom rule>, <variable>, <value>).
|
postcondition(<axiom rule>, effect(unconditional), <variable>, <value>).
|
||||||
```
|
```
|
||||||
|
|
||||||
Axiom rules are similar to [actions](#actions) in that they modify [variables](#variables) if certain preconditions are satisfied.
|
Axiom rules are similar to [actions](#actions) in that they modify [variables](#variables) if certain preconditions are satisfied.
|
||||||
However, axiom rules must be applied *immediately* as soon as their preconditions are satisfied.
|
However, axiom rules must be applied *immediately* as soon as their preconditions are satisfied.
|
||||||
|
|
||||||
|
The second argument of `postcondition`, `effect(unconditional)`, is not used and exists only for consistency with [actions](#actions).
|
||||||
|
|
||||||
Axiom rule facts are only present with SAS input programs and not PDDL.
|
Axiom rule facts are only present with SAS input programs and not PDDL.
|
||||||
|
|
||||||
Axiom rules contain essential information in order to find plans correctly.
|
Axiom rules contain essential information in order to find plans correctly.
|
||||||
|
@@ -1,18 +1,15 @@
|
|||||||
#include <incmode>.
|
#include <incmode>.
|
||||||
|
|
||||||
% Check feature requirements
|
% Check feature requirements
|
||||||
:- requiresFeature(actionCosts).
|
:- requires(feature(actionCosts)).
|
||||||
:- requiresFeature(axiomRules).
|
:- requires(feature(axiomRules)).
|
||||||
:- requiresFeature(conditionalEffects).
|
:- requires(feature(conditionalEffects)).
|
||||||
|
|
||||||
#program base.
|
#program base.
|
||||||
|
|
||||||
% Establish initial state
|
% Establish initial state
|
||||||
holds(Variable, Value, 0) :- initialState(Variable, Value).
|
holds(Variable, Value, 0) :- initialState(Variable, Value).
|
||||||
|
|
||||||
% Make unspecified initial state variables false by default (for PDDL)
|
|
||||||
holds(variable(Variable), value(Variable, false), 0) :- variable(variable(Variable)), {initialState(variable(Variable), _)} 0.
|
|
||||||
|
|
||||||
#program step(t).
|
#program step(t).
|
||||||
|
|
||||||
% Perform actions
|
% Perform actions
|
||||||
|
@@ -30,6 +30,8 @@ class Action
|
|||||||
const Expression *precondition() const;
|
const Expression *precondition() const;
|
||||||
const Expression *effect() const;
|
const Expression *effect() const;
|
||||||
|
|
||||||
|
void normalizeParameterNames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Action() = default;
|
Action() = default;
|
||||||
|
|
||||||
|
@@ -35,6 +35,8 @@ class Description
|
|||||||
bool containsProblem() const;
|
bool containsProblem() const;
|
||||||
const Problem &problem() const;
|
const Problem &problem() const;
|
||||||
|
|
||||||
|
void normalizeParameterNames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Description();
|
Description();
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ class Domain
|
|||||||
|
|
||||||
const Requirements &requirements() const;
|
const Requirements &requirements() const;
|
||||||
bool hasRequirement(Requirement::Type requirementType) const;
|
bool hasRequirement(Requirement::Type requirementType) const;
|
||||||
void checkRequirement(Requirement::Type requirementType) const;
|
void checkRequirement(Requirement::Type requirementType);
|
||||||
|
|
||||||
expressions::PrimitiveTypes &types();
|
expressions::PrimitiveTypes &types();
|
||||||
const expressions::PrimitiveTypes &types() const;
|
const expressions::PrimitiveTypes &types() const;
|
||||||
@@ -51,6 +51,8 @@ class Domain
|
|||||||
|
|
||||||
void checkConsistency();
|
void checkConsistency();
|
||||||
|
|
||||||
|
void normalizeParameterNames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parseSection();
|
void parseSection();
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ class Problem
|
|||||||
|
|
||||||
const Requirements &requirements() const;
|
const Requirements &requirements() const;
|
||||||
bool hasRequirement(Requirement::Type requirementType) const;
|
bool hasRequirement(Requirement::Type requirementType) const;
|
||||||
void checkRequirement(Requirement::Type requirementType) const;
|
void checkRequirement(Requirement::Type requirementType);
|
||||||
|
|
||||||
expressions::Constants &objects();
|
expressions::Constants &objects();
|
||||||
const expressions::Constants &objects() const;
|
const expressions::Constants &objects() const;
|
||||||
|
@@ -19,7 +19,7 @@ namespace pddl
|
|||||||
class TranslatorASP
|
class TranslatorASP
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TranslatorASP(const Description &description, utils::LogStream &outputStream);
|
explicit TranslatorASP(Description &description, utils::LogStream &outputStream);
|
||||||
|
|
||||||
void translate() const;
|
void translate() const;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ class TranslatorASP
|
|||||||
void translateLiteral(const Expression &literal) const;
|
void translateLiteral(const Expression &literal) const;
|
||||||
void translatePredicate(const expressions::Predicate &predicate) const;
|
void translatePredicate(const expressions::Predicate &predicate) const;
|
||||||
|
|
||||||
const Description &m_description;
|
Description &m_description;
|
||||||
utils::LogStream &m_outputStream;
|
utils::LogStream &m_outputStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,6 +29,8 @@ class PredicateDeclaration: public ExpressionCRTP<PredicateDeclaration>
|
|||||||
|
|
||||||
bool isDeclared() const;
|
bool isDeclared() const;
|
||||||
|
|
||||||
|
void normalizeParameterNames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PredicateDeclaration();
|
PredicateDeclaration();
|
||||||
|
|
||||||
|
@@ -28,7 +28,9 @@ class Variable: public ExpressionCRTP<Variable>
|
|||||||
const ExpressionContext &expressionContext);
|
const ExpressionContext &expressionContext);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void setName(std::string name);
|
||||||
const std::string &name() const;
|
const std::string &name() const;
|
||||||
|
|
||||||
const Expression *type() const;
|
const Expression *type() const;
|
||||||
|
|
||||||
void setDirty(bool isDirty = true);
|
void setDirty(bool isDirty = true);
|
||||||
|
@@ -46,7 +46,6 @@ struct Value
|
|||||||
Value negated() const;
|
Value negated() const;
|
||||||
|
|
||||||
void printAsSAS(utils::LogStream &outputStream) const;
|
void printAsSAS(utils::LogStream &outputStream) const;
|
||||||
void printAsASP(utils::LogStream &outputStream) const;
|
|
||||||
void printAsASPPredicate(utils::LogStream &outputStream) const;
|
void printAsASPPredicate(utils::LogStream &outputStream) const;
|
||||||
|
|
||||||
Sign sign() const;
|
Sign sign() const;
|
||||||
|
@@ -93,6 +93,26 @@ struct Token
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct RuleName: public Token
|
||||||
|
{
|
||||||
|
RuleName(const std::string &name)
|
||||||
|
: Token(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline LogStream &operator<<(LogStream &stream, const RuleName &keyword)
|
||||||
|
{
|
||||||
|
return (stream
|
||||||
|
<< utils::Format(utils::Color::White, utils::FontWeight::Bold)
|
||||||
|
<< keyword.name
|
||||||
|
<< utils::ResetFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct Keyword: public Token
|
struct Keyword: public Token
|
||||||
{
|
{
|
||||||
Keyword(const std::string &name)
|
Keyword(const std::string &name)
|
||||||
@@ -106,11 +126,10 @@ struct Keyword: public Token
|
|||||||
inline LogStream &operator<<(LogStream &stream, const Keyword &keyword)
|
inline LogStream &operator<<(LogStream &stream, const Keyword &keyword)
|
||||||
{
|
{
|
||||||
return (stream
|
return (stream
|
||||||
<< utils::Format(utils::Color::White, utils::FontWeight::Bold)
|
<< utils::Format(utils::Color::Blue, utils::FontWeight::Normal)
|
||||||
<< keyword.name
|
<< keyword.name
|
||||||
<< utils::ResetFormat());
|
<< utils::ResetFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct Number: public Token
|
struct Number: public Token
|
||||||
@@ -126,7 +145,7 @@ struct Number: public Token
|
|||||||
inline LogStream &operator<<(LogStream &stream, const Number &number)
|
inline LogStream &operator<<(LogStream &stream, const Number &number)
|
||||||
{
|
{
|
||||||
return (stream
|
return (stream
|
||||||
<< utils::Format(utils::Color::Yellow, utils::FontWeight::Bold)
|
<< utils::Format(utils::Color::Yellow, utils::FontWeight::Normal)
|
||||||
<< number.name
|
<< number.name
|
||||||
<< utils::ResetFormat());
|
<< utils::ResetFormat());
|
||||||
}
|
}
|
||||||
@@ -153,6 +172,66 @@ inline LogStream &operator<<(LogStream &stream, const Variable &variable)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct String: public Token
|
||||||
|
{
|
||||||
|
String(const std::string &name)
|
||||||
|
: Token(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline LogStream &operator<<(LogStream &stream, const String &string)
|
||||||
|
{
|
||||||
|
return (stream
|
||||||
|
<< utils::Format(utils::Color::Green, utils::FontWeight::Normal)
|
||||||
|
<< "\"" << string.name << "\""
|
||||||
|
<< utils::ResetFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct Boolean: public Token
|
||||||
|
{
|
||||||
|
Boolean(const std::string &name)
|
||||||
|
: Token(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline LogStream &operator<<(LogStream &stream, const Boolean &string)
|
||||||
|
{
|
||||||
|
return (stream
|
||||||
|
<< utils::Format(utils::Color::Red, utils::FontWeight::Normal)
|
||||||
|
<< string.name
|
||||||
|
<< utils::ResetFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct Reserved: public Token
|
||||||
|
{
|
||||||
|
Reserved(const std::string &name)
|
||||||
|
: Token(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline LogStream &operator<<(LogStream &stream, const Reserved &string)
|
||||||
|
{
|
||||||
|
return (stream
|
||||||
|
<< utils::Format(utils::Color::White, utils::FontWeight::Normal)
|
||||||
|
<< string.name
|
||||||
|
<< utils::ResetFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct Heading1: public Token
|
struct Heading1: public Token
|
||||||
{
|
{
|
||||||
Heading1(const std::string &name)
|
Heading1(const std::string &name)
|
||||||
|
@@ -1,57 +0,0 @@
|
|||||||
#ifndef __PLASP__UTILS__IO_H
|
|
||||||
#define __PLASP__UTILS__IO_H
|
|
||||||
|
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
|
||||||
|
|
||||||
namespace plasp
|
|
||||||
{
|
|
||||||
namespace utils
|
|
||||||
{
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// IO
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
inline std::string escapeASP(const std::string &string)
|
|
||||||
{
|
|
||||||
auto escaped = string;
|
|
||||||
|
|
||||||
boost::replace_all(escaped, "_", "__");
|
|
||||||
boost::replace_all(escaped, "-", "_h");
|
|
||||||
boost::replace_all(escaped, "@", "_a");
|
|
||||||
|
|
||||||
return escaped;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
inline std::string unescapeASP(const std::string &string)
|
|
||||||
{
|
|
||||||
auto unescaped = string;
|
|
||||||
|
|
||||||
boost::replace_all(unescaped, "_a", "@");
|
|
||||||
boost::replace_all(unescaped, "_h", "-");
|
|
||||||
boost::replace_all(unescaped, "__", "_");
|
|
||||||
|
|
||||||
return unescaped;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
inline std::string escapeASPVariable(const std::string &string)
|
|
||||||
{
|
|
||||||
auto escaped = escapeASP(string);
|
|
||||||
|
|
||||||
escaped.front() = std::toupper(escaped.front());
|
|
||||||
|
|
||||||
return escaped;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -118,11 +118,17 @@ class LogStream
|
|||||||
inline LogStream &operator<<(bool value);
|
inline LogStream &operator<<(bool value);
|
||||||
inline LogStream &operator<<(const void *value);
|
inline LogStream &operator<<(const void *value);
|
||||||
inline LogStream &operator<<(const char *value);
|
inline LogStream &operator<<(const char *value);
|
||||||
|
inline LogStream &operator<<(const signed char *value);
|
||||||
|
inline LogStream &operator<<(const unsigned char *value);
|
||||||
inline LogStream &operator<<(std::basic_streambuf<CharacterType, TraitsType> *sb);
|
inline LogStream &operator<<(std::basic_streambuf<CharacterType, TraitsType> *sb);
|
||||||
inline LogStream &operator<<(std::ios_base &(*func)(std::ios_base &));
|
inline LogStream &operator<<(std::ios_base &(*func)(std::ios_base &));
|
||||||
inline LogStream &operator<<(std::basic_ios<CharacterType, TraitsType> &(*func)(std::basic_ios<CharacterType, TraitsType> &));
|
inline LogStream &operator<<(std::basic_ios<CharacterType, TraitsType> &(*func)(std::basic_ios<CharacterType, TraitsType> &));
|
||||||
inline LogStream &operator<<(std::basic_ostream<CharacterType, TraitsType> &(*func)(std::basic_ostream<CharacterType, TraitsType> &));
|
inline LogStream &operator<<(std::basic_ostream<CharacterType, TraitsType> &(*func)(std::basic_ostream<CharacterType, TraitsType> &));
|
||||||
|
|
||||||
|
inline LogStream &operator<<(char value);
|
||||||
|
inline LogStream &operator<<(signed char value);
|
||||||
|
inline LogStream &operator<<(unsigned char value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StandardStream m_standardStream;
|
StandardStream m_standardStream;
|
||||||
ColorPolicy m_colorPolicy;
|
ColorPolicy m_colorPolicy;
|
||||||
@@ -242,6 +248,22 @@ LogStream &LogStream::operator<<(const char *value)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
LogStream &LogStream::operator<<(const signed char *value)
|
||||||
|
{
|
||||||
|
ostream() << value;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
LogStream &LogStream::operator<<(const unsigned char *value)
|
||||||
|
{
|
||||||
|
ostream() << value;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
LogStream &LogStream::operator<<(std::basic_streambuf<CharacterType, TraitsType>* sb)
|
LogStream &LogStream::operator<<(std::basic_streambuf<CharacterType, TraitsType>* sb)
|
||||||
{
|
{
|
||||||
ostream() << sb;
|
ostream() << sb;
|
||||||
@@ -283,6 +305,30 @@ inline LogStream &operator<<(LogStream &stream, const std::basic_string<Characte
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
LogStream &LogStream::operator<<(char value)
|
||||||
|
{
|
||||||
|
ostream() << value;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
LogStream &LogStream::operator<<(signed char value)
|
||||||
|
{
|
||||||
|
ostream() << value;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
LogStream &LogStream::operator<<(unsigned char value)
|
||||||
|
{
|
||||||
|
ostream() << value;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
34
instances/ipc-1998-gripper/domain.pddl
Normal file
34
instances/ipc-1998-gripper/domain.pddl
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
(define (domain gripper-strips)
|
||||||
|
(:predicates (room ?r)
|
||||||
|
(ball ?b)
|
||||||
|
(gripper ?g)
|
||||||
|
(at-robby ?r)
|
||||||
|
(at ?b ?r)
|
||||||
|
(free ?g)
|
||||||
|
(carry ?o ?g))
|
||||||
|
|
||||||
|
(:action move
|
||||||
|
:parameters (?from ?to)
|
||||||
|
:precondition (and (room ?from) (room ?to) (at-robby ?from))
|
||||||
|
:effect (and (at-robby ?to)
|
||||||
|
(not (at-robby ?from))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(:action pick
|
||||||
|
:parameters (?obj ?room ?gripper)
|
||||||
|
:precondition (and (ball ?obj) (room ?room) (gripper ?gripper)
|
||||||
|
(at ?obj ?room) (at-robby ?room) (free ?gripper))
|
||||||
|
:effect (and (carry ?obj ?gripper)
|
||||||
|
(not (at ?obj ?room))
|
||||||
|
(not (free ?gripper))))
|
||||||
|
|
||||||
|
|
||||||
|
(:action drop
|
||||||
|
:parameters (?obj ?room ?gripper)
|
||||||
|
:precondition (and (ball ?obj) (room ?room) (gripper ?gripper)
|
||||||
|
(carry ?obj ?gripper) (at-robby ?room))
|
||||||
|
:effect (and (at ?obj ?room)
|
||||||
|
(free ?gripper)
|
||||||
|
(not (carry ?obj ?gripper)))))
|
||||||
|
|
22
instances/ipc-1998-gripper/problem-01.pddl
Normal file
22
instances/ipc-1998-gripper/problem-01.pddl
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
(define (problem strips-gripper-x-1)
|
||||||
|
(:domain gripper-strips)
|
||||||
|
(:objects rooma roomb ball4 ball3 ball2 ball1 left right)
|
||||||
|
(:init (room rooma)
|
||||||
|
(room roomb)
|
||||||
|
(ball ball4)
|
||||||
|
(ball ball3)
|
||||||
|
(ball ball2)
|
||||||
|
(ball ball1)
|
||||||
|
(at-robby rooma)
|
||||||
|
(free left)
|
||||||
|
(free right)
|
||||||
|
(at ball4 rooma)
|
||||||
|
(at ball3 rooma)
|
||||||
|
(at ball2 rooma)
|
||||||
|
(at ball1 rooma)
|
||||||
|
(gripper left)
|
||||||
|
(gripper right))
|
||||||
|
(:goal (and (at ball4 roomb)
|
||||||
|
(at ball3 roomb)
|
||||||
|
(at ball2 roomb)
|
||||||
|
(at ball1 roomb))))
|
28
instances/ipc-1998-gripper/problem-02.pddl
Normal file
28
instances/ipc-1998-gripper/problem-02.pddl
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
(define (problem strips-gripper-x-2)
|
||||||
|
(:domain gripper-strips)
|
||||||
|
(:objects rooma roomb ball6 ball5 ball4 ball3 ball2 ball1 left right)
|
||||||
|
(:init (room rooma)
|
||||||
|
(room roomb)
|
||||||
|
(ball ball6)
|
||||||
|
(ball ball5)
|
||||||
|
(ball ball4)
|
||||||
|
(ball ball3)
|
||||||
|
(ball ball2)
|
||||||
|
(ball ball1)
|
||||||
|
(at-robby rooma)
|
||||||
|
(free left)
|
||||||
|
(free right)
|
||||||
|
(at ball6 rooma)
|
||||||
|
(at ball5 rooma)
|
||||||
|
(at ball4 rooma)
|
||||||
|
(at ball3 rooma)
|
||||||
|
(at ball2 rooma)
|
||||||
|
(at ball1 rooma)
|
||||||
|
(gripper left)
|
||||||
|
(gripper right))
|
||||||
|
(:goal (and (at ball6 roomb)
|
||||||
|
(at ball5 roomb)
|
||||||
|
(at ball4 roomb)
|
||||||
|
(at ball3 roomb)
|
||||||
|
(at ball2 roomb)
|
||||||
|
(at ball1 roomb))))
|
4
instances/ipc-1998-gripper/solutions
Normal file
4
instances/ipc-1998-gripper/solutions
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
instance | minimal horizon | #solutions with minimal horizon
|
||||||
|
============================================================
|
||||||
|
problem-01.pddl | 11 | 384
|
||||||
|
problem-02.pddl | 17 | 46080
|
49
instances/ipc-2000-blocks-track-1-typed/domain.pddl
Normal file
49
instances/ipc-2000-blocks-track-1-typed/domain.pddl
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;; 4 Op-blocks world
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(define (domain BLOCKS)
|
||||||
|
(:requirements :strips :typing)
|
||||||
|
(:types block)
|
||||||
|
(:predicates (on ?x - block ?y - block)
|
||||||
|
(ontable ?x - block)
|
||||||
|
(clear ?x - block)
|
||||||
|
(handempty)
|
||||||
|
(holding ?x - block)
|
||||||
|
)
|
||||||
|
|
||||||
|
(:action pick-up
|
||||||
|
:parameters (?x - block)
|
||||||
|
:precondition (and (clear ?x) (ontable ?x) (handempty))
|
||||||
|
:effect
|
||||||
|
(and (not (ontable ?x))
|
||||||
|
(not (clear ?x))
|
||||||
|
(not (handempty))
|
||||||
|
(holding ?x)))
|
||||||
|
|
||||||
|
(:action put-down
|
||||||
|
:parameters (?x - block)
|
||||||
|
:precondition (holding ?x)
|
||||||
|
:effect
|
||||||
|
(and (not (holding ?x))
|
||||||
|
(clear ?x)
|
||||||
|
(handempty)
|
||||||
|
(ontable ?x)))
|
||||||
|
(:action stack
|
||||||
|
:parameters (?x - block ?y - block)
|
||||||
|
:precondition (and (holding ?x) (clear ?y))
|
||||||
|
:effect
|
||||||
|
(and (not (holding ?x))
|
||||||
|
(not (clear ?y))
|
||||||
|
(clear ?x)
|
||||||
|
(handempty)
|
||||||
|
(on ?x ?y)))
|
||||||
|
(:action unstack
|
||||||
|
:parameters (?x - block ?y - block)
|
||||||
|
:precondition (and (on ?x ?y) (clear ?x) (handempty))
|
||||||
|
:effect
|
||||||
|
(and (holding ?x)
|
||||||
|
(clear ?y)
|
||||||
|
(not (clear ?x))
|
||||||
|
(not (handempty))
|
||||||
|
(not (on ?x ?y)))))
|
@@ -0,0 +1,7 @@
|
|||||||
|
(define (problem BLOCKS-4-0)
|
||||||
|
(:domain BLOCKS)
|
||||||
|
(:objects D B A C - block)
|
||||||
|
(:INIT (CLEAR C) (CLEAR A) (CLEAR B) (CLEAR D) (ONTABLE C) (ONTABLE A)
|
||||||
|
(ONTABLE B) (ONTABLE D) (HANDEMPTY))
|
||||||
|
(:goal (AND (ON D C) (ON C B) (ON B A)))
|
||||||
|
)
|
@@ -0,0 +1,7 @@
|
|||||||
|
(define (problem BLOCKS-5-1)
|
||||||
|
(:domain BLOCKS)
|
||||||
|
(:objects A D C E B - block)
|
||||||
|
(:INIT (CLEAR B) (CLEAR E) (CLEAR C) (ONTABLE D) (ONTABLE E) (ONTABLE C)
|
||||||
|
(ON B A) (ON A D) (HANDEMPTY))
|
||||||
|
(:goal (AND (ON D C) (ON C B) (ON B A) (ON A E)))
|
||||||
|
)
|
@@ -0,0 +1,7 @@
|
|||||||
|
(define (problem BLOCKS-8-1)
|
||||||
|
(:domain BLOCKS)
|
||||||
|
(:objects B A G C F D H E - block)
|
||||||
|
(:INIT (CLEAR E) (CLEAR H) (CLEAR D) (CLEAR F) (ONTABLE C) (ONTABLE G)
|
||||||
|
(ONTABLE D) (ONTABLE F) (ON E C) (ON H A) (ON A B) (ON B G) (HANDEMPTY))
|
||||||
|
(:goal (AND (ON C D) (ON D B) (ON B G) (ON G F) (ON F H) (ON H A) (ON A E)))
|
||||||
|
)
|
@@ -0,0 +1,8 @@
|
|||||||
|
(define (problem BLOCKS-9-2)
|
||||||
|
(:domain BLOCKS)
|
||||||
|
(:objects B I C E D A G F H - block)
|
||||||
|
(:INIT (CLEAR H) (CLEAR F) (ONTABLE G) (ONTABLE F) (ON H A) (ON A D) (ON D E)
|
||||||
|
(ON E C) (ON C I) (ON I B) (ON B G) (HANDEMPTY))
|
||||||
|
(:goal (AND (ON F G) (ON G H) (ON H D) (ON D I) (ON I E) (ON E B) (ON B C)
|
||||||
|
(ON C A)))
|
||||||
|
)
|
6
instances/ipc-2000-blocks-track-1-typed/solutions
Normal file
6
instances/ipc-2000-blocks-track-1-typed/solutions
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
instance | minimal horizon | #solutions with minimal horizon
|
||||||
|
============================================================
|
||||||
|
problem-04-00.pddl | 6 | 1
|
||||||
|
problem-05-01.pddl | 10 | 2
|
||||||
|
problem-08-01.pddl | 20 | 60
|
||||||
|
problem-09-02.pddl | 20 | 37
|
66
instances/ipc-2000-elevator-m10-strips/domain.pddl
Normal file
66
instances/ipc-2000-elevator-m10-strips/domain.pddl
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
(define (domain miconic)
|
||||||
|
(:requirements :strips)
|
||||||
|
(:types passenger - object
|
||||||
|
floor - object
|
||||||
|
)
|
||||||
|
|
||||||
|
(:predicates
|
||||||
|
(origin ?person - passenger ?floor - floor)
|
||||||
|
;; entry of ?person is ?floor
|
||||||
|
;; inertia
|
||||||
|
|
||||||
|
(destin ?person - passenger ?floor - floor)
|
||||||
|
;; exit of ?person is ?floor
|
||||||
|
;; inertia
|
||||||
|
|
||||||
|
(above ?floor1 - floor ?floor2 - floor)
|
||||||
|
;; ?floor2 is located above of ?floor1
|
||||||
|
|
||||||
|
(boarded ?person - passenger)
|
||||||
|
;; true if ?person has boarded the lift
|
||||||
|
|
||||||
|
(not-boarded ?person - passenger)
|
||||||
|
;; true if ?person has not boarded the lift
|
||||||
|
|
||||||
|
(served ?person - passenger)
|
||||||
|
;; true if ?person has alighted as her destination
|
||||||
|
|
||||||
|
(not-served ?person - passenger)
|
||||||
|
;; true if ?person is not at their destination
|
||||||
|
|
||||||
|
(lift-at ?floor - floor)
|
||||||
|
;; current position of the lift is at ?floor
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
;;stop and allow boarding
|
||||||
|
|
||||||
|
(:action board
|
||||||
|
:parameters (?f - floor ?p - passenger)
|
||||||
|
:precondition (and (lift-at ?f) (origin ?p ?f))
|
||||||
|
:effect (boarded ?p))
|
||||||
|
|
||||||
|
(:action depart
|
||||||
|
:parameters (?f - floor ?p - passenger)
|
||||||
|
:precondition (and (lift-at ?f) (destin ?p ?f)
|
||||||
|
(boarded ?p))
|
||||||
|
:effect (and (not (boarded ?p))
|
||||||
|
(served ?p)))
|
||||||
|
;;drive up
|
||||||
|
|
||||||
|
(:action up
|
||||||
|
:parameters (?f1 - floor ?f2 - floor)
|
||||||
|
:precondition (and (lift-at ?f1) (above ?f1 ?f2))
|
||||||
|
:effect (and (lift-at ?f2) (not (lift-at ?f1))))
|
||||||
|
|
||||||
|
|
||||||
|
;;drive down
|
||||||
|
|
||||||
|
(:action down
|
||||||
|
:parameters (?f1 - floor ?f2 - floor)
|
||||||
|
:precondition (and (lift-at ?f1) (above ?f2 ?f1))
|
||||||
|
:effect (and (lift-at ?f2) (not (lift-at ?f1))))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
58
instances/ipc-2000-elevator-m10-strips/problem-03-00.pddl
Normal file
58
instances/ipc-2000-elevator-m10-strips/problem-03-00.pddl
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(define (problem mixed-f6-p3-u0-v0-g0-a0-n0-A0-B0-N0-F0-r0)
|
||||||
|
(:domain miconic)
|
||||||
|
(:objects p0 p1 p2 - passenger
|
||||||
|
f0 f1 f2 f3 f4 f5 - floor)
|
||||||
|
|
||||||
|
|
||||||
|
(:init
|
||||||
|
(above f0 f1)
|
||||||
|
(above f0 f2)
|
||||||
|
(above f0 f3)
|
||||||
|
(above f0 f4)
|
||||||
|
(above f0 f5)
|
||||||
|
|
||||||
|
(above f1 f2)
|
||||||
|
(above f1 f3)
|
||||||
|
(above f1 f4)
|
||||||
|
(above f1 f5)
|
||||||
|
|
||||||
|
(above f2 f3)
|
||||||
|
(above f2 f4)
|
||||||
|
(above f2 f5)
|
||||||
|
|
||||||
|
(above f3 f4)
|
||||||
|
(above f3 f5)
|
||||||
|
|
||||||
|
(above f4 f5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(origin p0 f1)
|
||||||
|
(destin p0 f4)
|
||||||
|
|
||||||
|
(origin p1 f3)
|
||||||
|
(destin p1 f1)
|
||||||
|
|
||||||
|
(origin p2 f5)
|
||||||
|
(destin p2 f1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(lift-at f0)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(served p0)
|
||||||
|
(served p1)
|
||||||
|
(served p2)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
58
instances/ipc-2000-elevator-m10-strips/problem-03-01.pddl
Normal file
58
instances/ipc-2000-elevator-m10-strips/problem-03-01.pddl
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(define (problem mixed-f6-p3-u0-v0-g0-a0-n0-A0-B0-N0-F0-r1)
|
||||||
|
(:domain miconic)
|
||||||
|
(:objects p0 p1 p2 - passenger
|
||||||
|
f0 f1 f2 f3 f4 f5 - floor)
|
||||||
|
|
||||||
|
|
||||||
|
(:init
|
||||||
|
(above f0 f1)
|
||||||
|
(above f0 f2)
|
||||||
|
(above f0 f3)
|
||||||
|
(above f0 f4)
|
||||||
|
(above f0 f5)
|
||||||
|
|
||||||
|
(above f1 f2)
|
||||||
|
(above f1 f3)
|
||||||
|
(above f1 f4)
|
||||||
|
(above f1 f5)
|
||||||
|
|
||||||
|
(above f2 f3)
|
||||||
|
(above f2 f4)
|
||||||
|
(above f2 f5)
|
||||||
|
|
||||||
|
(above f3 f4)
|
||||||
|
(above f3 f5)
|
||||||
|
|
||||||
|
(above f4 f5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(origin p0 f2)
|
||||||
|
(destin p0 f5)
|
||||||
|
|
||||||
|
(origin p1 f5)
|
||||||
|
(destin p1 f2)
|
||||||
|
|
||||||
|
(origin p2 f4)
|
||||||
|
(destin p2 f1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(lift-at f0)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(served p0)
|
||||||
|
(served p1)
|
||||||
|
(served p2)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
77
instances/ipc-2000-elevator-m10-strips/problem-04-00.pddl
Normal file
77
instances/ipc-2000-elevator-m10-strips/problem-04-00.pddl
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(define (problem mixed-f8-p4-u0-v0-g0-a0-n0-A0-B0-N0-F0-r0)
|
||||||
|
(:domain miconic)
|
||||||
|
(:objects p0 p1 p2 p3 - passenger
|
||||||
|
f0 f1 f2 f3 f4 f5 f6 f7 - floor)
|
||||||
|
|
||||||
|
|
||||||
|
(:init
|
||||||
|
(above f0 f1)
|
||||||
|
(above f0 f2)
|
||||||
|
(above f0 f3)
|
||||||
|
(above f0 f4)
|
||||||
|
(above f0 f5)
|
||||||
|
(above f0 f6)
|
||||||
|
(above f0 f7)
|
||||||
|
|
||||||
|
(above f1 f2)
|
||||||
|
(above f1 f3)
|
||||||
|
(above f1 f4)
|
||||||
|
(above f1 f5)
|
||||||
|
(above f1 f6)
|
||||||
|
(above f1 f7)
|
||||||
|
|
||||||
|
(above f2 f3)
|
||||||
|
(above f2 f4)
|
||||||
|
(above f2 f5)
|
||||||
|
(above f2 f6)
|
||||||
|
(above f2 f7)
|
||||||
|
|
||||||
|
(above f3 f4)
|
||||||
|
(above f3 f5)
|
||||||
|
(above f3 f6)
|
||||||
|
(above f3 f7)
|
||||||
|
|
||||||
|
(above f4 f5)
|
||||||
|
(above f4 f6)
|
||||||
|
(above f4 f7)
|
||||||
|
|
||||||
|
(above f5 f6)
|
||||||
|
(above f5 f7)
|
||||||
|
|
||||||
|
(above f6 f7)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(origin p0 f7)
|
||||||
|
(destin p0 f6)
|
||||||
|
|
||||||
|
(origin p1 f1)
|
||||||
|
(destin p1 f3)
|
||||||
|
|
||||||
|
(origin p2 f1)
|
||||||
|
(destin p2 f7)
|
||||||
|
|
||||||
|
(origin p3 f2)
|
||||||
|
(destin p3 f4)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(lift-at f0)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(served p0)
|
||||||
|
(served p1)
|
||||||
|
(served p2)
|
||||||
|
(served p3)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
77
instances/ipc-2000-elevator-m10-strips/problem-04-01.pddl
Normal file
77
instances/ipc-2000-elevator-m10-strips/problem-04-01.pddl
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(define (problem mixed-f8-p4-u0-v0-g0-a0-n0-A0-B0-N0-F0-r1)
|
||||||
|
(:domain miconic)
|
||||||
|
(:objects p0 p1 p2 p3 - passenger
|
||||||
|
f0 f1 f2 f3 f4 f5 f6 f7 - floor)
|
||||||
|
|
||||||
|
|
||||||
|
(:init
|
||||||
|
(above f0 f1)
|
||||||
|
(above f0 f2)
|
||||||
|
(above f0 f3)
|
||||||
|
(above f0 f4)
|
||||||
|
(above f0 f5)
|
||||||
|
(above f0 f6)
|
||||||
|
(above f0 f7)
|
||||||
|
|
||||||
|
(above f1 f2)
|
||||||
|
(above f1 f3)
|
||||||
|
(above f1 f4)
|
||||||
|
(above f1 f5)
|
||||||
|
(above f1 f6)
|
||||||
|
(above f1 f7)
|
||||||
|
|
||||||
|
(above f2 f3)
|
||||||
|
(above f2 f4)
|
||||||
|
(above f2 f5)
|
||||||
|
(above f2 f6)
|
||||||
|
(above f2 f7)
|
||||||
|
|
||||||
|
(above f3 f4)
|
||||||
|
(above f3 f5)
|
||||||
|
(above f3 f6)
|
||||||
|
(above f3 f7)
|
||||||
|
|
||||||
|
(above f4 f5)
|
||||||
|
(above f4 f6)
|
||||||
|
(above f4 f7)
|
||||||
|
|
||||||
|
(above f5 f6)
|
||||||
|
(above f5 f7)
|
||||||
|
|
||||||
|
(above f6 f7)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(origin p0 f0)
|
||||||
|
(destin p0 f5)
|
||||||
|
|
||||||
|
(origin p1 f7)
|
||||||
|
(destin p1 f4)
|
||||||
|
|
||||||
|
(origin p2 f0)
|
||||||
|
(destin p2 f7)
|
||||||
|
|
||||||
|
(origin p3 f1)
|
||||||
|
(destin p3 f6)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(lift-at f0)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(served p0)
|
||||||
|
(served p1)
|
||||||
|
(served p2)
|
||||||
|
(served p3)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
6
instances/ipc-2000-elevator-m10-strips/solutions
Normal file
6
instances/ipc-2000-elevator-m10-strips/solutions
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
instance | minimal horizon | #solutions with minimal horizon
|
||||||
|
============================================================
|
||||||
|
problem-03-00.pddl | 10 | 12
|
||||||
|
problem-03-01.pddl | 11 | 40
|
||||||
|
problem-04-00.pddl | 14 | 180
|
||||||
|
problem-04-01.pddl | 13 | 120
|
42
instances/ipc-2002-depots-strips/domain.pddl
Normal file
42
instances/ipc-2002-depots-strips/domain.pddl
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
(define (domain Depot)
|
||||||
|
(:requirements :typing)
|
||||||
|
(:types place locatable - object
|
||||||
|
depot distributor - place
|
||||||
|
truck hoist surface - locatable
|
||||||
|
pallet crate - surface)
|
||||||
|
|
||||||
|
(:predicates (at ?x - locatable ?y - place)
|
||||||
|
(on ?x - crate ?y - surface)
|
||||||
|
(in ?x - crate ?y - truck)
|
||||||
|
(lifting ?x - hoist ?y - crate)
|
||||||
|
(available ?x - hoist)
|
||||||
|
(clear ?x - surface))
|
||||||
|
|
||||||
|
(:action Drive
|
||||||
|
:parameters (?x - truck ?y - place ?z - place)
|
||||||
|
:precondition (and (at ?x ?y))
|
||||||
|
:effect (and (not (at ?x ?y)) (at ?x ?z)))
|
||||||
|
|
||||||
|
(:action Lift
|
||||||
|
:parameters (?x - hoist ?y - crate ?z - surface ?p - place)
|
||||||
|
:precondition (and (at ?x ?p) (available ?x) (at ?y ?p) (on ?y ?z) (clear ?y))
|
||||||
|
:effect (and (not (at ?y ?p)) (lifting ?x ?y) (not (clear ?y)) (not (available ?x))
|
||||||
|
(clear ?z) (not (on ?y ?z))))
|
||||||
|
|
||||||
|
(:action Drop
|
||||||
|
:parameters (?x - hoist ?y - crate ?z - surface ?p - place)
|
||||||
|
:precondition (and (at ?x ?p) (at ?z ?p) (clear ?z) (lifting ?x ?y))
|
||||||
|
:effect (and (available ?x) (not (lifting ?x ?y)) (at ?y ?p) (not (clear ?z)) (clear ?y)
|
||||||
|
(on ?y ?z)))
|
||||||
|
|
||||||
|
(:action Load
|
||||||
|
:parameters (?x - hoist ?y - crate ?z - truck ?p - place)
|
||||||
|
:precondition (and (at ?x ?p) (at ?z ?p) (lifting ?x ?y))
|
||||||
|
:effect (and (not (lifting ?x ?y)) (in ?y ?z) (available ?x)))
|
||||||
|
|
||||||
|
(:action Unload
|
||||||
|
:parameters (?x - hoist ?y - crate ?z - truck ?p - place)
|
||||||
|
:precondition (and (at ?x ?p) (at ?z ?p) (available ?x) (in ?y ?z))
|
||||||
|
:effect (and (not (in ?y ?z)) (not (available ?x)) (lifting ?x ?y)))
|
||||||
|
|
||||||
|
)
|
34
instances/ipc-2002-depots-strips/problem-01.pddl
Normal file
34
instances/ipc-2002-depots-strips/problem-01.pddl
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
(define (problem depotprob1818) (:domain Depot)
|
||||||
|
(:objects
|
||||||
|
depot0 - Depot
|
||||||
|
distributor0 distributor1 - Distributor
|
||||||
|
truck0 truck1 - Truck
|
||||||
|
pallet0 pallet1 pallet2 - Pallet
|
||||||
|
crate0 crate1 - Crate
|
||||||
|
hoist0 hoist1 hoist2 - Hoist)
|
||||||
|
(:init
|
||||||
|
(at pallet0 depot0)
|
||||||
|
(clear crate1)
|
||||||
|
(at pallet1 distributor0)
|
||||||
|
(clear crate0)
|
||||||
|
(at pallet2 distributor1)
|
||||||
|
(clear pallet2)
|
||||||
|
(at truck0 distributor1)
|
||||||
|
(at truck1 depot0)
|
||||||
|
(at hoist0 depot0)
|
||||||
|
(available hoist0)
|
||||||
|
(at hoist1 distributor0)
|
||||||
|
(available hoist1)
|
||||||
|
(at hoist2 distributor1)
|
||||||
|
(available hoist2)
|
||||||
|
(at crate0 distributor0)
|
||||||
|
(on crate0 pallet1)
|
||||||
|
(at crate1 depot0)
|
||||||
|
(on crate1 pallet0)
|
||||||
|
)
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(on crate0 pallet2)
|
||||||
|
(on crate1 pallet1)
|
||||||
|
)
|
||||||
|
))
|
40
instances/ipc-2002-depots-strips/problem-02.pddl
Normal file
40
instances/ipc-2002-depots-strips/problem-02.pddl
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
(define (problem depotprob7512) (:domain Depot)
|
||||||
|
(:objects
|
||||||
|
depot0 - Depot
|
||||||
|
distributor0 distributor1 - Distributor
|
||||||
|
truck0 truck1 - Truck
|
||||||
|
pallet0 pallet1 pallet2 - Pallet
|
||||||
|
crate0 crate1 crate2 crate3 - Crate
|
||||||
|
hoist0 hoist1 hoist2 - Hoist)
|
||||||
|
(:init
|
||||||
|
(at pallet0 depot0)
|
||||||
|
(clear crate0)
|
||||||
|
(at pallet1 distributor0)
|
||||||
|
(clear crate3)
|
||||||
|
(at pallet2 distributor1)
|
||||||
|
(clear crate2)
|
||||||
|
(at truck0 depot0)
|
||||||
|
(at truck1 depot0)
|
||||||
|
(at hoist0 depot0)
|
||||||
|
(available hoist0)
|
||||||
|
(at hoist1 distributor0)
|
||||||
|
(available hoist1)
|
||||||
|
(at hoist2 distributor1)
|
||||||
|
(available hoist2)
|
||||||
|
(at crate0 depot0)
|
||||||
|
(on crate0 pallet0)
|
||||||
|
(at crate1 distributor1)
|
||||||
|
(on crate1 pallet2)
|
||||||
|
(at crate2 distributor1)
|
||||||
|
(on crate2 crate1)
|
||||||
|
(at crate3 distributor0)
|
||||||
|
(on crate3 pallet1)
|
||||||
|
)
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(on crate0 pallet2)
|
||||||
|
(on crate1 crate3)
|
||||||
|
(on crate2 pallet0)
|
||||||
|
(on crate3 pallet1)
|
||||||
|
)
|
||||||
|
))
|
4
instances/ipc-2002-depots-strips/solutions
Normal file
4
instances/ipc-2002-depots-strips/solutions
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
instance | minimal horizon | #solutions with minimal horizon
|
||||||
|
============================================================
|
||||||
|
problem-01.pddl | 10 | 16
|
||||||
|
problem-02.pddl | 15 | 448
|
79
instances/ipc-2002-driver-log-strips/domain.pddl
Normal file
79
instances/ipc-2002-driver-log-strips/domain.pddl
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
(define (domain driverlog)
|
||||||
|
(:requirements :typing)
|
||||||
|
(:types location locatable - object
|
||||||
|
driver truck obj - locatable
|
||||||
|
|
||||||
|
)
|
||||||
|
(:predicates
|
||||||
|
(at ?obj - locatable ?loc - location)
|
||||||
|
(in ?obj1 - obj ?obj - truck)
|
||||||
|
(driving ?d - driver ?v - truck)
|
||||||
|
(link ?x ?y - location) (path ?x ?y - location)
|
||||||
|
(empty ?v - truck)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(:action LOAD-TRUCK
|
||||||
|
:parameters
|
||||||
|
(?obj - obj
|
||||||
|
?truck - truck
|
||||||
|
?loc - location)
|
||||||
|
:precondition
|
||||||
|
(and (at ?truck ?loc) (at ?obj ?loc))
|
||||||
|
:effect
|
||||||
|
(and (not (at ?obj ?loc)) (in ?obj ?truck)))
|
||||||
|
|
||||||
|
(:action UNLOAD-TRUCK
|
||||||
|
:parameters
|
||||||
|
(?obj - obj
|
||||||
|
?truck - truck
|
||||||
|
?loc - location)
|
||||||
|
:precondition
|
||||||
|
(and (at ?truck ?loc) (in ?obj ?truck))
|
||||||
|
:effect
|
||||||
|
(and (not (in ?obj ?truck)) (at ?obj ?loc)))
|
||||||
|
|
||||||
|
(:action BOARD-TRUCK
|
||||||
|
:parameters
|
||||||
|
(?driver - driver
|
||||||
|
?truck - truck
|
||||||
|
?loc - location)
|
||||||
|
:precondition
|
||||||
|
(and (at ?truck ?loc) (at ?driver ?loc) (empty ?truck))
|
||||||
|
:effect
|
||||||
|
(and (not (at ?driver ?loc)) (driving ?driver ?truck) (not (empty ?truck))))
|
||||||
|
|
||||||
|
(:action DISEMBARK-TRUCK
|
||||||
|
:parameters
|
||||||
|
(?driver - driver
|
||||||
|
?truck - truck
|
||||||
|
?loc - location)
|
||||||
|
:precondition
|
||||||
|
(and (at ?truck ?loc) (driving ?driver ?truck))
|
||||||
|
:effect
|
||||||
|
(and (not (driving ?driver ?truck)) (at ?driver ?loc) (empty ?truck)))
|
||||||
|
|
||||||
|
(:action DRIVE-TRUCK
|
||||||
|
:parameters
|
||||||
|
(?truck - truck
|
||||||
|
?loc-from - location
|
||||||
|
?loc-to - location
|
||||||
|
?driver - driver)
|
||||||
|
:precondition
|
||||||
|
(and (at ?truck ?loc-from)
|
||||||
|
(driving ?driver ?truck) (link ?loc-from ?loc-to))
|
||||||
|
:effect
|
||||||
|
(and (not (at ?truck ?loc-from)) (at ?truck ?loc-to)))
|
||||||
|
|
||||||
|
(:action WALK
|
||||||
|
:parameters
|
||||||
|
(?driver - driver
|
||||||
|
?loc-from - location
|
||||||
|
?loc-to - location)
|
||||||
|
:precondition
|
||||||
|
(and (at ?driver ?loc-from) (path ?loc-from ?loc-to))
|
||||||
|
:effect
|
||||||
|
(and (not (at ?driver ?loc-from)) (at ?driver ?loc-to)))
|
||||||
|
|
||||||
|
|
||||||
|
)
|
48
instances/ipc-2002-driver-log-strips/problem-01.pddl
Normal file
48
instances/ipc-2002-driver-log-strips/problem-01.pddl
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
(define (problem DLOG-2-2-2)
|
||||||
|
(:domain driverlog)
|
||||||
|
(:objects
|
||||||
|
driver1 - driver
|
||||||
|
driver2 - driver
|
||||||
|
truck1 - truck
|
||||||
|
truck2 - truck
|
||||||
|
package1 - obj
|
||||||
|
package2 - obj
|
||||||
|
s0 - location
|
||||||
|
s1 - location
|
||||||
|
s2 - location
|
||||||
|
p1-0 - location
|
||||||
|
p1-2 - location
|
||||||
|
)
|
||||||
|
(:init
|
||||||
|
(at driver1 s2)
|
||||||
|
(at driver2 s2)
|
||||||
|
(at truck1 s0)
|
||||||
|
(empty truck1)
|
||||||
|
(at truck2 s0)
|
||||||
|
(empty truck2)
|
||||||
|
(at package1 s0)
|
||||||
|
(at package2 s0)
|
||||||
|
(path s1 p1-0)
|
||||||
|
(path p1-0 s1)
|
||||||
|
(path s0 p1-0)
|
||||||
|
(path p1-0 s0)
|
||||||
|
(path s1 p1-2)
|
||||||
|
(path p1-2 s1)
|
||||||
|
(path s2 p1-2)
|
||||||
|
(path p1-2 s2)
|
||||||
|
(link s0 s1)
|
||||||
|
(link s1 s0)
|
||||||
|
(link s0 s2)
|
||||||
|
(link s2 s0)
|
||||||
|
(link s2 s1)
|
||||||
|
(link s1 s2)
|
||||||
|
)
|
||||||
|
(:goal (and
|
||||||
|
(at driver1 s1)
|
||||||
|
(at truck1 s1)
|
||||||
|
(at package1 s0)
|
||||||
|
(at package2 s0)
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
|
)
|
59
instances/ipc-2002-driver-log-strips/problem-03.pddl
Normal file
59
instances/ipc-2002-driver-log-strips/problem-03.pddl
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
(define (problem DLOG-2-2-4)
|
||||||
|
(:domain driverlog)
|
||||||
|
(:objects
|
||||||
|
driver1 - driver
|
||||||
|
driver2 - driver
|
||||||
|
truck1 - truck
|
||||||
|
truck2 - truck
|
||||||
|
package1 - obj
|
||||||
|
package2 - obj
|
||||||
|
package3 - obj
|
||||||
|
package4 - obj
|
||||||
|
s0 - location
|
||||||
|
s1 - location
|
||||||
|
s2 - location
|
||||||
|
p0-1 - location
|
||||||
|
p2-0 - location
|
||||||
|
p2-1 - location
|
||||||
|
)
|
||||||
|
(:init
|
||||||
|
(at driver1 s1)
|
||||||
|
(at driver2 s0)
|
||||||
|
(at truck1 s1)
|
||||||
|
(empty truck1)
|
||||||
|
(at truck2 s2)
|
||||||
|
(empty truck2)
|
||||||
|
(at package1 s0)
|
||||||
|
(at package2 s0)
|
||||||
|
(at package3 s1)
|
||||||
|
(at package4 s1)
|
||||||
|
(path s0 p0-1)
|
||||||
|
(path p0-1 s0)
|
||||||
|
(path s1 p0-1)
|
||||||
|
(path p0-1 s1)
|
||||||
|
(path s2 p2-0)
|
||||||
|
(path p2-0 s2)
|
||||||
|
(path s0 p2-0)
|
||||||
|
(path p2-0 s0)
|
||||||
|
(path s2 p2-1)
|
||||||
|
(path p2-1 s2)
|
||||||
|
(path s1 p2-1)
|
||||||
|
(path p2-1 s1)
|
||||||
|
(link s1 s0)
|
||||||
|
(link s0 s1)
|
||||||
|
(link s1 s2)
|
||||||
|
(link s2 s1)
|
||||||
|
(link s2 s0)
|
||||||
|
(link s0 s2)
|
||||||
|
)
|
||||||
|
(:goal (and
|
||||||
|
(at driver2 s2)
|
||||||
|
(at truck1 s1)
|
||||||
|
(at truck2 s2)
|
||||||
|
(at package1 s1)
|
||||||
|
(at package2 s1)
|
||||||
|
(at package3 s2)
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
|
)
|
4
instances/ipc-2002-driver-log-strips/solutions
Normal file
4
instances/ipc-2002-driver-log-strips/solutions
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
instance | minimal horizon | #solutions with minimal horizon
|
||||||
|
============================================================
|
||||||
|
problem-01.pddl | 7 | 1
|
||||||
|
problem-03.pddl | 12 | 1056
|
75
instances/ipc-2004-satellite/domain.pddl
Normal file
75
instances/ipc-2004-satellite/domain.pddl
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
|
||||||
|
(define (domain satellite)
|
||||||
|
(:requirements :strips :equality :typing)
|
||||||
|
(:types satellite direction instrument mode)
|
||||||
|
(:predicates
|
||||||
|
(on_board ?i - instrument ?s - satellite)
|
||||||
|
(supports ?i - instrument ?m - mode)
|
||||||
|
(pointing ?s - satellite ?d - direction)
|
||||||
|
(power_avail ?s - satellite)
|
||||||
|
(power_on ?i - instrument)
|
||||||
|
(calibrated ?i - instrument)
|
||||||
|
(have_image ?d - direction ?m - mode)
|
||||||
|
(calibration_target ?i - instrument ?d - direction))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(:action turn_to
|
||||||
|
:parameters (?s - satellite ?d_new - direction ?d_prev - direction)
|
||||||
|
:precondition (and (pointing ?s ?d_prev)
|
||||||
|
)
|
||||||
|
:effect (and (pointing ?s ?d_new)
|
||||||
|
(not (pointing ?s ?d_prev))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(:action switch_on
|
||||||
|
:parameters (?i - instrument ?s - satellite)
|
||||||
|
|
||||||
|
:precondition (and (on_board ?i ?s)
|
||||||
|
(power_avail ?s)
|
||||||
|
)
|
||||||
|
:effect (and (power_on ?i)
|
||||||
|
(not (calibrated ?i))
|
||||||
|
(not (power_avail ?s))
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(:action switch_off
|
||||||
|
:parameters (?i - instrument ?s - satellite)
|
||||||
|
|
||||||
|
:precondition (and (on_board ?i ?s)
|
||||||
|
(power_on ?i)
|
||||||
|
)
|
||||||
|
:effect (and (not (power_on ?i))
|
||||||
|
(power_avail ?s)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(:action calibrate
|
||||||
|
:parameters (?s - satellite ?i - instrument ?d - direction)
|
||||||
|
:precondition (and (on_board ?i ?s)
|
||||||
|
(calibration_target ?i ?d)
|
||||||
|
(pointing ?s ?d)
|
||||||
|
(power_on ?i)
|
||||||
|
)
|
||||||
|
:effect (calibrated ?i)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(:action take_image
|
||||||
|
:parameters (?s - satellite ?d - direction ?i - instrument ?m - mode)
|
||||||
|
:precondition (and (calibrated ?i)
|
||||||
|
(on_board ?i ?s)
|
||||||
|
(supports ?i ?m)
|
||||||
|
(power_on ?i)
|
||||||
|
(pointing ?s ?d)
|
||||||
|
(power_on ?i)
|
||||||
|
)
|
||||||
|
:effect (have_image ?d ?m)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
30
instances/ipc-2004-satellite/problem-01.pddl
Normal file
30
instances/ipc-2004-satellite/problem-01.pddl
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
(define (problem strips-sat-x-1)
|
||||||
|
(:domain satellite)
|
||||||
|
(:objects
|
||||||
|
satellite0 - satellite
|
||||||
|
instrument0 - instrument
|
||||||
|
image1 - mode
|
||||||
|
spectrograph2 - mode
|
||||||
|
thermograph0 - mode
|
||||||
|
Star0 - direction
|
||||||
|
GroundStation1 - direction
|
||||||
|
GroundStation2 - direction
|
||||||
|
Phenomenon3 - direction
|
||||||
|
Phenomenon4 - direction
|
||||||
|
Star5 - direction
|
||||||
|
Phenomenon6 - direction
|
||||||
|
)
|
||||||
|
(:init
|
||||||
|
(supports instrument0 thermograph0)
|
||||||
|
(calibration_target instrument0 GroundStation2)
|
||||||
|
(on_board instrument0 satellite0)
|
||||||
|
(power_avail satellite0)
|
||||||
|
(pointing satellite0 Phenomenon6)
|
||||||
|
)
|
||||||
|
(:goal (and
|
||||||
|
(have_image Phenomenon4 thermograph0)
|
||||||
|
(have_image Star5 thermograph0)
|
||||||
|
(have_image Phenomenon6 thermograph0)
|
||||||
|
))
|
||||||
|
|
||||||
|
)
|
40
instances/ipc-2004-satellite/problem-02.pddl
Normal file
40
instances/ipc-2004-satellite/problem-02.pddl
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
(define (problem strips-sat-x-1)
|
||||||
|
(:domain satellite)
|
||||||
|
(:objects
|
||||||
|
satellite0 - satellite
|
||||||
|
instrument0 - instrument
|
||||||
|
instrument1 - instrument
|
||||||
|
infrared0 - mode
|
||||||
|
infrared1 - mode
|
||||||
|
image2 - mode
|
||||||
|
GroundStation1 - direction
|
||||||
|
Star0 - direction
|
||||||
|
GroundStation2 - direction
|
||||||
|
Planet3 - direction
|
||||||
|
Planet4 - direction
|
||||||
|
Phenomenon5 - direction
|
||||||
|
Phenomenon6 - direction
|
||||||
|
Star7 - direction
|
||||||
|
)
|
||||||
|
(:init
|
||||||
|
(supports instrument0 infrared1)
|
||||||
|
(supports instrument0 infrared0)
|
||||||
|
(calibration_target instrument0 Star0)
|
||||||
|
(supports instrument1 image2)
|
||||||
|
(supports instrument1 infrared1)
|
||||||
|
(supports instrument1 infrared0)
|
||||||
|
(calibration_target instrument1 GroundStation2)
|
||||||
|
(on_board instrument0 satellite0)
|
||||||
|
(on_board instrument1 satellite0)
|
||||||
|
(power_avail satellite0)
|
||||||
|
(pointing satellite0 Planet4)
|
||||||
|
)
|
||||||
|
(:goal (and
|
||||||
|
(have_image Planet3 infrared0)
|
||||||
|
(have_image Planet4 infrared0)
|
||||||
|
(have_image Phenomenon5 image2)
|
||||||
|
(have_image Phenomenon6 infrared0)
|
||||||
|
(have_image Star7 infrared0)
|
||||||
|
))
|
||||||
|
|
||||||
|
)
|
52
instances/ipc-2004-satellite/problem-03.pddl
Normal file
52
instances/ipc-2004-satellite/problem-03.pddl
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
(define (problem strips-sat-x-1)
|
||||||
|
(:domain satellite)
|
||||||
|
(:objects
|
||||||
|
satellite0 - satellite
|
||||||
|
instrument0 - instrument
|
||||||
|
instrument1 - instrument
|
||||||
|
instrument2 - instrument
|
||||||
|
satellite1 - satellite
|
||||||
|
instrument3 - instrument
|
||||||
|
image1 - mode
|
||||||
|
infrared0 - mode
|
||||||
|
spectrograph2 - mode
|
||||||
|
Star1 - direction
|
||||||
|
Star2 - direction
|
||||||
|
Star0 - direction
|
||||||
|
Star3 - direction
|
||||||
|
Star4 - direction
|
||||||
|
Phenomenon5 - direction
|
||||||
|
Phenomenon6 - direction
|
||||||
|
Phenomenon7 - direction
|
||||||
|
)
|
||||||
|
(:init
|
||||||
|
(supports instrument0 spectrograph2)
|
||||||
|
(supports instrument0 infrared0)
|
||||||
|
(calibration_target instrument0 Star1)
|
||||||
|
(supports instrument1 image1)
|
||||||
|
(calibration_target instrument1 Star2)
|
||||||
|
(supports instrument2 infrared0)
|
||||||
|
(supports instrument2 image1)
|
||||||
|
(calibration_target instrument2 Star0)
|
||||||
|
(on_board instrument0 satellite0)
|
||||||
|
(on_board instrument1 satellite0)
|
||||||
|
(on_board instrument2 satellite0)
|
||||||
|
(power_avail satellite0)
|
||||||
|
(pointing satellite0 Star4)
|
||||||
|
(supports instrument3 spectrograph2)
|
||||||
|
(supports instrument3 infrared0)
|
||||||
|
(supports instrument3 image1)
|
||||||
|
(calibration_target instrument3 Star0)
|
||||||
|
(on_board instrument3 satellite1)
|
||||||
|
(power_avail satellite1)
|
||||||
|
(pointing satellite1 Star0)
|
||||||
|
)
|
||||||
|
(:goal (and
|
||||||
|
(pointing satellite0 Phenomenon5)
|
||||||
|
(have_image Star3 infrared0)
|
||||||
|
(have_image Star4 spectrograph2)
|
||||||
|
(have_image Phenomenon5 spectrograph2)
|
||||||
|
(have_image Phenomenon7 spectrograph2)
|
||||||
|
))
|
||||||
|
|
||||||
|
)
|
5
instances/ipc-2004-satellite/solutions
Normal file
5
instances/ipc-2004-satellite/solutions
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
instance | minimal horizon | #solutions with minimal horizon
|
||||||
|
============================================================
|
||||||
|
problem-01.pddl | 9 | 12
|
||||||
|
problem-02.pddl | 13 | 240
|
||||||
|
problem-03.pddl | 11 | 276
|
65
instances/ipc-2006-tpp-propositional/domain.pddl
Normal file
65
instances/ipc-2006-tpp-propositional/domain.pddl
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
; IPC5 Domain: TPP Propositional
|
||||||
|
; Authors: Alfonso Gerevini and Alessandro Saetti
|
||||||
|
|
||||||
|
(define (domain TPP-Propositional)
|
||||||
|
(:requirements :strips :typing)
|
||||||
|
(:types place locatable level - object
|
||||||
|
depot market - place
|
||||||
|
truck goods - locatable)
|
||||||
|
|
||||||
|
(:predicates (loaded ?g - goods ?t - truck ?l - level)
|
||||||
|
(ready-to-load ?g - goods ?m - market ?l - level)
|
||||||
|
(stored ?g - goods ?l - level)
|
||||||
|
(on-sale ?g - goods ?m - market ?l - level)
|
||||||
|
(next ?l1 ?l2 - level)
|
||||||
|
(at ?t - truck ?p - place)
|
||||||
|
(connected ?p1 ?p2 - place))
|
||||||
|
|
||||||
|
(:action drive
|
||||||
|
:parameters (?t - truck ?from ?to - place)
|
||||||
|
:precondition (and (at ?t ?from) (connected ?from ?to))
|
||||||
|
:effect (and (not (at ?t ?from)) (at ?t ?to)))
|
||||||
|
|
||||||
|
|
||||||
|
; ### LOAD ###
|
||||||
|
; ?l1 is the level of ?g ready to be loaded at ?m before loading
|
||||||
|
; ?l2 is the level of ?g ready to be loaded at ?m after loading
|
||||||
|
; ?l3 is the level of ?g in ?t before loading
|
||||||
|
; ?l4 is the level of ?g in ?t after loading
|
||||||
|
|
||||||
|
(:action load
|
||||||
|
:parameters (?g - goods ?t - truck ?m - market ?l1 ?l2 ?l3 ?l4 - level)
|
||||||
|
:precondition (and (at ?t ?m) (loaded ?g ?t ?l3)
|
||||||
|
(ready-to-load ?g ?m ?l2) (next ?l2 ?l1) (next ?l4 ?l3))
|
||||||
|
:effect (and (loaded ?g ?t ?l4) (not (loaded ?g ?t ?l3))
|
||||||
|
(ready-to-load ?g ?m ?l1) (not (ready-to-load ?g ?m ?l2))))
|
||||||
|
|
||||||
|
|
||||||
|
; ### UNLOAD ###
|
||||||
|
; ?l1 is the level of ?g in ?t before unloading
|
||||||
|
; ?l2 is the level of ?g in ?t after unloading
|
||||||
|
; ?l3 is the level of ?g in ?d before unloading
|
||||||
|
; ?l4 is the level of ?g in ?d after unloading
|
||||||
|
|
||||||
|
(:action unload
|
||||||
|
:parameters (?g - goods ?t - truck ?d - depot ?l1 ?l2 ?l3 ?l4 - level)
|
||||||
|
:precondition (and (at ?t ?d) (loaded ?g ?t ?l2)
|
||||||
|
(stored ?g ?l3) (next ?l2 ?l1) (next ?l4 ?l3))
|
||||||
|
:effect (and (loaded ?g ?t ?l1) (not (loaded ?g ?t ?l2))
|
||||||
|
(stored ?g ?l4) (not (stored ?g ?l3))))
|
||||||
|
|
||||||
|
|
||||||
|
; ### BUY ###
|
||||||
|
; ?l1 is the level of ?g on sale at ?m before buying
|
||||||
|
; ?l2 is the level of ?g on sale at ?m after buying
|
||||||
|
; ?l3 is the level of ?g ready to be loaded at ?m before buying
|
||||||
|
; ?l4 is the level of ?g ready to be loaded at ?m after buying
|
||||||
|
|
||||||
|
(:action buy
|
||||||
|
:parameters (?t - truck ?g - goods ?m - market ?l1 ?l2 ?l3 ?l4 - level)
|
||||||
|
:precondition (and (at ?t ?m) (on-sale ?g ?m ?l2) (ready-to-load ?g ?m ?l3)
|
||||||
|
(next ?l2 ?l1) (next ?l4 ?l3))
|
||||||
|
:effect (and (on-sale ?g ?m ?l1) (not (on-sale ?g ?m ?l2))
|
||||||
|
(ready-to-load ?g ?m ?l4) (not (ready-to-load ?g ?m ?l3))))
|
||||||
|
|
||||||
|
)
|
28
instances/ipc-2006-tpp-propositional/problem-02.pddl
Normal file
28
instances/ipc-2006-tpp-propositional/problem-02.pddl
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
(define (problem TPP)
|
||||||
|
(:domain TPP-Propositional)
|
||||||
|
(:objects
|
||||||
|
goods1 goods2 - goods
|
||||||
|
truck1 - truck
|
||||||
|
market1 - market
|
||||||
|
depot1 - depot
|
||||||
|
level0 level1 - level)
|
||||||
|
|
||||||
|
(:init
|
||||||
|
(next level1 level0)
|
||||||
|
(ready-to-load goods1 market1 level0)
|
||||||
|
(ready-to-load goods2 market1 level0)
|
||||||
|
(stored goods1 level0)
|
||||||
|
(stored goods2 level0)
|
||||||
|
(loaded goods1 truck1 level0)
|
||||||
|
(loaded goods2 truck1 level0)
|
||||||
|
(connected depot1 market1)
|
||||||
|
(connected market1 depot1)
|
||||||
|
(on-sale goods1 market1 level1)
|
||||||
|
(on-sale goods2 market1 level1)
|
||||||
|
(at truck1 depot1))
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(stored goods1 level1)
|
||||||
|
(stored goods2 level1)))
|
||||||
|
|
||||||
|
)
|
33
instances/ipc-2006-tpp-propositional/problem-03.pddl
Normal file
33
instances/ipc-2006-tpp-propositional/problem-03.pddl
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
(define (problem TPP)
|
||||||
|
(:domain TPP-Propositional)
|
||||||
|
(:objects
|
||||||
|
goods1 goods2 goods3 - goods
|
||||||
|
truck1 - truck
|
||||||
|
market1 - market
|
||||||
|
depot1 - depot
|
||||||
|
level0 level1 - level)
|
||||||
|
|
||||||
|
(:init
|
||||||
|
(next level1 level0)
|
||||||
|
(ready-to-load goods1 market1 level0)
|
||||||
|
(ready-to-load goods2 market1 level0)
|
||||||
|
(ready-to-load goods3 market1 level0)
|
||||||
|
(stored goods1 level0)
|
||||||
|
(stored goods2 level0)
|
||||||
|
(stored goods3 level0)
|
||||||
|
(loaded goods1 truck1 level0)
|
||||||
|
(loaded goods2 truck1 level0)
|
||||||
|
(loaded goods3 truck1 level0)
|
||||||
|
(connected depot1 market1)
|
||||||
|
(connected market1 depot1)
|
||||||
|
(on-sale goods1 market1 level1)
|
||||||
|
(on-sale goods2 market1 level1)
|
||||||
|
(on-sale goods3 market1 level1)
|
||||||
|
(at truck1 depot1))
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(stored goods1 level1)
|
||||||
|
(stored goods2 level1)
|
||||||
|
(stored goods3 level1)))
|
||||||
|
|
||||||
|
)
|
38
instances/ipc-2006-tpp-propositional/problem-04.pddl
Normal file
38
instances/ipc-2006-tpp-propositional/problem-04.pddl
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
(define (problem TPP)
|
||||||
|
(:domain TPP-Propositional)
|
||||||
|
(:objects
|
||||||
|
goods1 goods2 goods3 goods4 - goods
|
||||||
|
truck1 - truck
|
||||||
|
market1 - market
|
||||||
|
depot1 - depot
|
||||||
|
level0 level1 - level)
|
||||||
|
|
||||||
|
(:init
|
||||||
|
(next level1 level0)
|
||||||
|
(ready-to-load goods1 market1 level0)
|
||||||
|
(ready-to-load goods2 market1 level0)
|
||||||
|
(ready-to-load goods3 market1 level0)
|
||||||
|
(ready-to-load goods4 market1 level0)
|
||||||
|
(stored goods1 level0)
|
||||||
|
(stored goods2 level0)
|
||||||
|
(stored goods3 level0)
|
||||||
|
(stored goods4 level0)
|
||||||
|
(loaded goods1 truck1 level0)
|
||||||
|
(loaded goods2 truck1 level0)
|
||||||
|
(loaded goods3 truck1 level0)
|
||||||
|
(loaded goods4 truck1 level0)
|
||||||
|
(connected depot1 market1)
|
||||||
|
(connected market1 depot1)
|
||||||
|
(on-sale goods1 market1 level1)
|
||||||
|
(on-sale goods2 market1 level1)
|
||||||
|
(on-sale goods3 market1 level1)
|
||||||
|
(on-sale goods4 market1 level1)
|
||||||
|
(at truck1 depot1))
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(stored goods1 level1)
|
||||||
|
(stored goods2 level1)
|
||||||
|
(stored goods3 level1)
|
||||||
|
(stored goods4 level1)))
|
||||||
|
|
||||||
|
)
|
5
instances/ipc-2006-tpp-propositional/solutions
Normal file
5
instances/ipc-2006-tpp-propositional/solutions
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
instance | minimal horizon | #solutions with minimal horizon
|
||||||
|
============================================================
|
||||||
|
problem-02.pddl | 8 | 12
|
||||||
|
problem-03.pddl | 11 | 540
|
||||||
|
problem-04.pddl | 14 | 60480
|
@@ -6,7 +6,6 @@
|
|||||||
#include <plasp/pddl/Domain.h>
|
#include <plasp/pddl/Domain.h>
|
||||||
#include <plasp/pddl/ExpressionContext.h>
|
#include <plasp/pddl/ExpressionContext.h>
|
||||||
#include <plasp/pddl/expressions/Type.h>
|
#include <plasp/pddl/expressions/Type.h>
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
{
|
{
|
||||||
@@ -88,5 +87,13 @@ const Expression *Action::effect() const
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void Action::normalizeParameterNames()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_parameters.size(); i++)
|
||||||
|
m_parameters[i]->setName("X" + std::to_string(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -204,5 +204,12 @@ void Description::checkConsistency()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void Description::normalizeParameterNames()
|
||||||
|
{
|
||||||
|
m_domain->normalizeParameterNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include <plasp/pddl/expressions/PredicateDeclaration.h>
|
#include <plasp/pddl/expressions/PredicateDeclaration.h>
|
||||||
#include <plasp/pddl/expressions/PrimitiveType.h>
|
#include <plasp/pddl/expressions/PrimitiveType.h>
|
||||||
#include <plasp/pddl/expressions/Variable.h>
|
#include <plasp/pddl/expressions/Variable.h>
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
#include <plasp/utils/ParserException.h>
|
#include <plasp/utils/ParserException.h>
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
@@ -273,12 +272,14 @@ bool Domain::hasRequirement(Requirement::Type requirementType) const
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Domain::checkRequirement(Requirement::Type requirementType) const
|
void Domain::checkRequirement(Requirement::Type requirementType)
|
||||||
{
|
{
|
||||||
if (hasRequirement(requirementType))
|
if (hasRequirement(requirementType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw ConsistencyException("requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared");
|
m_context.logger.logWarning(m_context.parser.coordinate(), "requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared");
|
||||||
|
|
||||||
|
m_requirements.push_back(requirementType);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -414,5 +415,22 @@ void Domain::checkConsistency()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void Domain::normalizeParameterNames()
|
||||||
|
{
|
||||||
|
std::for_each(m_predicates.begin(), m_predicates.end(),
|
||||||
|
[](auto &predicate)
|
||||||
|
{
|
||||||
|
predicate->normalizeParameterNames();
|
||||||
|
});
|
||||||
|
|
||||||
|
std::for_each(m_actions.begin(), m_actions.end(),
|
||||||
|
[](auto &action)
|
||||||
|
{
|
||||||
|
action->normalizeParameterNames();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
#include <plasp/pddl/expressions/Predicate.h>
|
#include <plasp/pddl/expressions/Predicate.h>
|
||||||
#include <plasp/pddl/expressions/PredicateDeclaration.h>
|
#include <plasp/pddl/expressions/PredicateDeclaration.h>
|
||||||
#include <plasp/pddl/expressions/Unsupported.h>
|
#include <plasp/pddl/expressions/Unsupported.h>
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
#include <plasp/utils/ParserException.h>
|
#include <plasp/utils/ParserException.h>
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#include <plasp/pddl/ExpressionContext.h>
|
#include <plasp/pddl/ExpressionContext.h>
|
||||||
#include <plasp/pddl/IO.h>
|
#include <plasp/pddl/IO.h>
|
||||||
#include <plasp/pddl/expressions/Constant.h>
|
#include <plasp/pddl/expressions/Constant.h>
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
#include <plasp/utils/ParserException.h>
|
#include <plasp/utils/ParserException.h>
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
@@ -255,12 +254,14 @@ bool Problem::hasRequirement(Requirement::Type requirementType) const
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Problem::checkRequirement(Requirement::Type requirementType) const
|
void Problem::checkRequirement(Requirement::Type requirementType)
|
||||||
{
|
{
|
||||||
if (hasRequirement(requirementType))
|
if (hasRequirement(requirementType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw ConsistencyException("requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared");
|
m_context.logger.logWarning(m_context.parser.coordinate(), "requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared");
|
||||||
|
|
||||||
|
m_requirements.push_back(requirementType);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
#include <boost/assign.hpp>
|
#include <boost/assign.hpp>
|
||||||
#include <boost/bimap.hpp>
|
#include <boost/bimap.hpp>
|
||||||
|
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
#include <plasp/utils/ParserException.h>
|
#include <plasp/utils/ParserException.h>
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#include <plasp/pddl/expressions/Not.h>
|
#include <plasp/pddl/expressions/Not.h>
|
||||||
#include <plasp/pddl/expressions/Predicate.h>
|
#include <plasp/pddl/expressions/Predicate.h>
|
||||||
#include <plasp/utils/Formatting.h>
|
#include <plasp/utils/Formatting.h>
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
#include <plasp/utils/TranslatorException.h>
|
#include <plasp/utils/TranslatorException.h>
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
@@ -20,10 +19,11 @@ namespace pddl
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TranslatorASP::TranslatorASP(const Description &description, utils::LogStream &outputStream)
|
TranslatorASP::TranslatorASP(Description &description, utils::LogStream &outputStream)
|
||||||
: m_description(description),
|
: m_description(description),
|
||||||
m_outputStream(outputStream)
|
m_outputStream(outputStream)
|
||||||
{
|
{
|
||||||
|
m_description.normalizeParameterNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -86,8 +86,8 @@ void TranslatorASP::translateTypes() const
|
|||||||
if (types.empty())
|
if (types.empty())
|
||||||
{
|
{
|
||||||
m_outputStream
|
m_outputStream
|
||||||
<< utils::Keyword("type") << "("
|
<< utils::RuleName("type") << "("
|
||||||
<< utils::Keyword("type") << "(object))." << std::endl;
|
<< utils::Keyword("type") << "(" << utils::String("object") << "))." << std::endl;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -95,31 +95,36 @@ void TranslatorASP::translateTypes() const
|
|||||||
std::for_each(types.cbegin(), types.cend(),
|
std::for_each(types.cbegin(), types.cend(),
|
||||||
[&](const auto &type)
|
[&](const auto &type)
|
||||||
{
|
{
|
||||||
const auto typeName = utils::escapeASP(type->name());
|
|
||||||
|
|
||||||
m_outputStream
|
m_outputStream
|
||||||
|
<< utils::RuleName("type") << "("
|
||||||
<< utils::Keyword("type") << "("
|
<< utils::Keyword("type") << "("
|
||||||
<< utils::Keyword("type") << "("
|
<< utils::String(type->name())
|
||||||
<< typeName << "))." << std::endl;
|
<< "))." << std::endl;
|
||||||
|
|
||||||
const auto &parentTypes = type->parentTypes();
|
const auto &parentTypes = type->parentTypes();
|
||||||
|
|
||||||
std::for_each(parentTypes.cbegin(), parentTypes.cend(),
|
std::for_each(parentTypes.cbegin(), parentTypes.cend(),
|
||||||
[&](const auto &parentType)
|
[&](const auto &parentType)
|
||||||
{
|
{
|
||||||
const auto parentTypeName = utils::escapeASP(parentType->name());
|
|
||||||
|
|
||||||
m_outputStream
|
m_outputStream
|
||||||
<< utils::Keyword("inherits") << "(" << utils::Keyword("type")
|
<< utils::RuleName("inherits") << "(" << utils::Keyword("type")
|
||||||
<< "(" << typeName << "), " << utils::Keyword("type")
|
<< "(" << utils::String(type->name()) << "), " << utils::Keyword("type")
|
||||||
<< "(" << parentTypeName << "))." << std::endl
|
<< "(" << utils::String(parentType->name()) << "))." << std::endl;
|
||||||
|
|
||||||
<< utils::Keyword("has") << "(" << utils::Variable("X") << ", "
|
|
||||||
<< utils::Keyword("type") << "(" << parentTypeName << ")) :- "
|
|
||||||
<< utils::Keyword("has") << "(" << utils::Variable("X") << ", "
|
|
||||||
<< utils::Keyword("type") << "(" << typeName << "))." << std::endl;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
m_outputStream
|
||||||
|
<< std::endl
|
||||||
|
<< utils::RuleName("has") << "("
|
||||||
|
<< utils::Variable("X") << ", "
|
||||||
|
<< utils::Keyword("type") << "(" << utils::Variable("T2") << ")) :- "
|
||||||
|
<< utils::RuleName("has") << "("
|
||||||
|
<< utils::Variable("X") << ", "
|
||||||
|
<< utils::Keyword("type") << "(" << utils::Variable("T1") << ")), "
|
||||||
|
<< utils::RuleName("inherits") << "("
|
||||||
|
<< utils::Keyword("type") << "(" << utils::Variable("T1") << "), "
|
||||||
|
<< utils::Keyword("type") << "(" << utils::Variable("T2") << "))."
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -133,31 +138,16 @@ void TranslatorASP::translatePredicates() const
|
|||||||
const auto printPredicateName =
|
const auto printPredicateName =
|
||||||
[&](const auto &predicate)
|
[&](const auto &predicate)
|
||||||
{
|
{
|
||||||
m_outputStream
|
if (predicate->arguments().empty())
|
||||||
<< utils::escapeASP(predicate->name());
|
{
|
||||||
|
m_outputStream << utils::String(predicate->name());
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_outputStream << "(" << utils::String(predicate->name());
|
||||||
this->translateVariablesHead(predicate->arguments());
|
this->translateVariablesHead(predicate->arguments());
|
||||||
};
|
m_outputStream << ")";
|
||||||
|
|
||||||
const auto printValueRule =
|
|
||||||
[&](const auto &predicate, const auto &value)
|
|
||||||
{
|
|
||||||
m_outputStream
|
|
||||||
<< utils::Keyword("contains") << "("
|
|
||||||
<< utils::Keyword("variable") << "(";
|
|
||||||
|
|
||||||
printPredicateName(predicate);
|
|
||||||
|
|
||||||
m_outputStream
|
|
||||||
<< "), " << utils::Keyword("value") << "(";
|
|
||||||
|
|
||||||
printPredicateName(predicate);
|
|
||||||
|
|
||||||
m_outputStream << ", " << utils::Keyword(value) << "))";
|
|
||||||
|
|
||||||
this->translateVariablesBody(predicate->arguments());
|
|
||||||
|
|
||||||
m_outputStream << "." << std::endl;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::for_each(predicates.cbegin(), predicates.cend(),
|
std::for_each(predicates.cbegin(), predicates.cend(),
|
||||||
@@ -165,7 +155,7 @@ void TranslatorASP::translatePredicates() const
|
|||||||
{
|
{
|
||||||
m_outputStream
|
m_outputStream
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< utils::Keyword("variable") << "("
|
<< utils::RuleName("variable") << "("
|
||||||
<< utils::Keyword("variable") << "(";
|
<< utils::Keyword("variable") << "(";
|
||||||
|
|
||||||
printPredicateName(predicate);
|
printPredicateName(predicate);
|
||||||
@@ -174,11 +164,20 @@ void TranslatorASP::translatePredicates() const
|
|||||||
|
|
||||||
this->translateVariablesBody(predicate->arguments());
|
this->translateVariablesBody(predicate->arguments());
|
||||||
|
|
||||||
m_outputStream << "." << std::endl;
|
m_outputStream << ".";
|
||||||
|
|
||||||
printValueRule(predicate, "true");
|
|
||||||
printValueRule(predicate, "false");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
m_outputStream
|
||||||
|
<< std::endl << std::endl
|
||||||
|
<< utils::RuleName("boolean") << "(" << utils::Boolean("true") << ")." << std::endl
|
||||||
|
<< utils::RuleName("boolean") << "(" << utils::Boolean("false") << ")." << std::endl
|
||||||
|
<< std::endl
|
||||||
|
<< utils::RuleName("contains") << "("
|
||||||
|
<< utils::Keyword("variable") << "(" << utils::Variable("X") << "), "
|
||||||
|
<< utils::Keyword("value") << "(" << utils::Variable("X") << ", " << utils::Variable("B") << ")) :- "
|
||||||
|
<< utils::RuleName("variable") << "(" << utils::Keyword("variable") << "(" << utils::Variable("X") << ")), "
|
||||||
|
<< utils::RuleName("boolean") << "(" << utils::Variable("B") << ")."
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -192,11 +191,18 @@ void TranslatorASP::translateActions() const
|
|||||||
const auto printActionName =
|
const auto printActionName =
|
||||||
[&](const auto &action)
|
[&](const auto &action)
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("action") << "(" << utils::escapeASP(action.name());
|
m_outputStream << utils::Keyword("action") << "(";
|
||||||
|
|
||||||
|
if (action.parameters().empty())
|
||||||
|
{
|
||||||
|
m_outputStream << utils::String(action.name()) << ")";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_outputStream << "(" << utils::String(action.name());
|
||||||
this->translateVariablesHead(action.parameters());
|
this->translateVariablesHead(action.parameters());
|
||||||
|
m_outputStream << "))";
|
||||||
m_outputStream << ")";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::for_each(actions.cbegin(), actions.cend(),
|
std::for_each(actions.cbegin(), actions.cend(),
|
||||||
@@ -206,19 +212,19 @@ void TranslatorASP::translateActions() const
|
|||||||
const auto translateLiteral =
|
const auto translateLiteral =
|
||||||
[&](const auto &ruleHead, const auto &literal, bool enumerateEffects = false)
|
[&](const auto &ruleHead, const auto &literal, bool enumerateEffects = false)
|
||||||
{
|
{
|
||||||
m_outputStream << std::endl << utils::Keyword(ruleHead) << "(";
|
m_outputStream << std::endl << utils::RuleName(ruleHead) << "(";
|
||||||
|
|
||||||
printActionName(*action);
|
printActionName(*action);
|
||||||
|
|
||||||
// TODO: implement conditional effects
|
// TODO: implement conditional effects
|
||||||
if (enumerateEffects)
|
if (enumerateEffects)
|
||||||
m_outputStream << ", " << utils::Keyword("effect") << "(unconditional)";
|
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Reserved("unconditional") << ")";
|
||||||
|
|
||||||
m_outputStream << ", ";
|
m_outputStream << ", ";
|
||||||
|
|
||||||
this->translateLiteral(literal);
|
this->translateLiteral(literal);
|
||||||
|
|
||||||
m_outputStream << ") :- " << utils::Keyword("action") << "(";
|
m_outputStream << ") :- " << utils::RuleName("action") << "(";
|
||||||
|
|
||||||
printActionName(*action);
|
printActionName(*action);
|
||||||
|
|
||||||
@@ -228,7 +234,7 @@ void TranslatorASP::translateActions() const
|
|||||||
m_outputStream << std::endl;
|
m_outputStream << std::endl;
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
m_outputStream << utils::Keyword("action") << "(";
|
m_outputStream << utils::RuleName("action") << "(";
|
||||||
printActionName(*action);
|
printActionName(*action);
|
||||||
m_outputStream << ")";
|
m_outputStream << ")";
|
||||||
|
|
||||||
@@ -301,27 +307,25 @@ void TranslatorASP::translateConstants(const std::string &heading, const express
|
|||||||
std::for_each(constants.cbegin(), constants.cend(),
|
std::for_each(constants.cbegin(), constants.cend(),
|
||||||
[&](const auto &constant)
|
[&](const auto &constant)
|
||||||
{
|
{
|
||||||
const auto constantName = utils::escapeASP(constant->name());
|
|
||||||
|
|
||||||
m_outputStream << std::endl
|
m_outputStream << std::endl
|
||||||
|
<< utils::RuleName("constant") << "("
|
||||||
<< utils::Keyword("constant") << "("
|
<< utils::Keyword("constant") << "("
|
||||||
<< utils::Keyword("constant") << "("
|
<< utils::String(constant->name())
|
||||||
<< constantName
|
|
||||||
<< "))." << std::endl;
|
<< "))." << std::endl;
|
||||||
|
|
||||||
const auto *type = constant->type();
|
const auto *type = constant->type();
|
||||||
|
|
||||||
if (type != nullptr)
|
if (type != nullptr)
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("has") << "("
|
m_outputStream << utils::RuleName("has") << "("
|
||||||
<< utils::Keyword("constant") << "(" << constantName << "), "
|
<< utils::Keyword("constant") << "(" << utils::String(constant->name()) << "), "
|
||||||
<< utils::Keyword("type") << "(" << utils::escapeASP(type->name()) << "))." << std::endl;
|
<< utils::Keyword("type") << "(" << utils::String(type->name()) << "))." << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("has") << "("
|
m_outputStream << utils::RuleName("has") << "("
|
||||||
<< utils::Keyword("constant") << "(" << constantName << "), "
|
<< utils::Keyword("constant") << "(" << utils::String(constant->name()) << "), "
|
||||||
<< utils::Keyword("type") << "(object))." << std::endl;
|
<< utils::Keyword("type") << "(" << utils::String("object") << "))." << std::endl;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -333,19 +337,12 @@ void TranslatorASP::translateVariablesHead(const expressions::Variables &variabl
|
|||||||
if (variables.empty())
|
if (variables.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_outputStream << "(";
|
|
||||||
|
|
||||||
for (auto i = variables.cbegin(); i != variables.cend(); i++)
|
for (auto i = variables.cbegin(); i != variables.cend(); i++)
|
||||||
{
|
{
|
||||||
if (i != variables.cbegin())
|
|
||||||
m_outputStream << ", ";
|
|
||||||
|
|
||||||
const auto &variable = **i;
|
const auto &variable = **i;
|
||||||
|
|
||||||
m_outputStream << utils::Variable(utils::escapeASPVariable(variable.name()));
|
m_outputStream << ", " << utils::Variable(variable.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_outputStream << ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -371,15 +368,15 @@ void TranslatorASP::translateVariablesBody(const expressions::Variables &variabl
|
|||||||
|
|
||||||
const auto &type = *dynamic_cast<const expressions::PrimitiveType *>(variable.type());
|
const auto &type = *dynamic_cast<const expressions::PrimitiveType *>(variable.type());
|
||||||
|
|
||||||
m_outputStream << utils::Keyword("has") << "("
|
m_outputStream << utils::RuleName("has") << "("
|
||||||
<< utils::Variable(utils::escapeASPVariable(variable.name())) << ", "
|
<< utils::Variable(variable.name()) << ", "
|
||||||
<< utils::Keyword("type") << "(" << utils::escapeASP(type.name()) << "))";
|
<< utils::Keyword("type") << "(" << utils::String(type.name()) << "))";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("has") << "("
|
m_outputStream << utils::RuleName("has") << "("
|
||||||
<< utils::Variable(utils::escapeASPVariable(variable.name())) << ", "
|
<< utils::Variable(variable.name()) << ", "
|
||||||
<< utils::Keyword("type") << "(object))";
|
<< utils::Keyword("type") << "(" << utils::String("object") << "))";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,19 +394,23 @@ void TranslatorASP::translateLiteral(const Expression &literal) const
|
|||||||
this->translatePredicate(predicate);
|
this->translatePredicate(predicate);
|
||||||
m_outputStream << "), " << utils::Keyword("value") << "(";
|
m_outputStream << "), " << utils::Keyword("value") << "(";
|
||||||
this->translatePredicate(predicate);
|
this->translatePredicate(predicate);
|
||||||
m_outputStream << ", " << utils::Keyword("true") << ")";
|
m_outputStream << ", " << utils::Boolean("true") << ")";
|
||||||
}
|
}
|
||||||
// Assuming that "not" expression may only contain a predicate
|
// Assuming that "not" expression may only contain a predicate
|
||||||
else if (literal.expressionType() == Expression::Type::Not)
|
else if (literal.expressionType() == Expression::Type::Not)
|
||||||
{
|
{
|
||||||
const auto ¬Expression = dynamic_cast<const expressions::Not &>(literal);
|
const auto ¬Expression = dynamic_cast<const expressions::Not &>(literal);
|
||||||
|
|
||||||
|
if (notExpression.argument()->expressionType() != Expression::Type::Predicate)
|
||||||
|
throw utils::TranslatorException("only negations of primitive predicates supported as literals currently");
|
||||||
|
|
||||||
const auto &predicate = dynamic_cast<const expressions::Predicate &>(*notExpression.argument());
|
const auto &predicate = dynamic_cast<const expressions::Predicate &>(*notExpression.argument());
|
||||||
|
|
||||||
m_outputStream << utils::Keyword("variable") << "(";
|
m_outputStream << utils::Keyword("variable") << "(";
|
||||||
this->translatePredicate(predicate);
|
this->translatePredicate(predicate);
|
||||||
m_outputStream << "), " << utils::Keyword("value") << "(";
|
m_outputStream << "), " << utils::Keyword("value") << "(";
|
||||||
this->translatePredicate(predicate);
|
this->translatePredicate(predicate);
|
||||||
m_outputStream << ", " << utils::Keyword("false") << ")";
|
m_outputStream << ", " << utils::Boolean("false") << ")";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw utils::TranslatorException("only primitive predicates and their negations supported as literals currently");
|
throw utils::TranslatorException("only primitive predicates and their negations supported as literals currently");
|
||||||
@@ -419,33 +420,32 @@ void TranslatorASP::translateLiteral(const Expression &literal) const
|
|||||||
|
|
||||||
void TranslatorASP::translatePredicate(const expressions::Predicate &predicate) const
|
void TranslatorASP::translatePredicate(const expressions::Predicate &predicate) const
|
||||||
{
|
{
|
||||||
m_outputStream << utils::escapeASP(predicate.name());
|
|
||||||
|
|
||||||
const auto &arguments = predicate.arguments();
|
const auto &arguments = predicate.arguments();
|
||||||
|
|
||||||
if (arguments.empty())
|
if (arguments.empty())
|
||||||
{
|
{
|
||||||
|
m_outputStream << utils::String(predicate.name());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_outputStream << "(";
|
m_outputStream << "(" << utils::String(predicate.name());
|
||||||
|
|
||||||
for (auto i = arguments.cbegin(); i != arguments.cend(); i++)
|
for (auto i = arguments.cbegin(); i != arguments.cend(); i++)
|
||||||
{
|
{
|
||||||
if (i != arguments.cbegin())
|
m_outputStream << ", ";
|
||||||
m_outputStream << ", ";
|
|
||||||
|
|
||||||
if ((*i)->expressionType() == Expression::Type::Constant)
|
if ((*i)->expressionType() == Expression::Type::Constant)
|
||||||
{
|
{
|
||||||
const auto &constant = dynamic_cast<const expressions::Constant &>(**i);
|
const auto &constant = dynamic_cast<const expressions::Constant &>(**i);
|
||||||
|
|
||||||
m_outputStream << utils::Keyword("constant") << "(" << utils::escapeASP(constant.name()) << ")";
|
m_outputStream << utils::Keyword("constant") << "(" << utils::String(constant.name()) << ")";
|
||||||
}
|
}
|
||||||
else if ((*i)->expressionType() == Expression::Type::Variable)
|
else if ((*i)->expressionType() == Expression::Type::Variable)
|
||||||
{
|
{
|
||||||
const auto &variable = dynamic_cast<const expressions::Variable &>(**i);
|
const auto &variable = dynamic_cast<const expressions::Variable &>(**i);
|
||||||
|
|
||||||
m_outputStream << utils::Variable(utils::escapeASPVariable(variable.name()));
|
m_outputStream << utils::Variable(variable.name());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw utils::TranslatorException("only variables and constants supported in predicates currently");
|
throw utils::TranslatorException("only variables and constants supported in predicates currently");
|
||||||
@@ -493,7 +493,7 @@ void TranslatorASP::translateInitialState() const
|
|||||||
std::for_each(initialStateFacts.cbegin(), initialStateFacts.cend(),
|
std::for_each(initialStateFacts.cbegin(), initialStateFacts.cend(),
|
||||||
[&](const auto &fact)
|
[&](const auto &fact)
|
||||||
{
|
{
|
||||||
m_outputStream << std::endl << utils::Keyword("initialState") << "(";
|
m_outputStream << std::endl << utils::RuleName("initialState") << "(";
|
||||||
|
|
||||||
// Translate single predicate
|
// Translate single predicate
|
||||||
if (fact->expressionType() == Expression::Type::Predicate)
|
if (fact->expressionType() == Expression::Type::Predicate)
|
||||||
@@ -504,7 +504,7 @@ void TranslatorASP::translateInitialState() const
|
|||||||
this->translatePredicate(predicate);
|
this->translatePredicate(predicate);
|
||||||
m_outputStream << "), " << utils::Keyword("value") << "(";
|
m_outputStream << "), " << utils::Keyword("value") << "(";
|
||||||
this->translatePredicate(predicate);
|
this->translatePredicate(predicate);
|
||||||
m_outputStream << ", " << utils::Keyword("true") << ")";
|
m_outputStream << ", " << utils::Boolean("true") << ")";
|
||||||
}
|
}
|
||||||
// Assuming that "not" expression may only contain a predicate
|
// Assuming that "not" expression may only contain a predicate
|
||||||
else if (fact->expressionType() == Expression::Type::Not)
|
else if (fact->expressionType() == Expression::Type::Not)
|
||||||
@@ -520,7 +520,17 @@ void TranslatorASP::translateInitialState() const
|
|||||||
m_outputStream << ").";
|
m_outputStream << ").";
|
||||||
});
|
});
|
||||||
|
|
||||||
m_outputStream << std::endl;
|
m_outputStream
|
||||||
|
<< std::endl << std::endl
|
||||||
|
<< utils::RuleName("initialState") << "("
|
||||||
|
<< utils::Keyword("variable") << "(" << utils::Variable("X") << "), "
|
||||||
|
<< utils::Keyword("value") << "(" << utils::Variable("X") << ", " << utils::Boolean("false") << ")) :- "
|
||||||
|
<< utils::RuleName("variable") << "(" << utils::Keyword("variable") << "(" << utils::Variable("X") << ")), "
|
||||||
|
<< utils::Keyword("not") << " "
|
||||||
|
<< utils::RuleName("initialState") << "("
|
||||||
|
<< utils::Keyword("variable") << "(" << utils::Variable("X") << "), "
|
||||||
|
<< utils::Keyword("value") << "(" << utils::Variable("X") << ", " << utils::Boolean("true") << "))."
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -536,7 +546,7 @@ void TranslatorASP::translateGoal() const
|
|||||||
if (goal.expressionType() == Expression::Type::Predicate
|
if (goal.expressionType() == Expression::Type::Predicate
|
||||||
|| goal.expressionType() == Expression::Type::Not)
|
|| goal.expressionType() == Expression::Type::Not)
|
||||||
{
|
{
|
||||||
m_outputStream << std::endl << utils::Keyword("goal") << "(";
|
m_outputStream << std::endl << utils::RuleName("goal") << "(";
|
||||||
|
|
||||||
translateLiteral(goal);
|
translateLiteral(goal);
|
||||||
|
|
||||||
@@ -549,7 +559,7 @@ void TranslatorASP::translateGoal() const
|
|||||||
std::for_each(andExpression.arguments().cbegin(), andExpression.arguments().cend(),
|
std::for_each(andExpression.arguments().cbegin(), andExpression.arguments().cend(),
|
||||||
[&](const auto *argument)
|
[&](const auto *argument)
|
||||||
{
|
{
|
||||||
m_outputStream << std::endl << utils::Keyword("goal") << "(";
|
m_outputStream << std::endl << utils::RuleName("goal") << "(";
|
||||||
|
|
||||||
this->translateLiteral(*argument);
|
this->translateLiteral(*argument);
|
||||||
|
|
||||||
|
@@ -79,6 +79,14 @@ const Variables &PredicateDeclaration::arguments() const
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void PredicateDeclaration::normalizeParameterNames()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_parameters.size(); i++)
|
||||||
|
m_parameters[i]->setName("X" + std::to_string(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -164,6 +164,13 @@ const Variable *Variable::parseAndFind(Context &context, const ExpressionContext
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void Variable::setName(std::string name)
|
||||||
|
{
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
const std::string &Variable::name() const
|
const std::string &Variable::name() const
|
||||||
{
|
{
|
||||||
return m_name;
|
return m_name;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <plasp/utils/IO.h>
|
#include <plasp/utils/Formatting.h>
|
||||||
#include <plasp/utils/ParserException.h>
|
#include <plasp/utils/ParserException.h>
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
@@ -91,19 +91,14 @@ void Predicate::printAsASP(utils::LogStream &outputStream) const
|
|||||||
{
|
{
|
||||||
if (m_arguments.empty())
|
if (m_arguments.empty())
|
||||||
{
|
{
|
||||||
outputStream << utils::escapeASP(m_name);
|
outputStream << utils::String(m_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream << utils::escapeASP(m_name) << "(";
|
outputStream << "(" << utils::String(m_name);
|
||||||
|
|
||||||
for (size_t i = 0; i < m_arguments.size(); i++)
|
for (size_t i = 0; i < m_arguments.size(); i++)
|
||||||
{
|
outputStream << ", " << utils::String(m_arguments[i]);
|
||||||
if (i > 0)
|
|
||||||
outputStream << ", ";
|
|
||||||
|
|
||||||
outputStream << utils::escapeASP(m_arguments[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
outputStream << ")";
|
outputStream << ")";
|
||||||
}
|
}
|
||||||
|
@@ -55,13 +55,13 @@ void TranslatorASP::translateRequirements() const
|
|||||||
m_outputStream << utils::Heading2("feature requirements") << std::endl;
|
m_outputStream << utils::Heading2("feature requirements") << std::endl;
|
||||||
|
|
||||||
if (m_description.usesActionCosts())
|
if (m_description.usesActionCosts())
|
||||||
m_outputStream << utils::Keyword("requires") << "(" << utils::Keyword("feature") << "(actionCosts))." << std::endl;
|
m_outputStream << utils::RuleName("requires") << "(" << utils::Keyword("feature") << "(" << utils::Reserved("actionCosts") << "))." << std::endl;
|
||||||
|
|
||||||
if (m_description.usesAxiomRules())
|
if (m_description.usesAxiomRules())
|
||||||
m_outputStream << utils::Keyword("requires") << "(" << utils::Keyword("feature") << "(axiomRules))." << std::endl;
|
m_outputStream << utils::RuleName("requires") << "(" << utils::Keyword("feature") << "(" << utils::Reserved("axiomRules") << "))." << std::endl;
|
||||||
|
|
||||||
if (m_description.usesConditionalEffects())
|
if (m_description.usesConditionalEffects())
|
||||||
m_outputStream << utils::Keyword("requires") << "(" << utils::Keyword("feature") << "(conditionalEffects))." << std::endl;
|
m_outputStream << utils::RuleName("requires") << "(" << utils::Keyword("feature") << "(" << utils::Reserved("conditionalEffects") << "))." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -75,7 +75,7 @@ void TranslatorASP::translateInitialState() const
|
|||||||
std::for_each(initialStateFacts.cbegin(), initialStateFacts.cend(),
|
std::for_each(initialStateFacts.cbegin(), initialStateFacts.cend(),
|
||||||
[&](const auto &fact)
|
[&](const auto &fact)
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("initialState") << "(";
|
m_outputStream << utils::RuleName("initialState") << "(";
|
||||||
fact.variable().printNameAsASPPredicate(m_outputStream);
|
fact.variable().printNameAsASPPredicate(m_outputStream);
|
||||||
m_outputStream << ", ";
|
m_outputStream << ", ";
|
||||||
fact.value().printAsASPPredicate(m_outputStream);
|
fact.value().printAsASPPredicate(m_outputStream);
|
||||||
@@ -94,7 +94,7 @@ void TranslatorASP::translateGoal() const
|
|||||||
std::for_each(goalFacts.cbegin(), goalFacts.cend(),
|
std::for_each(goalFacts.cbegin(), goalFacts.cend(),
|
||||||
[&](const auto &fact)
|
[&](const auto &fact)
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("goal") << "(";
|
m_outputStream << utils::RuleName("goal") << "(";
|
||||||
fact.variable().printNameAsASPPredicate(m_outputStream);
|
fact.variable().printNameAsASPPredicate(m_outputStream);
|
||||||
m_outputStream << ", ";
|
m_outputStream << ", ";
|
||||||
fact.value().printAsASPPredicate(m_outputStream);
|
fact.value().printAsASPPredicate(m_outputStream);
|
||||||
@@ -117,14 +117,14 @@ void TranslatorASP::translateVariables() const
|
|||||||
|
|
||||||
BOOST_ASSERT(!values.empty());
|
BOOST_ASSERT(!values.empty());
|
||||||
|
|
||||||
m_outputStream << std::endl << utils::Keyword("variable") << "(";
|
m_outputStream << std::endl << utils::RuleName("variable") << "(";
|
||||||
variable.printNameAsASPPredicate(m_outputStream);
|
variable.printNameAsASPPredicate(m_outputStream);
|
||||||
m_outputStream << ")." << std::endl;
|
m_outputStream << ")." << std::endl;
|
||||||
|
|
||||||
std::for_each(values.cbegin(), values.cend(),
|
std::for_each(values.cbegin(), values.cend(),
|
||||||
[&](const auto &value)
|
[&](const auto &value)
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("contains") << "(";
|
m_outputStream << utils::RuleName("contains") << "(";
|
||||||
variable.printNameAsASPPredicate(m_outputStream);
|
variable.printNameAsASPPredicate(m_outputStream);
|
||||||
m_outputStream << ", ";
|
m_outputStream << ", ";
|
||||||
value.printAsASPPredicate(m_outputStream);
|
value.printAsASPPredicate(m_outputStream);
|
||||||
@@ -146,7 +146,7 @@ void TranslatorASP::translateActions() const
|
|||||||
std::for_each(operators.cbegin(), operators.cend(),
|
std::for_each(operators.cbegin(), operators.cend(),
|
||||||
[&](const auto &operator_)
|
[&](const auto &operator_)
|
||||||
{
|
{
|
||||||
m_outputStream << std::endl << utils::Keyword("action") << "(";
|
m_outputStream << std::endl << utils::RuleName("action") << "(";
|
||||||
operator_.printPredicateAsASP(m_outputStream);
|
operator_.printPredicateAsASP(m_outputStream);
|
||||||
m_outputStream << ")." << std::endl;
|
m_outputStream << ")." << std::endl;
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ void TranslatorASP::translateActions() const
|
|||||||
std::for_each(preconditions.cbegin(), preconditions.cend(),
|
std::for_each(preconditions.cbegin(), preconditions.cend(),
|
||||||
[&](const auto &precondition)
|
[&](const auto &precondition)
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("precondition") << "(";
|
m_outputStream << utils::RuleName("precondition") << "(";
|
||||||
operator_.printPredicateAsASP(m_outputStream);
|
operator_.printPredicateAsASP(m_outputStream);
|
||||||
m_outputStream << ", ";
|
m_outputStream << ", ";
|
||||||
precondition.variable().printNameAsASPPredicate(m_outputStream);
|
precondition.variable().printNameAsASPPredicate(m_outputStream);
|
||||||
@@ -175,7 +175,7 @@ void TranslatorASP::translateActions() const
|
|||||||
[&](const auto &condition)
|
[&](const auto &condition)
|
||||||
{
|
{
|
||||||
// Conditions of conditional effects
|
// Conditions of conditional effects
|
||||||
m_outputStream << utils::Keyword("precondition") << "(";
|
m_outputStream << utils::RuleName("precondition") << "(";
|
||||||
operator_.printPredicateAsASP(m_outputStream);
|
operator_.printPredicateAsASP(m_outputStream);
|
||||||
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), ";
|
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), ";
|
||||||
condition.variable().printNameAsASPPredicate(m_outputStream);
|
condition.variable().printNameAsASPPredicate(m_outputStream);
|
||||||
@@ -184,11 +184,11 @@ void TranslatorASP::translateActions() const
|
|||||||
m_outputStream << ")." << std::endl;
|
m_outputStream << ")." << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
m_outputStream << utils::Keyword("postcondition") << "(";
|
m_outputStream << utils::RuleName("postcondition") << "(";
|
||||||
operator_.printPredicateAsASP(m_outputStream);
|
operator_.printPredicateAsASP(m_outputStream);
|
||||||
|
|
||||||
if (conditions.empty())
|
if (conditions.empty())
|
||||||
m_outputStream << ", " << utils::Keyword("effect") << "(unconditional), ";
|
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Reserved("unconditional") << "), ";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), ";
|
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number(std::to_string(currentEffectID)) << "), ";
|
||||||
@@ -201,9 +201,9 @@ void TranslatorASP::translateActions() const
|
|||||||
m_outputStream << ")." << std::endl;
|
m_outputStream << ")." << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
m_outputStream << utils::Keyword("costs") << "(";
|
m_outputStream << utils::RuleName("costs") << "(";
|
||||||
operator_.printPredicateAsASP(m_outputStream);
|
operator_.printPredicateAsASP(m_outputStream);
|
||||||
m_outputStream << ", " << operator_.costs() << ")." << std::endl;
|
m_outputStream << ", " << utils::Number(std::to_string(operator_.costs())) << ")." << std::endl;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ void TranslatorASP::translateMutexes() const
|
|||||||
|
|
||||||
m_outputStream
|
m_outputStream
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< utils::Keyword("mutexGroup") << "("
|
<< utils::RuleName("mutexGroup") << "("
|
||||||
<< utils::Keyword("mutexGroup") << "("
|
<< utils::Keyword("mutexGroup") << "("
|
||||||
<< utils::Number(mutexGroupID)
|
<< utils::Number(mutexGroupID)
|
||||||
<< "))." << std::endl;
|
<< "))." << std::endl;
|
||||||
@@ -235,7 +235,7 @@ void TranslatorASP::translateMutexes() const
|
|||||||
std::for_each(facts.cbegin(), facts.cend(),
|
std::for_each(facts.cbegin(), facts.cend(),
|
||||||
[&](const auto &fact)
|
[&](const auto &fact)
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("contains") << "(" << utils::Keyword("mutexGroup") << "(" << utils::Number(mutexGroupID) << "), ";
|
m_outputStream << utils::RuleName("contains") << "(" << utils::Keyword("mutexGroup") << "(" << utils::Number(mutexGroupID) << "), ";
|
||||||
fact.variable().printNameAsASPPredicate(m_outputStream);
|
fact.variable().printNameAsASPPredicate(m_outputStream);
|
||||||
m_outputStream << ", ";
|
m_outputStream << ", ";
|
||||||
fact.value().printAsASPPredicate(m_outputStream);
|
fact.value().printAsASPPredicate(m_outputStream);
|
||||||
@@ -262,7 +262,7 @@ void TranslatorASP::translateAxiomRules() const
|
|||||||
|
|
||||||
m_outputStream
|
m_outputStream
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< utils::Keyword("axiomRule") << "("
|
<< utils::RuleName("axiomRule") << "("
|
||||||
<< utils::Keyword("axiomRule") << "("
|
<< utils::Keyword("axiomRule") << "("
|
||||||
<< utils::Number(axiomRuleID)
|
<< utils::Number(axiomRuleID)
|
||||||
<< "))." << std::endl;
|
<< "))." << std::endl;
|
||||||
@@ -272,7 +272,9 @@ void TranslatorASP::translateAxiomRules() const
|
|||||||
std::for_each(conditions.cbegin(), conditions.cend(),
|
std::for_each(conditions.cbegin(), conditions.cend(),
|
||||||
[&](const auto &condition)
|
[&](const auto &condition)
|
||||||
{
|
{
|
||||||
m_outputStream << utils::Keyword("precondition") << "(" << utils::Keyword("axiomRule") << "(" << utils::Number(axiomRuleID) << "), ";
|
m_outputStream
|
||||||
|
<< utils::RuleName("precondition") << "("
|
||||||
|
<< utils::Keyword("axiomRule") << "(" << utils::Number(axiomRuleID) << "), ";
|
||||||
condition.variable().printNameAsASPPredicate(m_outputStream);
|
condition.variable().printNameAsASPPredicate(m_outputStream);
|
||||||
m_outputStream << ", ";
|
m_outputStream << ", ";
|
||||||
condition.value().printAsASPPredicate(m_outputStream);
|
condition.value().printAsASPPredicate(m_outputStream);
|
||||||
@@ -281,7 +283,10 @@ void TranslatorASP::translateAxiomRules() const
|
|||||||
|
|
||||||
const auto &postcondition = axiomRule.postcondition();
|
const auto &postcondition = axiomRule.postcondition();
|
||||||
|
|
||||||
m_outputStream << utils::Keyword("postcondition") << "(" << utils::Keyword("axiomRule") << "(" << utils::Number(axiomRuleID) << "), ";
|
m_outputStream
|
||||||
|
<< utils::RuleName("postcondition") << "("
|
||||||
|
<< utils::Keyword("axiomRule") << "(" << utils::Number(axiomRuleID) << "), "
|
||||||
|
<< utils::Keyword("effect") << "(" << utils::Reserved("unconditional") << "), ";
|
||||||
postcondition.variable().printNameAsASPPredicate(m_outputStream);
|
postcondition.variable().printNameAsASPPredicate(m_outputStream);
|
||||||
m_outputStream << ", ";
|
m_outputStream << ", ";
|
||||||
postcondition.value().printAsASPPredicate(m_outputStream);
|
postcondition.value().printAsASPPredicate(m_outputStream);
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <plasp/sas/Variable.h>
|
#include <plasp/sas/Variable.h>
|
||||||
#include <plasp/utils/Formatting.h>
|
#include <plasp/utils/Formatting.h>
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
#include <plasp/utils/ParserException.h>
|
#include <plasp/utils/ParserException.h>
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
@@ -128,27 +127,17 @@ const std::string &Value::name() const
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Value::printAsASP(utils::LogStream &outputStream) const
|
|
||||||
{
|
|
||||||
if (m_sign == Value::Sign::Negative)
|
|
||||||
outputStream << utils::Keyword("not") << " ";
|
|
||||||
|
|
||||||
outputStream << utils::escapeASP(m_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void Value::printAsASPPredicate(utils::LogStream &outputStream) const
|
void Value::printAsASPPredicate(utils::LogStream &outputStream) const
|
||||||
{
|
{
|
||||||
// TODO: do not compare by value
|
// TODO: do not compare by value
|
||||||
if (*this == Value::None)
|
if (*this == Value::None)
|
||||||
{
|
{
|
||||||
outputStream << utils::Keyword("value") << "(" << utils::Keyword("none") << ")";
|
outputStream << utils::Keyword("value") << "(" << utils::Reserved("none") << ")";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream << utils::Keyword("value") << "(" << utils::escapeASP(m_name) << ", "
|
outputStream << utils::Keyword("value") << "(" << utils::String(m_name) << ", "
|
||||||
<< (m_sign == Sign::Positive ? utils::Keyword("true") : utils::Keyword("false")) << ")";
|
<< (m_sign == Sign::Positive ? utils::Boolean("true") : utils::Boolean("false")) << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <plasp/utils/Formatting.h>
|
#include <plasp/utils/Formatting.h>
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
#include <plasp/utils/ParserException.h>
|
#include <plasp/utils/ParserException.h>
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
@@ -55,7 +54,8 @@ Variable Variable::fromSAS(utils::Parser<> &parser)
|
|||||||
|
|
||||||
void Variable::printNameAsASPPredicate(utils::LogStream &outputStream) const
|
void Variable::printNameAsASPPredicate(utils::LogStream &outputStream) const
|
||||||
{
|
{
|
||||||
outputStream << utils::Keyword("variable") << "(" << utils::Number(utils::escapeASP(m_name)) << ")";
|
// TODO: assert that name is a number indeed
|
||||||
|
outputStream << utils::Keyword("variable") << "(" << utils::Number(m_name) << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@@ -15,7 +15,16 @@ boost::iostreams::stream<boost::iostreams::null_sink> nullStream((boost::iostrea
|
|||||||
TEST(PDDLTranslationTests, CheckIssues)
|
TEST(PDDLTranslationTests, CheckIssues)
|
||||||
{
|
{
|
||||||
// Check that translating domains without typing information works
|
// Check that translating domains without typing information works
|
||||||
auto description = Description::fromFile("data/issues/issue-4.pddl");
|
{
|
||||||
const auto translator = TranslatorASP(description, description.context().logger.outputStream());
|
auto description = Description::fromFile("data/issues/issue-4.pddl");
|
||||||
ASSERT_NO_THROW(translator.translate());
|
const auto translator = TranslatorASP(description, description.context().logger.outputStream());
|
||||||
|
ASSERT_NO_THROW(translator.translate());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that translating the simple blocks world domain works
|
||||||
|
{
|
||||||
|
auto description = Description::fromFile("data/issues/issue-5.pddl");
|
||||||
|
const auto translator = TranslatorASP(description, description.context().logger.outputStream());
|
||||||
|
ASSERT_NO_THROW(translator.translate());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <plasp/utils/IO.h>
|
|
||||||
#include <plasp/utils/Parser.h>
|
#include <plasp/utils/Parser.h>
|
||||||
#include <plasp/utils/ParserException.h>
|
#include <plasp/utils/ParserException.h>
|
||||||
|
|
||||||
@@ -331,17 +330,3 @@ TEST(UtilsTests, ParserRemoveComments)
|
|||||||
|
|
||||||
ASSERT_TRUE(p3.atEnd());
|
ASSERT_TRUE(p3.atEnd());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TEST(UtilsTests, EscapeASP)
|
|
||||||
{
|
|
||||||
const std::string predicate = "action(stack_on(block-1, block-2, value@3, value@4))";
|
|
||||||
|
|
||||||
const auto escaped = plasp::utils::escapeASP(predicate);
|
|
||||||
const auto unescaped = plasp::utils::unescapeASP(escaped);
|
|
||||||
|
|
||||||
ASSERT_EQ(escaped.find("-"), std::string::npos);
|
|
||||||
ASSERT_EQ(escaped.find("@"), std::string::npos);
|
|
||||||
ASSERT_EQ(predicate, unescaped);
|
|
||||||
}
|
|
||||||
|
45
tests/data/issues/issue-5.pddl
Normal file
45
tests/data/issues/issue-5.pddl
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
(define (domain BLOCKS)
|
||||||
|
(:requirements :strips :typing)
|
||||||
|
(:types block)
|
||||||
|
(:predicates (on ?x - block ?y - block)
|
||||||
|
(ontable ?x - block)
|
||||||
|
(clear ?x - block)
|
||||||
|
(handempty)
|
||||||
|
(holding ?x - block)
|
||||||
|
)
|
||||||
|
|
||||||
|
(:action pick-up
|
||||||
|
:parameters (?x - block)
|
||||||
|
:precondition (and (clear ?x) (ontable ?x) (handempty))
|
||||||
|
:effect
|
||||||
|
(and (not (ontable ?x))
|
||||||
|
(not (clear ?x))
|
||||||
|
(not (handempty))
|
||||||
|
(holding ?x)))
|
||||||
|
|
||||||
|
(:action put-down
|
||||||
|
:parameters (?x - block)
|
||||||
|
:precondition (holding ?x)
|
||||||
|
:effect
|
||||||
|
(and (not (holding ?x))
|
||||||
|
(clear ?x)
|
||||||
|
(handempty)
|
||||||
|
(ontable ?x)))
|
||||||
|
(:action stack
|
||||||
|
:parameters (?x - block ?y - block)
|
||||||
|
:precondition (and (holding ?x) (clear ?y))
|
||||||
|
:effect
|
||||||
|
(and (not (holding ?x))
|
||||||
|
(not (clear ?y))
|
||||||
|
(clear ?x)
|
||||||
|
(handempty)
|
||||||
|
(on ?x ?y)))
|
||||||
|
(:action unstack
|
||||||
|
:parameters (?x - block ?y - block)
|
||||||
|
:precondition (and (on ?x ?y) (clear ?x) (handempty))
|
||||||
|
:effect
|
||||||
|
(and (holding ?x)
|
||||||
|
(clear ?y)
|
||||||
|
(not (clear ?x))
|
||||||
|
(not (handempty))
|
||||||
|
(not (on ?x ?y)))))
|
Reference in New Issue
Block a user