patrick
/
plasp
Archived
1
0
Fork 0

Compare commits

...

759 Commits

Author SHA1 Message Date
Patrick Lühne af325e3991
Version bump after release 3.1.1. 2017-11-25 17:52:52 +01:00
Patrick Lühne 31542c6adc
Version bump for release 3.1.1. 2017-11-25 17:21:45 +01:00
Patrick Lühne 2d0e4b09fa
Updated changelog with variable name replacement. 2017-11-25 17:18:50 +01:00
Patrick Lühne 2288fa891e
Replacing user-defined variable names.
This replaces all user-defined variable names with continuously numbered
ones so that they don’t lead to syntax problems in ASP, while still
unique and distinguishable. For instance, this avoids problems when
variable names contain hyphens, which are allowed in PDDL identifiers
but not in ASP variables.
2017-11-25 00:37:09 +01:00
Patrick Lühne 7c02b46f7c
Version bump after release 3.1.0. 2017-11-17 19:33:21 +01:00
Patrick Lühne 1c44dfcda7
Version bump for release 3.1.0. 2017-11-17 18:43:02 +01:00
Patrick Lühne b93e41d5bc
Removed Arch PKGBUILD from repository.
The PKGBUILD for Arch Linux is already hosted at AUR, and there
shouldn’t be two sources for it.
2017-11-17 18:40:08 +01:00
Patrick Lühne 0ff78f43e6
Added PDDL 3.1 feature support documentation. 2017-11-17 18:27:35 +01:00
Patrick Lühne 0f039f0837
Excluding derived variables from inertia.
In the example encoding, derived variables were accidentally included in
the inertia rule, as this only checked the position of the parameter.
This commit fixes this by only allowing common variables (and not
derived ones) within the inertia rule.
2017-11-17 17:43:44 +01:00
Patrick Lühne 9d04996b0a
Minor formatting.
This change doesn’t affect derived variables, because these aren’t
affected by the “caused” predicate (the “caused” predicate requires a
variable to be in the postcondition of an action, and these may never be
derived variables).
2017-11-17 17:34:16 +01:00
Patrick Lühne b2280c155a
Fixed handling of goal in example encoding.
The example encoding assumed that derived predicates weren’t necessary
in the final time step. This is, however, incorrect, as the goal may
have a precondition that requires derived predicates. In this case, the
derived variables must be evaluated for the final time step.
2017-11-17 17:32:05 +01:00
Patrick Lühne f7e089042d
Updated documentation to new output format. 2017-11-17 17:12:34 +01:00
Patrick Lühne ce4fe6a113
Fixed typo. 2017-11-17 15:39:21 +01:00
Patrick Lühne 3e2adf6db4
Added “known issues” file. 2017-11-17 15:39:21 +01:00
Patrick Lühne 8ff87985f5
Moved outdated encodings to separate directory.
These encodings need to be updated to match the new output format. Until
this is done, hide these files in a separate directory in order not to
confuse users.
2017-11-17 15:38:59 +01:00
Patrick Lühne 9fde2b8e1b
Updated cxxopts to 2.0.0.
Starting from version 2.0.0, cxxopts returns a ParseResult object
instead of storing the results directly within the Options structure.
Additionally, Booleans are handled slightly differently.

These two changes required some minor adjustment of the command-line
argument parsing code.
2017-11-17 00:51:51 +01:00
Patrick Lühne c283adc42a
Minor formatting. 2017-11-17 00:47:35 +01:00
Patrick Lühne 9281592c39
Rephrased change log for 3.1.0 for clarity. 2017-11-17 00:18:51 +01:00
Patrick Lühne 6889e97f47
Updated readme for release 3.1.0.
This adds a section about the new commands, updates out-of-date
references, and highlights the translator as the currently most
interesting component.
2017-11-16 18:24:27 +01:00
Patrick Lühne 23130134bb
Made translator descriptions more concise. 2017-11-16 18:11:38 +01:00
Patrick Lühne 5af0c26650
Added tests for derived predicate numbering.
These tests ensure that derived predicates are numbered correctly,
whether they are introduced by the domain, the problem, or both.
2017-11-16 17:30:53 +01:00
Patrick Lühne 39410ac98b
Added normalization tests for nested expressions.
These tests ensure that nested expressions in preconditions and effects
are correctly flattened via derived predicates.
2017-11-16 17:23:08 +01:00
Patrick Lühne 5621820fe4
Added normalization tests for negations.
These tests ensure that multiple negations are eliminated, negated
quantifiers are replaced appropriately, negations introduced by
reduction are correctly handled, and negated disjunctions and
conjunctions are replaced according to De Morgan’s rules.
2017-11-15 18:53:43 +01:00
Patrick Lühne 9e9040cac0
Added normalization tests for “forall” statements.
These tests ensure that universal quantifiers are correctly reduced to
negated existential quantifiers over the negated argument via derived
predicates in preconditions (nested and not) and goal descriptions.
2017-11-15 17:26:56 +01:00
Patrick Lühne 0cf84dd5ca
Added normalization tests for implications.
These tests ensure that implications are correctly reduced to
disjunctions in preconditions (nested and not) and goal descriptions.
2017-11-15 16:34:48 +01:00
Patrick Lühne b063f5047e
Added basic normalization tests.
These tests make sure that simple PDDL descriptions are preserved by
normalization.
2017-11-15 16:01:26 +01:00
Patrick Lühne 08a2eebe2c
Removed obsolete test file.
This file will soon be replaced by a dedicated test suite in the pddl
library and is obsolete thus.
2017-11-15 16:01:22 +01:00
Patrick Lühne 010e7bf41e
Requiring goal to contain only one statement.
Previously, the parser read the first statement of the goal as its
precondition, but didn’t check that it was properly terminated with a
closing parenthesis. This allowed arbitrary text to be included within
the goal description without error, which was incorrect.

This commit fixes this issue and adds a corresponding unit test.
2017-11-15 15:52:10 +01:00
Patrick Lühne a1a80332ca
Merge pull request #4 from mgebser/strips
Introduced flat representation of transition constraints, activated by
default with respect to the new constant _inertia.
2017-11-09 14:35:31 +01:00
Patrick Lühne f0e553df23
Minor formatting. 2017-11-08 17:11:36 +01:00
Patrick Lühne 0d0a4337a2
Updated Catch to 2.0.1. 2017-11-04 20:54:39 +01:00
Patrick Lühne b21b4f47bf
Made form of variables within values consistent.
Previously, variables referenced within values were unpacked within
values. This was inconsistent, because all predicates are usually used
in their unpacked form in the rest of the output format. This commit
makes this consistent by using variables in their packed form within
values, making it more compact to handle them.
2017-11-03 01:49:24 +01:00
Patrick Lühne 3a7b61de68
Fixed syntax error at end of initial state facts.
Due to a mistake in commit 6d07fcb, the closing parenthesis and period
at the end of initial state facts was omitted. This adds these back in
order to solve this syntax error.
2017-11-01 16:00:48 +01:00
mgebser efee22a655 introduced flat representation of transition constraints, activated by default w.r.t. the new constant _inertia 2017-11-01 13:58:04 +01:00
Patrick Lühne 4faa8813e4
Added removed Boost dependency to change log. 2017-10-28 17:33:26 +02:00
Patrick Lühne dd1b2f9636
Removed Boost dependency from building instructions. 2017-10-28 17:31:37 +02:00
Patrick Lühne a31d8638e7
Fixed typos in documentation. 2017-10-28 17:30:41 +02:00
Patrick Lühne 6af0d4ec7a
Removed Boost dependency from Arch PKGBUILD. 2017-10-28 17:16:18 +02:00
Patrick Lühne 021e6c439c
Removed Boost packages from Travis configuration.
As the Boost dependency isn’t required anymore, this commit removes the
Boost packages from the Travis configuration.
2017-10-28 16:50:45 +02:00
Patrick Lühne e87f86af95
Removed Boost dependency in assertions.
Instead of using BOOST_ASSERT, this commit changes all assertions to
plain C-style assertions in order to drop the dependency to Boost.
2017-10-28 16:49:15 +02:00
Patrick Lühne ca7ae883ee
Removed Boost dependency in unit tests.
Some of the unit tests depended on Boost’s null_sink to redirect the
unwanted test output to /dev/null. This commit adds a simple
NullOutputStream as a replacement and removes the obsolete Boost
includes.
2017-10-28 16:45:29 +02:00
Patrick Lühne 72fc7493b2
Removed Boost dependency in language distinction.
As Boost isn’t used in the rest of this project anymore, this commit
removes the unnecessary dependency to boost::bimap just for language
detection, and replaces it with a simple std::map instead.
2017-10-28 15:44:37 +02:00
Patrick Lühne 1631a70a0b
Ensuring that goal is variable-free.
Even though the parser shouldn’t be able to put variables into the goal
description, the AST theoretically allows for this case. This commit
adds a defensive check that goal descriptions are variable-free.
2017-10-27 17:10:35 +02:00
Patrick Lühne 27f773e091
Added support for derived predicates in goals.
By accident, the support for derived predicates in goals was missing.
This commit adds this, in a very similar way to how normal predicates
are handled in the goal description.
2017-10-27 16:46:38 +02:00
Patrick Lühne 6d07fcbd6c
Moved initial state translation to new header. 2017-10-27 16:38:01 +02:00
Patrick Lühne 6415f871d7
Error for derived predicates in initial state.
Previously, derived predicates in the initial state weren’t handled at
all. That’s not an issue, because derived predicates shouldn’t occur in
the initial state. However, as a defensive measure, this commit adds an
error thrown in such cases.
2017-10-27 16:27:33 +02:00
Patrick Lühne feaef5a3fa
Translating derived predicates of problems.
While derived predicates stemming from the domain were already
translated, the ones from the problem were missing. This commit fixes
that, although it duplicates the definition of “contains.”
2017-10-27 16:21:54 +02:00
Patrick Lühne 624ddc38aa
Fixed incorrect derived predicate IDs in problems.
The IDs of derived predicates within problems were accidentally starting
with 1 again, colliding with the IDs of derived predicates in the
domain. With this fix, the IDs are continuously incremented, even after
switching from domain to problem.
2017-10-25 19:01:11 +02:00
Patrick Lühne 9803710ff3
Fixed typo. 2017-10-25 19:00:54 +02:00
Patrick Lühne 4d8525f52d
Added comment for consistency. 2017-10-25 18:03:11 +02:00
Patrick Lühne d0b7f89925
Removed unwanted newlines at the end of output. 2017-10-25 17:01:19 +02:00
Patrick Lühne 032fa14f61
Updated tagline to match plasp’s recently extended tool set. 2017-10-14 02:37:46 +02:00
Patrick Lühne 8b487b0a82
Structured change log more nicely. 2017-10-14 02:31:04 +02:00
Patrick Lühne f6eed53550
Minor formatting. 2017-10-14 02:13:47 +02:00
Patrick Lühne cb61f7cc5e
Making command-line options in change log more specific. 2017-10-14 02:13:47 +02:00
Patrick Lühne 5ec4dd2aaf
Added new commands to the change log. 2017-10-14 02:13:47 +02:00
Patrick Lühne b8bd42d361
Implemented “check-syntax” command. 2017-10-14 02:13:47 +02:00
Patrick Lühne 89edafb586
Implemented “beautify” command. 2017-10-14 02:13:47 +02:00
Patrick Lühne 0d5245b48b
Showing list of available commands in help message. 2017-10-14 02:13:47 +02:00
Patrick Lühne d20b30d34d
Implemented “normalize” command. 2017-10-14 02:13:47 +02:00
Patrick Lühne b99e7c198a
Refactored “translate” command. 2017-10-14 02:13:46 +02:00
Patrick Lühne c3b6d6939f
Added missing inline directive. 2017-10-14 02:13:46 +02:00
Patrick Lühne 868c220e42
Minor formatting. 2017-10-14 02:13:46 +02:00
Patrick Lühne cde892c771
Added command for printing version information. 2017-10-14 02:13:46 +02:00
Patrick Lühne 974c94fbb0
Unified version printing. 2017-10-14 02:13:46 +02:00
Patrick Lühne 2be3f4256a
Refactored command base class for simplicity. 2017-10-14 02:13:46 +02:00
Patrick Lühne 5427876e36
Added workaround for GCC 6 compiler error. 2017-10-14 02:13:46 +02:00
Patrick Lühne abdc4e31dc
Refactored printing help messages in commands. 2017-10-14 02:13:46 +02:00
Patrick Lühne db7ea6f2fe
Removed unwanted methods. 2017-10-14 02:13:46 +02:00
Patrick Lühne d8b2aa9720
Updated change log with new command interface. 2017-10-14 02:13:46 +02:00
Patrick Lühne 63c4da8fad
Made option group parsing more uniform. 2017-10-14 02:13:46 +02:00
Patrick Lühne 3fe2886925
Updated CMake in Travis configuration for C++17 support. 2017-10-14 02:13:46 +02:00
Patrick Lühne 86486207b8
Added help and version options to the translate command. 2017-10-14 02:13:46 +02:00
Patrick Lühne 569b170aba
Using cxxopts as a submodule. 2017-10-14 02:13:45 +02:00
Patrick Lühne f6c9e19a60
Outsourced parsing of common options in plasp app. 2017-10-14 02:13:45 +02:00
Patrick Lühne 6b891fcb8e
Prepared app directory for future subcommands. 2017-10-14 02:13:45 +02:00
Patrick Lühne 8b6c4beed8 Merge pull request #3 from mgebser/strips
Support for parallel actions without checking mutual disablement
2017-10-12 19:27:26 +02:00
mgebser 5e0c8a695c new constant value '_parallel=0' to allow for parallel actions without checking mutual disablement 2017-10-05 20:24:59 +02:00
Patrick Lühne 46cd4de854
Updated changelog with parser support for equalities. 2017-08-31 19:29:54 +02:00
Patrick Lühne 871d3fcdb3
Renamed test suites for clarity. 2017-08-31 19:15:17 +02:00
Patrick Lühne 4ad9355e47
Removed domains from blacklist that are now supported by parser. 2017-08-31 19:08:28 +02:00
Patrick Lühne 1dee4655a7
Minor refactoring. 2017-08-31 19:04:10 +02:00
Patrick Lühne 0a104d222c
Removed unneeded constant parsing functions. 2017-08-31 18:51:27 +02:00
Patrick Lühne 80167fd21b
Removed unneeded variable parsing functions. 2017-08-31 18:48:48 +02:00
Patrick Lühne 7de9980c10
Refactoring to reuse term parsing code. 2017-08-31 18:37:43 +02:00
Patrick Lühne 89f3eb0306
Implemented term parser. 2017-08-31 18:34:34 +02:00
Patrick Lühne 716b4801aa
Added AST representation for “equals” expressions. 2017-08-31 17:54:30 +02:00
Patrick Lühne 9199b68080
Renamed “pddlparse” library to simply “pddl”. 2017-08-09 17:52:50 +02:00
Patrick Lühne a24ce91acb Merge pull request #2 from mgebser/strips
improved strips encodings
2017-08-09 17:19:35 +02:00
mgebser 9ab1ea1c23 improved strips encodings 2017-08-09 12:12:39 +02:00
Patrick Lühne 8b232e0155
Updated sequential horizon-bound meta encoding to match new output format. 2017-06-28 16:41:31 +02:00
Patrick Lühne aec16f4407
Added option to compile plasp statically. 2017-06-28 01:43:12 +02:00
Patrick Lühne b2ac47c2d3
Moved Boost dependency to plasp application only. 2017-06-28 01:42:29 +02:00
Patrick Lühne 31cf6d287d
Internal version bump to 3.1.0-git because of the scope of the changes since 3.0.3. 2017-06-28 01:06:30 +02:00
Patrick Lühne b282225363
Moved util predicates to separate section. 2017-06-28 01:00:36 +02:00
Patrick Lühne 95c03396d0
Fixed incorrect argument format in ASP output. 2017-06-28 00:51:42 +02:00
Patrick Lühne a5038535f4
Added missing argument to ASP predicate. 2017-06-28 00:35:28 +02:00
Patrick Lühne d82ae8544b
Implemented translation of conditional PDDL effects. 2017-06-28 00:33:00 +02:00
Patrick Lühne 0caef2e81c
Extended error message. 2017-06-27 23:35:44 +02:00
Patrick Lühne cb333fd420
Updated Catch to 1.9.6. 2017-06-27 23:21:36 +02:00
Patrick Lühne f61cfa532d
Added support for unconditional “forall” effect statements. 2017-06-27 23:17:32 +02:00
Patrick Lühne 39b885c47c
Handling effects in PDDL normalization step. 2017-06-27 22:32:49 +02:00
Patrick Lühne da85683f7c
Changed effects in normalized PDDL effects according to recent changes. 2017-06-27 18:17:02 +02:00
Patrick Lühne 0beab67bd4
Made effect variant more concise. 2017-06-27 17:50:42 +02:00
Patrick Lühne 4622f31fa4
Made conditional effect variant more concise. 2017-06-27 17:43:00 +02:00
Patrick Lühne 0eff8e5dcf
Only enumerating existentially bound parameters for “and” expressions. 2017-06-27 16:52:50 +02:00
Patrick Lühne 1516561a58
Allowing “not” expressions without introducing derived predicates. 2017-06-27 12:39:51 +02:00
Patrick Lühne 5c93840f85
Allowing “exists” derived predicates to hold the precondition directly. 2017-06-27 12:34:15 +02:00
Patrick Lühne ea50cffac9
Separating top-level and nested preconditions correctly. 2017-06-27 12:29:43 +02:00
Patrick Lühne 8a48a5043a
Minor refactoring for consistency. 2017-06-27 12:17:42 +02:00
Patrick Lühne cc90ef3ec6
Restructured file for clarity. 2017-06-27 11:56:51 +02:00
Patrick Lühne 31e5ead21e
Minor refactoring. 2017-06-27 11:44:33 +02:00
Patrick Lühne d451d2d548
Handling negations introduced by “forall” elimination correctly. 2017-06-27 11:35:47 +02:00
Patrick Lühne 729ecc9475
Added missing recursion step in PDDL reduction. 2017-06-27 11:34:53 +02:00
Patrick Lühne 6c9ca0ccb8
Implemented translation of derived predicates. 2017-06-24 23:54:57 +02:00
Patrick Lühne 6b1d079f69
Enabled test cases again by removing unsupported features from test files. 2017-06-24 21:49:13 +02:00
Patrick Lühne 6e858ff52f
Enabled test case again by exchanging unsupported input file. 2017-06-24 21:49:06 +02:00
Patrick Lühne ca02b8ce62
Throwing exceptions for unsupported features instead of silently accepting them. 2017-06-24 20:27:01 +02:00
Patrick Lühne 2b0b6570ea
Excluding unsupported domains and instances from acceptance tests. 2017-06-24 20:14:06 +02:00
Patrick Lühne 909949ff22
Removed unwanted test case. 2017-06-24 20:11:12 +02:00
Patrick Lühne 436933f73f
Added function to dermine stream location from arbitrary positions. 2017-06-24 19:01:09 +02:00
Patrick Lühne 4d59732263
Minor refactoring. 2017-06-24 18:37:49 +02:00
Patrick Lühne 12efe41551
Fixed issue due to undefined implementations. 2017-06-24 18:37:20 +02:00
Patrick Lühne 362222c882
Finished implementing reduction. 2017-06-24 17:38:11 +02:00
Patrick Lühne fcb9aa0a76
Added missing forward declaration. 2017-06-24 17:35:52 +02:00
Patrick Lühne d9bae984b2
Implemented elimination of “forall” statements. 2017-06-24 17:30:08 +02:00
Patrick Lühne 994801525a
Implemented negation normalization (NFF). 2017-06-24 17:19:35 +02:00
Patrick Lühne 939c2c735c
Explicitly deleted default constructors of all variant types to avoid future errors. 2017-06-24 17:17:27 +02:00
Patrick Lühne 287e1041bd
Added missing inline directive. 2017-06-24 16:51:45 +02:00
Patrick Lühne 9845c5ae9e
Added missing parentheses in PDDL output. 2017-06-24 16:33:42 +02:00
Patrick Lühne 7ae2734e9f
Started implementing reduction, added support for “imply” expressions. 2017-06-24 16:03:32 +02:00
Patrick Lühne d5dd8e849f
Avoiding to decompose “not” expressions if they form simple literals. 2017-06-24 16:02:48 +02:00
Patrick Lühne 079e2ac539
Printing arguments of “not” expressions on the same line for clarity. 2017-06-24 16:00:50 +02:00
Patrick Lühne aeb8132fc7
Added missing inline directives. 2017-06-24 15:53:40 +02:00
Patrick Lühne dd51f2b4fd
Added missing const directive. 2017-06-24 15:53:16 +02:00
Patrick Lühne d7e0beabdf
Implemented normalization of preconditions. 2017-06-24 14:29:13 +02:00
Patrick Lühne 9d1a8f4c0f
Started implementing PDDL normalization. 2017-06-23 04:18:07 +02:00
Patrick Lühne e4f4b5e066
Added initial normalized PDDL debug output functionality. 2017-06-23 03:54:51 +02:00
Patrick Lühne 19f2c2ebf8
Added missing forward declaration. 2017-06-23 03:53:01 +02:00
Patrick Lühne 2851f8d286
Corrected grammar of initial state facts. 2017-06-23 03:41:52 +02:00
Patrick Lühne 9360ad3487
Added missing forward declaration. 2017-06-23 02:31:07 +02:00
Patrick Lühne c0b71290a4
Minor formatting in PDDL debug output. 2017-06-23 01:48:47 +02:00
Patrick Lühne 3d9bf2582f
Fixed format of PDDL debug output. 2017-06-23 01:22:28 +02:00
Patrick Lühne cbc9c86edd
Removed unnecessary include directives. 2017-06-23 00:58:58 +02:00
Patrick Lühne 480da6ff09
Built initial AST for normalized PDDL. 2017-06-23 00:51:09 +02:00
Patrick Lühne 834209d506
Moved common output utilities to separate header. 2017-06-23 00:50:19 +02:00
Patrick Lühne ef606f3d9b
Merge branch 'develop' of github.com:potassco/plasp into feature-normalization 2017-06-22 23:45:15 +02:00
Patrick Lühne b5131fa00d
Added debug output functions for PDDL AST. 2017-06-22 23:19:49 +02:00
Patrick Lühne 768afa9bf5
Added to-do. 2017-06-22 23:19:17 +02:00
Patrick Lühne 59dc239c67
Removed unused class. 2017-06-22 23:18:43 +02:00
Patrick Lühne ec546758a8
Minor formatting. 2017-06-22 22:48:25 +02:00
Patrick Lühne e93085d88a
Moved color logging to separate library for reusing it in PDDL parser. 2017-06-22 20:58:31 +02:00
Patrick Lühne 595891f040
Minor formatting. 2017-06-22 20:36:48 +02:00
Patrick Lühne b7b4d926b4
Removed unused declarations. 2017-06-22 00:03:35 +02:00
Patrick Lühne 12e55da662
Allowing “at” as a predicate name even though it is an expression identifier. 2017-06-21 23:00:07 +02:00
Patrick Lühne 08c55adfbd
Added test case covering missing variable names. 2017-06-21 16:55:56 +02:00
Patrick Lühne ec8007125f
Fixed segfault occurring with accidentally unnamed variables. 2017-06-21 16:48:43 +02:00
Patrick Lühne 17985e3b5a
Added note suggesting using the compatibility mode if errors occur. 2017-06-21 03:07:09 +02:00
Patrick Lühne 002f875c53
Lowered default message logging priority to info. 2017-06-21 03:05:37 +02:00
Patrick Lühne 39c0e27cb2
Refactoring of tokenizer and stream classes for better efficiency and maintainability. 2017-06-21 02:56:27 +02:00
Patrick Lühne 97c6e58355
Minor refactoring in stream reading. 2017-06-20 18:13:49 +02:00
Patrick Lühne 7162fa76f6
Updated change log with new compatibility parsing mode. 2017-06-20 03:27:06 +02:00
Patrick Lühne f5a73f09f8
Added command-line option to enable the parser’s compatibility mode. 2017-06-20 03:23:19 +02:00
Patrick Lühne ee56a105b3
Resizing file content one time if stream is seekable and dynamically otherwise. 2017-06-20 03:14:51 +02:00
Patrick Lühne 19f2ad19b0
Fixed incorrect language detection with legacy “in-package” directives. 2017-06-20 03:01:20 +02:00
Patrick Lühne 178a55d29e
Added missing CMake option for testing PDDL parsing library to Travis configuration. 2017-06-20 02:11:15 +02:00
Patrick Lühne ff782a8642
Updated change log with internal switch to PDDL parsing library. 2017-06-20 01:59:33 +02:00
Patrick Lühne e345fd60fd
Reimplemented plasp with PDDL parsing library. 2017-06-20 01:53:55 +02:00
Patrick Lühne 9c7532bd9d
Merge branch 'develop' of github.com:potassco/plasp into feature-plasp-with-pddlparse 2017-06-19 16:09:06 +02:00
Patrick Lühne 9d906a195a
Fixed incorrectly labeled badges in readme file. 2017-06-19 16:07:44 +02:00
Patrick Lühne 2d44ca7955
Updated PDDL instance repository. 2017-06-19 15:55:58 +02:00
Patrick Lühne 799c9ce2fb
Replicated test cases for former issues in PDDL parsing library. 2017-06-19 01:15:20 +02:00
Patrick Lühne c35faab104
Replicated syntax error tests in PDDL parsing library. 2017-06-19 01:09:55 +02:00
Patrick Lühne ce812d449b
Added exceptions for inconsistent use of typing. 2017-06-19 01:09:55 +02:00
Patrick Lühne 17b8306394
Minor refactoring, as there is only one typing section. 2017-06-19 01:09:55 +02:00
Patrick Lühne df2359712f
Removed unwanted debug output. 2017-06-19 01:09:55 +02:00
Patrick Lühne de648fbb1d
Fixed incorrect names of test cases. 2017-06-19 01:09:55 +02:00
Patrick Lühne d0d141ef99
Replicated test cases with missing or mismatched domains in PDDL parsing library. 2017-06-19 01:09:50 +02:00
Patrick Lühne 40b43217fc
Replicated white space test case in new PDDL parsing library. 2017-06-19 00:35:31 +02:00
Patrick Lühne c6c36273b5
Dropped support for GCC 5 due to unsupported conversion with optional types. 2017-06-19 00:29:55 +02:00
Patrick Lühne 586e93190c
Made plasp compatible to recent tokenizer changes. 2017-06-19 00:28:17 +02:00
Patrick Lühne 9fe489de53
Added unit tests covering predicate signature matching. 2017-06-19 00:18:03 +02:00
Patrick Lühne 60d8b9ba77
Fixed incorrect parsing order of type declarations. 2017-06-19 00:18:02 +02:00
Patrick Lühne 1379c24362
Renamed test sections for clarity. 2017-06-19 00:18:02 +02:00
Patrick Lühne bbf2a7d02d
Allowing not declaring implicit “object” type without warning or error. 2017-06-19 00:18:02 +02:00
Patrick Lühne 4c0583c91f
Refactored tokenizer to lazily evaluate file locations. 2017-06-19 00:18:02 +02:00
Patrick Lühne 04dffdb09e
Fixed accidentally truncated ends of files after removing comments. 2017-06-19 00:18:02 +02:00
Patrick Lühne dd7fb31309
Made CMake configuration consistent. 2017-06-19 00:18:02 +02:00
Patrick Lühne 268fa84c9e
Reimplemented tokenizer with plain streams. 2017-06-19 00:18:02 +02:00
Patrick Lühne b9b987490b
Fixed incorrect CMake option handling. 2017-06-19 00:18:02 +02:00
Patrick Lühne 230844c3ae
Fixed whitespace issue in typing sections and added test cases. 2017-06-19 00:18:02 +02:00
Patrick Lühne 6ce4eecb18
Implemented predicate signature checks. 2017-06-19 00:18:02 +02:00
Patrick Lühne e364d01cf4
Fixed issue in parsing typed objects in multiple iterations and added test case. 2017-06-19 00:18:02 +02:00
Patrick Lühne 04ded5e8b8
Removed unnecessary include directive. 2017-06-19 00:18:02 +02:00
Patrick Lühne 83a36003b1
Added test case covering complicated nested effects. 2017-06-19 00:18:01 +02:00
Patrick Lühne fc48b8f694
Added test case covering typed objects. 2017-06-19 00:18:01 +02:00
Patrick Lühne b0db73ab2f
Added to-do. 2017-06-19 00:18:01 +02:00
Patrick Lühne 195cffbf88
Fixed incorrectly determined parent types and added unit test. 2017-06-19 00:18:01 +02:00
Patrick Lühne bfb382de52
Fixed incorrect constant types and added unit test. 2017-06-19 00:18:01 +02:00
Patrick Lühne 101f33df6e
Removed unused test file. 2017-06-19 00:18:01 +02:00
Patrick Lühne 615167e7cd
Implemented compatibility mode to support old instances. 2017-06-19 00:18:01 +02:00
Patrick Lühne dde277cc3e
Added to-do. 2017-06-19 00:18:01 +02:00
Patrick Lühne 7ead2277e8
Prepared exceptions to have different types. 2017-06-19 00:18:01 +02:00
Patrick Lühne da2a3eefa4
Added extensive test covering Blocksworld instance. 2017-06-19 00:18:01 +02:00
Patrick Lühne 3877012274
Minor extension of unit test covering Blocksworld domain. 2017-06-19 00:18:01 +02:00
Patrick Lühne e0aca18b38
Removed unnecessary directives in test case. 2017-06-19 00:18:01 +02:00
Patrick Lühne 19c81effbe
Added extensive test for Blocksworld domain. 2017-06-19 00:18:00 +02:00
Patrick Lühne f83f9edbef
Reimplemented goal parser. 2017-06-19 00:17:53 +02:00
Patrick Lühne f90009b6d1
Reimplemented initial state parser. 2017-06-19 00:15:32 +02:00
Patrick Lühne fbcb790611
Minor refactoring. 2017-06-19 00:15:27 +02:00
Patrick Lühne 8c98548dbc
Minor formatting. 2017-06-19 00:15:24 +02:00
Patrick Lühne 20c687a787
Corrected exception types. 2017-06-19 00:15:14 +02:00
Patrick Lühne d376c1a993
Allowing atomic formulas and not just predicates in preconditions and effects. 2017-06-19 00:15:11 +02:00
Patrick Lühne 10e658a922
Added back support for parsing effects and even conditional effects. 2017-06-19 00:15:07 +02:00
Patrick Lühne 9c30e27875
Fixed incorrect parsing method for “when” expressions. 2017-06-19 00:15:04 +02:00
Patrick Lühne 14c498c539
Handling unsupported preferences in preconditions. 2017-06-19 00:15:00 +02:00
Patrick Lühne f4c1d65365
Made warnings more concise and consistent. 2017-06-19 00:14:56 +02:00
Patrick Lühne 34d9c7a1c2
Added warnings for currently under-construction sections. 2017-06-19 00:14:52 +02:00
Patrick Lühne 0d3cb152f9
Finished precondition parsing. 2017-06-19 00:14:48 +02:00
Patrick Lühne 63e15d37e8
Made precondition parsing more robust. 2017-06-19 00:14:45 +02:00
Patrick Lühne 51249fd678
Refactored parsing variables, constants, and predicates. 2017-06-19 00:14:40 +02:00
Patrick Lühne 0de5b9eb56
Added to-do. 2017-06-19 00:14:36 +02:00
Patrick Lühne 8288345bcb
Added missing method implementation to tokenizer. 2017-06-19 00:14:33 +02:00
Patrick Lühne f349b5e351
Minor formatting. 2017-06-19 00:14:29 +02:00
Patrick Lühne de69003105
Sectioning unit tests for meaningful error messages. 2017-06-19 00:14:25 +02:00
Patrick Lühne c84cafda18
Fixed constant parsing if no problem is specified. 2017-06-19 00:14:18 +02:00
Patrick Lühne 78b4636028
Continued working on reimplementing action parser. 2017-06-19 00:14:18 +02:00
Patrick Lühne 9fbe0db567
Extended unit test on “either” types. 2017-06-19 00:14:05 +02:00
Patrick Lühne 1876d1fe0b
Fixed parsing of types. 2017-06-19 00:14:01 +02:00
Patrick Lühne 30a092b365
Corrected scope of acceptance tests. 2017-06-19 00:13:56 +02:00
Patrick Lühne 464550cb5b
Renamed tests file. 2017-06-19 00:13:52 +02:00
Patrick Lühne a6babf3e90
Reimplemented major parts of parsing preconditions. 2017-06-19 00:13:48 +02:00
Patrick Lühne 62b9da844a
Started reimplementing expression parsing. 2017-06-19 00:13:43 +02:00
Patrick Lühne fa9fd0935b
Made error message more precise. 2017-06-19 00:13:35 +02:00
Patrick Lühne 1e77a6b043
Added “domain-axioms” as an ignored requirement to increase compatibility. 2017-06-19 00:13:29 +02:00
Patrick Lühne 216decafc1
Allowing types to be undeclared for increased compatibility. 2017-06-19 00:13:24 +02:00
Patrick Lühne 849faad134
Added compatibility check for unsupported “in-package” sections. 2017-06-19 00:13:18 +02:00
Patrick Lühne 9642bab0c8
Enabled colored unit test results by default. 2017-06-19 00:13:13 +02:00
Patrick Lühne 517698475c
Added test cases for all competition domains (not all of them supported yet). 2017-06-19 00:13:03 +02:00
Patrick Lühne 0b8da69394
Added official PDDL competition instances for automated testing. 2017-06-19 00:13:03 +02:00
Patrick Lühne a7c4fdb242
Started reimplementing problem parser. 2017-06-19 00:12:51 +02:00
Patrick Lühne 06b9632b70
Removed unused flags. 2017-05-18 15:55:20 +02:00
Patrick Lühne 94dd209e5e
Linking constants to their declarations by reference instead of pointer. 2017-05-17 20:21:34 +02:00
Patrick Lühne 5d65cc3100
Added missing include directive. 2017-05-17 20:21:20 +02:00
Patrick Lühne 2042d6329d
Hiding implementation details in variant classes. 2017-05-17 20:09:07 +02:00
Patrick Lühne ff1d582605
Removed unwanted copy constructor. 2017-05-17 20:00:01 +02:00
Patrick Lühne b3fd49ef97
Removed duplicate entry from predicates. 2017-05-17 19:59:32 +02:00
Patrick Lühne 8a103ea89d
Added class for PDDL parser exceptions. 2017-05-17 15:29:51 +02:00
Patrick Lühne 29f8ee0778
Added parsing utils to skip PDDL sections. 2017-05-17 15:28:58 +02:00
Patrick Lühne 5f240b632a
Added default constructors to AST structs. 2017-05-17 14:29:00 +02:00
Patrick Lühne d711fcd0f1
Removed unneeded class. 2017-05-12 14:31:26 +02:00
Patrick Lühne e312a91632
Renamed tokenizing module for clarity. 2017-05-12 14:17:57 +02:00
Patrick Lühne c10187f6ba
Minor refactoring to simplify parser classes. 2017-05-12 13:58:28 +02:00
Patrick Lühne d7db0d8ccd
Started implementing clean, separate PDDL syntax tree and parser. 2017-05-12 13:58:28 +02:00
Patrick Lühne d2f9e55e68
Merge branch 'master' of github.com:potassco/plasp into develop 2017-05-09 15:12:19 +02:00
Patrick Lühne ebcf263abd
Removed unnecessary boost::filesystem dependency. 2017-05-09 15:11:35 +02:00
Patrick Lühne 27c6b69874
Moved basic parsing to a separate module. 2017-05-09 15:05:59 +02:00
Patrick Lühne 386e5356af
Updated Catch. 2017-05-09 14:55:47 +02:00
Patrick Lühne 88cb8f4516
Improved CMake structure. 2017-05-09 13:01:10 +02:00
Patrick Lühne 9c9995380e
Resolved compiler warnings with clang. 2017-05-09 13:00:44 +02:00
mgebser ff8dc0e85f just stylistic change 2017-01-18 15:45:12 +01:00
gebser 1b94053542 revised redundant rules 2017-01-18 10:12:52 +01:00
gebser d1f1f9230c added predicate 2017-01-17 19:52:12 +01:00
mgebser 59e95c7097 some refactoring 2017-01-17 17:15:21 +01:00
mgebser 18f4a87dd7 slight modification 2017-01-17 13:31:34 +01:00
gebser 664762fdec about to revise encodings 2017-01-17 10:12:37 +01:00
mgebser 1458d93408 more parallel ''exists'' encoding variants 2017-01-16 17:15:19 +01:00
Patrick Lühne 33e61beb4f
Fixed bug related to decomposing quantified expression. 2016-12-08 02:59:20 +01:00
Patrick Lühne 0b31d8d56c
Fixed bugs related in decomposition of expressions. 2016-12-08 02:54:28 +01:00
Patrick Lühne cb2db2cadf
Removed unnecessary test file copies in CMake configuration. 2016-12-08 02:16:17 +01:00
Patrick Lühne f1d2c4e532
Removed invalid to-do. 2016-12-08 01:58:36 +01:00
Patrick Lühne a07d105906
Added missing include. 2016-12-08 01:44:36 +01:00
Patrick Lühne 31182b6de9
Implemented translation of derived predicates in action preconditions. 2016-12-08 01:28:00 +01:00
Patrick Lühne 586f53a788
Restructured functions related to translation of predicates. 2016-12-08 01:27:38 +01:00
Patrick Lühne 1561aa5eb9
Put functions related to translation of predicates in separate file. 2016-12-08 01:18:00 +01:00
Patrick Lühne f4672a5b50
Added -Wextra flag to notice warnings more easily. 2016-12-08 01:17:09 +01:00
Patrick Lühne a5f1ebdc09
Removed unnecessary include directives. 2016-12-08 01:07:17 +01:00
Patrick Lühne 8587aa23c4
Put functions related to translation of variables in separate file. 2016-12-08 01:05:39 +01:00
Patrick Lühne 66cb09c8e4
Fixed incorrect auxiliary rule for derived predicates. 2016-12-08 00:54:13 +01:00
Patrick Lühne 6355921e59
Implemented preconditions for derived predicates. 2016-12-08 00:52:09 +01:00
Patrick Lühne 4172d320e4
Cleaned up output of translated derived predicates. 2016-12-07 23:26:46 +01:00
Patrick Lühne a8ba375e36
Implemented printing body of derived predicate definition rules. 2016-12-07 02:58:25 +01:00
Patrick Lühne 2334686c59
Renamed arguments to parameters in predicate declarations. 2016-12-07 02:55:44 +01:00
Patrick Lühne ebab65e233
Refactoring to avoid dynamic casts. 2016-12-07 02:29:48 +01:00
Patrick Lühne 692d3fe83a
Refactoring to avoid checking expression types via type enum. 2016-12-07 02:11:54 +01:00
Patrick Lühne 3b110c0b8a
Started implementing translation for derived predicates. 2016-12-07 01:56:06 +01:00
Patrick Lühne 443c126b88
Merge branch 'develop' of github.com:potassco/plasp into normalization 2016-12-05 02:23:43 +01:00
Patrick Lühne eb4798df4e
Updated catch. 2016-12-05 02:17:11 +01:00
Patrick Lühne c1340f6297
Merge branch 'develop' of github.com:potassco/plasp into normalization 2016-12-02 01:16:22 +01:00
Patrick Lühne 9e1cdaaa51
Implemented new command-line options replacing --warning-level. 2016-12-01 17:18:58 +01:00
Patrick Lühne cfce6b1bbd
Removed unnecessary namespace directive. 2016-12-01 16:26:29 +01:00
Patrick Lühne c4e19dddae
Refactoring to use cleaner output implementation. 2016-11-29 06:03:05 +01:00
Patrick Lühne 9b49b8ebe7
CMake project restructuring. 2016-11-29 02:55:26 +01:00
Patrick Lühne 8b069d8149
Minor formatting. 2016-11-29 02:11:43 +01:00
Patrick Lühne f4efb4f3d4
Improved command-line interface. 2016-11-29 02:05:01 +01:00
Patrick Lühne 180cc33ded
Merge branch 'develop' of github.com:potassco/plasp into develop 2016-11-29 01:32:25 +01:00
Patrick Lühne 431b33a4da
Merge branch 'master' of github.com:potassco/plasp into develop 2016-11-22 02:17:55 +01:00
Patrick Lühne 58e784408c
Fixed incorrect build status badge in readme. 2016-11-22 02:17:07 +01:00
Patrick Lühne 91b2a23c78
Added a sequential, fixed-horizon meta encoding. 2016-11-20 23:52:55 +01:00
Patrick Lühne cbbe942dfd
Merge branch 'master' of github.com:potassco/plasp into develop 2016-11-16 23:56:44 +01:00
Patrick Lühne 8bab1e19cb
Made readme file sections and documentation more consistent. 2016-11-16 23:53:21 +01:00
Patrick Lühne c80688b241
Changed format of readme file for STRIPS encodings to Markdown. 2016-11-16 23:46:00 +01:00
gebser b1e98bd091 README file summarizing functionalities and example invocations 2016-11-15 22:48:24 +01:00
gebser 367f49253e finalizing redundant rules to restrict number of parallel plans 2016-11-15 21:16:01 +01:00
mgebser 6f1a64a705 some restriction of instantiation 2016-11-15 19:34:07 +01:00
mgebser f12ac1c839 optional redundant rules to reduce the number of parallel plans 2016-11-15 18:57:52 +01:00
gebser 03c83702ad postprocessing encoding checked 2016-11-15 09:07:36 +01:00
mgebser e2c38b5459 Merge branch 'master' of ssh://github.com/potassco/plasp 2016-11-14 18:36:49 +01:00
mgebser 7f62503237 first version of postprocessing program to check plans and represent them sequentially 2016-11-14 18:36:01 +01:00
Patrick Lühne e1e9efde25
Added contributor. 2016-11-14 17:11:05 +01:00
Patrick Lühne fb3f847f6a
Merge branch 'develop' of github.com:potassco/plasp into develop 2016-11-14 17:10:07 +01:00
mgebser 888f12d88d completed main parallel planning encodings for STRIPS instances 2016-11-14 16:56:51 +01:00
mgebser b8357629a2 started to develop STRIPS encoding variants 2016-11-14 12:00:14 +01:00
Patrick Lühne 1b56e9ed9b
Merge branch 'master' of github.com:potassco/plasp into develop 2016-11-12 18:36:10 +01:00
Patrick Lühne ba63a9fb05
Moved Catch to lib directory. 2016-11-12 18:24:09 +01:00
Patrick Lühne 2585f726c5 Merge branch 'master' of github.com:potassco/plasp into develop 2016-11-04 16:15:42 +01:00
Patrick Lühne dadb1801aa Minor formatting in readme file. 2016-11-04 16:12:05 +01:00
Patrick Lühne 37732f35dd Merge branch 'develop' of github.com:potassco/plasp into develop 2016-11-04 16:11:26 +01:00
Patrick Lühne 2f6255a4e8 Added contributor. 2016-11-03 18:36:57 +01:00
Patrick Lühne 5d8c143e60 Added Travis target for g++ 6. 2016-10-11 00:30:42 +02:00
Patrick Lühne 0b94e315b4 Added compiler name to Travis configuration. 2016-10-10 20:56:09 +02:00
Patrick Lühne 4a422795d9 Added language specification to Travis configuration. 2016-10-10 20:46:25 +02:00
Patrick Lühne 1a27a21fa1 Added default packages and sources to Travis configuration. 2016-10-10 18:28:59 +02:00
Patrick Lühne bba069599f Merge branch 'develop' of github.com:potassco/plasp into develop 2016-10-10 18:24:05 +02:00
Patrick Lühne ba751f8c35 Added Travis target for g++ 6. 2016-10-10 18:22:56 +02:00
Patrick Lühne 1f7ee57889 Updated building instructions after change to Catch testing framework. 2016-10-08 16:06:37 +02:00
Patrick Lühne d4faaf428c Switched from Google Test to Catch. 2016-10-08 16:03:14 +02:00
Patrick Lühne a163278fb5 Added license file to PKGBUILD for AUR. 2016-10-07 18:41:53 +02:00
Patrick Lühne 1e2573d3e7 Added PKGBUILD for AUR. 2016-10-07 18:29:22 +02:00
Patrick Lühne 5c5f0665e8 Minor formatting. 2016-10-07 16:40:01 +02:00
Patrick Lühne 0ca51236bd Added unique ID to derived predicates for easier translation. 2016-09-09 17:08:31 +02:00
Patrick Lühne a62cc8b3b9 Started implementing derived predicates for decomposing complex PDDL conditions. 2016-09-09 16:42:16 +02:00
Patrick Lühne cc0b9726ed Added to-do. 2016-09-09 13:38:15 +02:00
Patrick Lühne bec63898af Updated change log with newly supported expression types. 2016-09-08 15:59:02 +02:00
Patrick Lühne 9cccba42e0 Implemented parsing conditional effects. 2016-09-08 15:56:30 +02:00
Patrick Lühne 4fc9b35c13 Implemented disjunctive normal form. 2016-09-08 03:42:32 +02:00
Patrick Lühne 34496a7158 Finished implementing the prenex normal form with maximal groups of same-type quantifiers. 2016-09-08 02:40:51 +02:00
Patrick Lühne e0ed145716 Implemented prenex normalization. 2016-09-07 00:34:26 +02:00
Patrick Lühne 2e52357dd2 Allowing universal quantifiers in effect expressions. 2016-09-06 22:36:48 +02:00
Patrick Lühne 104f7165cd Fixed compiler error occurring in debug mode only. 2016-09-06 21:47:03 +02:00
Patrick Lühne edbc8770e3 Testing simplification of nested existential quantifiers. 2016-09-06 18:51:29 +02:00
Patrick Lühne 31068bf89c Implemented simplification of nested quantified expressions. 2016-09-06 18:50:23 +02:00
Patrick Lühne ad6b3d60eb Implemented De Morgan normalization for quantified expressions. 2016-09-06 17:43:47 +02:00
Patrick Lühne bd2ef96216 Added forward declarations for quantified expressions. 2016-09-06 17:41:04 +02:00
Patrick Lühne faa920e1ad Correctly parsing quantified expressions thanks to variable stack. 2016-09-06 17:36:51 +02:00
Patrick Lühne eb28ed3938 Implemented variable stack for parsing nested variable lists (as within quantified expressions). 2016-09-06 17:34:07 +02:00
Patrick Lühne f4f0e07bc1 Started supporting quantified expressions. 2016-09-06 16:57:31 +02:00
Patrick Lühne ca6664feb2 Refactored parsing variable lists to reuse it with quantified expressions. 2016-09-06 16:28:38 +02:00
Patrick Lühne 6f3769f364 Removed unnecessary includes. 2016-09-05 17:05:48 +02:00
Patrick Lühne 0c5936ad38 Noted to-do. 2016-09-05 00:39:12 +02:00
Patrick Lühne 263b611a7b Implemented simplification of directly nested n-ary expressions of the same type. 2016-09-05 00:37:43 +02:00
Patrick Lühne 79d449d0df Renaming to not confuse expression simplification and reduction. 2016-09-05 00:06:09 +02:00
Patrick Lühne dd621fcd5c Minor clean-up. 2016-09-04 23:54:15 +02:00
Patrick Lühne c2af84a800 Removed redundant normalization statement. 2016-09-04 23:52:06 +02:00
Patrick Lühne 3fa7b93d44 Fixed wrong recursive call. 2016-09-04 23:34:20 +02:00
Patrick Lühne 4d72c20d9b Added separate simplification step to normalize in a single recursion. 2016-09-04 23:30:08 +02:00
Patrick Lühne 97ad4268d7 Added second double negation elimination step after normalizing the argument of a “not” expression. 2016-09-04 22:45:37 +02:00
Patrick Lühne ed2d64c1c9 Added debug printing function to facilitate testing expression normalization. 2016-09-04 22:26:17 +02:00
Patrick Lühne c9ecd0c020 Implemented De Morgan’s rules for normalization purposes. 2016-09-04 20:49:22 +02:00
Patrick Lühne 6aaf7c039d Refactored normalization because of recent changes to the pointer usage. 2016-09-04 19:29:05 +02:00
Patrick Lühne 7aa20a5820 Refactored expressions thanks to intrusive pointers. 2016-09-04 18:48:46 +02:00
Patrick Lühne 9afabacde3 Switched to intrusive pointers for much easier maintenance. 2016-09-04 18:26:02 +02:00
Patrick Lühne f10f4ac29c Added back reference expressions to make the expression tree structure simpler. 2016-09-04 14:49:34 +02:00
Patrick Lühne da88a8816c Fixed issue with multiple negations. 2016-09-03 00:25:58 +02:00
Patrick Lühne 63de1891af Fixed missing normalization step of arguments to imply statements and extended test to cover the issue. 2016-09-02 19:25:25 +02:00
Patrick Lühne 23e851ccef Normalizing problems’ goal descriptions. 2016-09-02 18:49:30 +02:00
Patrick Lühne 5f406e6b18 Added support for imply expressions to change log. 2016-09-02 18:46:24 +02:00
Patrick Lühne 9aad139aae Added test covering the removal of implications. 2016-09-02 18:45:00 +02:00
Patrick Lühne 4fb2c331f3 Added dummy expression to check that with removed double negations, expressions are still correctly normalized. 2016-09-02 18:32:13 +02:00
Patrick Lühne 1a96c3ec72 Added test covering removal of double negations. 2016-09-02 18:27:00 +02:00
Patrick Lühne b084a1f727 Implemented removal of double negations. 2016-09-02 18:07:37 +02:00
Patrick Lühne 56ce55677f Started implementing PDDL normalization. 2016-09-02 17:58:00 +02:00
Patrick Lühne c528626fe9 Preparing more general form of PDDL normalization. 2016-09-02 16:39:42 +02:00
Patrick Lühne 8361f3767b Version bump after release 3.0.3. 2016-09-02 15:46:58 +02:00
Patrick Lühne b72a17c190 Version bump for release 3.0.3. 2016-09-02 15:46:14 +02:00
Patrick Lühne 6842bff04b Removed temporary directory. 2016-09-02 15:45:44 +02:00
Patrick Lühne 6bec233e23 Moved IPC 2000 Elevator example instances to instance directory. 2016-09-02 15:44:33 +02:00
Patrick Lühne 873ccef4ff Moved IPC 2008 OpenStacks example instances to instance directory. 2016-09-02 15:44:12 +02:00
Patrick Lühne 4706d2915f Clarified how to plasp handle updates before executing the test suite. 2016-08-30 18:52:59 +02:00
Patrick Lühne 1d59ad20c1 Merge branch 'develop' of github.com:potassco/plasp into develop 2016-08-30 18:48:40 +02:00
Patrick Lühne b4f7e4f102 Added test case covering unexpected whitespaces in SAS file. 2016-08-30 18:48:24 +02:00
Patrick Lühne e664fe8470 Updated readme file with new location of the meta encoding. 2016-08-30 14:28:29 +02:00
Patrick Lühne 28b9d22a4c Hiding example instances from Linguist. 2016-08-30 13:05:03 +02:00
Patrick Lühne be376a9ffb Hiding mutex group section in output if there are none. 2016-08-30 13:02:00 +02:00
Patrick Lühne 76f8df13fc Fixed parsing issue with unexpected whitespaces in SAS files. 2016-08-30 13:01:22 +02:00
Patrick Lühne 9447912fbf Added a few SAS example instances for testing. 2016-08-29 18:26:59 +02:00
Patrick Lühne 87717606b2 Moved PDDL example instances to subdirectory. 2016-08-29 17:49:57 +02:00
Torsten Schaub 348bc32cef generated some sas files from Rene's PDDL samples
- should be deleted later -
2016-08-28 21:00:05 +02:00
Torsten Schaub fcdb0b65c2 fixed bug: frame axiom only on true fluents
renamed modified by changed (more frequent naming)
2016-08-28 20:53:25 +02:00
Torsten Schaub 0fb79d1268 just re-formatting 2016-08-26 18:21:33 +02:00
Torsten Schaub 69757e50ac fixed bug in conditional effects
- still one test screwing up -
2016-08-26 18:00:33 +02:00
Patrick Lühne 06feeab244 Merge branch 'master' of github.com:potassco/plasp into develop 2016-08-26 15:51:07 +02:00
Patrick Lühne 568945c7a8 Fixed incorrect output format of conditional effects with SAS. 2016-08-26 15:50:39 +02:00
Patrick Lühne dd33e47dd9 Fixed minor issues in output format documentation. 2016-08-26 15:42:39 +02:00
Torsten Schaub 7dfe760285 PRELIMINARY version of an encoding for sequential SAS planning
featuring: axioms and conditional effects
(extending Patrick's basic multi-valued encoding)
2016-08-23 18:31:33 +02:00
Torsten Schaub d7b8cec50d simple fixed horizon-based encoding for sequential PDDL planning 2016-08-23 11:51:03 +02:00
Torsten Schaub 92f3018b89 first throw at PDDL specifc encoding for sequential planning using Boolean fluents only 2016-08-22 22:35:35 +02:00
Patrick Lühne 3806fba9c2 Version bump after release 3.0.2. 2016-08-18 15:56:29 +02:00
Patrick Lühne b44c04d3c0 Version bump for release 3.0.2. 2016-08-18 15:55:51 +02:00
Patrick Lühne 220b9959a3 Added IPC 2004 Satellite example instances. 2016-08-18 15:51:58 +02:00
Patrick Lühne f8ec341015 Added IPC 2006 TPP example instances. 2016-08-18 15:43:14 +02:00
Patrick Lühne 3ceeb3ae40 Added IPC 2002 Driver Log example instances. 2016-08-18 15:29:27 +02:00
Patrick Lühne 56f0091f1e Added IPC 2002 Depots example instances. 2016-08-18 15:25:10 +02:00
Patrick Lühne ec886e345b Added IPC 2000 Elevator example instances. 2016-08-18 15:06:53 +02:00
Patrick Lühne 786eabb748 Added IPC 2000 Blocks World example instances. 2016-08-18 15:00:31 +02:00
Patrick Lühne fa18dc7979 Restructured example instances for consistency. 2016-08-18 14:53:26 +02:00
Patrick Lühne 136f9ed00a Added IPC 1998 Gripper example instances. 2016-08-18 14:40:06 +02:00
Patrick Lühne e312740629 Fixed syntax error in output. 2016-08-18 14:39:40 +02:00
Patrick Lühne 31d0a1fb38 Turned exception about unspecified requirements into a warning, now also for problems. 2016-08-18 14:30:47 +02:00
Patrick Lühne ca30f8a815 Turned exception about unspecified requirements into a warning. 2016-08-18 14:29:17 +02:00
Patrick Lühne 21c337e0fa Removed now obsolete ASP variable handling for PDDL. 2016-08-18 00:25:47 +02:00
Patrick Lühne 8251652445 Implemented parameter name normalization for PDDL to avoid escaping the names. 2016-08-18 00:24:10 +02:00
Patrick Lühne 5e28dd046b Further simplified the output of the PDDL variable value facts. 2016-08-18 00:00:50 +02:00
Patrick Lühne 363070b579 Replaced the two rules for the values of a PDDL variable with a single one. 2016-08-17 23:31:31 +02:00
Patrick Lühne 63ed1299ec Updated documentation to recent change of PDDL translator output. 2016-08-17 19:05:01 +02:00
Patrick Lühne 7bd483cd7e Added rule to PDDL translator output to make all unspecified initial state variables false by default. 2016-08-17 19:02:51 +02:00
Patrick Lühne 91019f52aa Fixed issue with unsupported expression negations. 2016-08-16 18:58:30 +02:00
Patrick Lühne 69a26cb22f Fixed undetected issue with unsupported negations. 2016-08-16 18:43:37 +02:00
Patrick Lühne cdb06fa5bf Improved output format and highlighting. 2016-08-16 18:35:55 +02:00
Patrick Lühne 9c76ce7174 Documented type inheritance. 2016-08-16 18:07:18 +02:00
Patrick Lühne 676dc44619 Updated meta encoding to new feature requirement format. 2016-08-15 18:24:51 +02:00
Patrick Lühne b8a3019e5b Made unconditional effects a keyword. 2016-08-15 16:59:28 +02:00
Patrick Lühne e0a15849df Updated documentation to changes of axiom rule output format. 2016-08-15 16:48:17 +02:00
Patrick Lühne ef57f27c6a Changed output format of axiom rules for consistency. 2016-08-15 16:33:33 +02:00
Patrick Lühne 169c5ae8e9 Fixed typo. 2016-08-15 15:26:34 +02:00
Patrick Lühne 760143a4a2 Documented CMake option for building tests. 2016-08-15 02:23:05 +02:00
Patrick Lühne b100bcd446 Disabled tests by default. 2016-08-15 02:23:05 +02:00
Patrick Lühne 04ddbaabae Version bump after release 3.0.2 RC 1. 2016-08-14 17:40:51 +02:00
Patrick Lühne 4a2882711d Version bump for release 3.0.2 RC 1. 2016-08-14 17:36:59 +02:00
Patrick Lühne 08113c961a Continuously incrementing effect IDs, with a special identifier for unconditional effects. 2016-08-14 17:21:41 +02:00
Patrick Lühne e2da46e20a Updated change log with documentation of output format. 2016-08-14 16:37:31 +02:00
Patrick Lühne 0cf44da917 Minor formatting. 2016-08-14 16:35:38 +02:00
Patrick Lühne d03638919a Added more detail to the command-line interface documentation. 2016-08-14 16:34:39 +02:00
Patrick Lühne f5d342a442 Minor formatting. 2016-08-14 16:33:11 +02:00
Patrick Lühne 06cab2f098 Put command-line interface documentation in a separate documentation file. 2016-08-14 16:31:23 +02:00
Patrick Lühne 9d67ae800d Put building instructions in a separate documentation file. 2016-08-14 16:27:43 +02:00
Patrick Lühne d2a1030320 Added link to output format to the readme file. 2016-08-14 16:23:28 +02:00
Patrick Lühne 5c17d23606 Added list of supported feature requirements. 2016-08-14 16:15:43 +02:00
Patrick Lühne bc1759aedf Minor formatting. 2016-08-14 16:09:36 +02:00
Patrick Lühne b9aef10db3 Documented axiom rules. 2016-08-14 16:07:45 +02:00
Patrick Lühne bdb6ac9fba Changed output format of axiom rules. 2016-08-14 16:02:28 +02:00
Patrick Lühne 4d5f935e82 Minor formatting. 2016-08-14 16:01:39 +02:00
Patrick Lühne d604e44dff Documented mutex groups. 2016-08-14 16:00:31 +02:00
Patrick Lühne 2c37da4cb4 Clarification about variables’ value uniqueness. 2016-08-14 16:00:09 +02:00
Patrick Lühne 741078c4fd Minor formatting. 2016-08-14 15:50:49 +02:00
Patrick Lühne e101cf2aab Documented action costs. 2016-08-14 15:49:34 +02:00
Patrick Lühne 3dfae74468 Documented goal. 2016-08-14 15:47:49 +02:00
Patrick Lühne 2363f42bc9 Minor clarification in the documentation concerning action sequences. 2016-08-14 15:46:12 +02:00
Patrick Lühne 491454ca3c Extended introduction to the documentation. 2016-08-14 15:44:14 +02:00
Patrick Lühne 562b2296e5 Documented initial state. 2016-08-14 15:39:25 +02:00
Patrick Lühne 3535afb1e1 Minor clarification concerning constants and objects. 2016-08-14 15:31:23 +02:00
Patrick Lühne 7a63e4abb9 Documented constants and objects. 2016-08-14 15:29:27 +02:00
Patrick Lühne 2281cd1cd4 Documented actions. 2016-08-14 15:14:27 +02:00
Patrick Lühne 4037b339e4 Changed keyword for conditions of conditional effects. 2016-08-14 15:14:13 +02:00
Patrick Lühne 00c3140f3b Restructured output format documentation once more and documented variables. 2016-08-14 14:58:04 +02:00
Patrick Lühne 0fb282d153 Changed output format of feature requirements. 2016-08-14 14:55:46 +02:00
Patrick Lühne 7a73f99581 Updated change log with recent fixes in SAS output formatting. 2016-08-13 19:14:04 +02:00
Patrick Lühne bdd68f04e1 Minor cleanup in documentation. 2016-08-13 19:02:05 +02:00
Patrick Lühne a5a300b150 Documented constants and objects. 2016-08-13 18:59:11 +02:00
Patrick Lühne 197cec923e Added introductory example to output format documentation. 2016-08-13 18:47:01 +02:00
Patrick Lühne c391a1f566 Removed unwanted newline in SAS output. 2016-08-13 18:44:18 +02:00
Patrick Lühne 1727113a8b Documented types. 2016-08-13 18:07:17 +02:00
Patrick Lühne 18ac959970 Restructured documentation of feature requirements and added an example. 2016-08-13 17:52:27 +02:00
Patrick Lühne d00c5bb753 Minor rephrasing in documentation. 2016-08-13 17:42:02 +02:00
Patrick Lühne ffcf07b935 Documented feature requirements. 2016-08-13 17:39:39 +02:00
Patrick Lühne 042531abc3 Started documenting the unified output format. 2016-08-13 13:35:30 +02:00
Patrick Lühne 4fc7355fba Removed unwanted newline. 2016-08-13 13:21:00 +02:00
Patrick Lühne c12be088c6 Updated change log with unified output format. 2016-08-13 11:12:38 +02:00
Patrick Lühne 9c3cfe8f7b Dropped »meta« prefix of encoding file because there will only be meta encodings. 2016-08-13 11:10:29 +02:00
Patrick Lühne d4c168af30 Unified SAS and PDDL meta encodings. 2016-08-13 11:09:35 +02:00
Patrick Lühne f2d3aee662 Updated PDDL meta encoding to recent changes of output format. 2016-08-13 11:09:35 +02:00
Patrick Lühne 340db244f6 Fixed bug in output format. 2016-08-13 04:04:28 +02:00
Patrick Lühne 8969364f73 Fixed syntax error in output format. 2016-08-13 03:27:37 +02:00
Patrick Lühne b67168134b Made initial state definition consistent with unified output format. 2016-08-13 03:22:25 +02:00
Patrick Lühne 97d33da686 Added effect ID as a placeholder (for conditional effects) for consistency with unified output format. 2016-08-13 03:17:48 +02:00
Patrick Lühne 1f35bda3d2 Wrapped translated PDDL action definitions for usability in meta encodings. 2016-08-13 03:11:38 +02:00
Patrick Lühne 6960e8a8c7 Wrapped translated PDDL constant definitions for usability in meta encodings. 2016-08-13 03:09:14 +02:00
Patrick Lühne b30cecd297 Turning translated PDDL predicates into unified variable format in rest of output format. 2016-08-13 03:08:05 +02:00
Patrick Lühne 99fc6988a3 Renamed heading to »variables«. 2016-08-13 02:50:07 +02:00
Patrick Lühne cf022f9959 Started turning translated PDDL predicates into unified variable format. 2016-08-13 02:48:30 +02:00
Patrick Lühne 0a1044743e Renamed meta predicate for simplicity. 2016-08-13 02:33:28 +02:00
Patrick Lühne 94b204615b Wrapped translated PDDL type definitions for usability in meta encodings. 2016-08-13 02:32:27 +02:00
Patrick Lühne 230c6dfc15 Made order of sections of translated SAS more uniform with PDDL. 2016-08-13 02:29:48 +02:00
Patrick Lühne 8be67e7065 Updated SAS meta encoding to recent changes of output format. 2016-08-13 01:49:00 +02:00
Patrick Lühne 378b2ae673 Wrapped translated SAS axiom rule definitions for usability in meta encodings. 2016-08-13 01:44:45 +02:00
Patrick Lühne 36e517bd80 Wrapped translated SAS mutex group definitions for usability in meta encodings. 2016-08-13 01:42:18 +02:00
Patrick Lühne 569b3d0c97 Wrapped translated SAS action definitions for usability in meta encodings. 2016-08-13 01:40:31 +02:00
Patrick Lühne daf68d24ab Added highlighting of variable names. 2016-08-13 01:39:49 +02:00
Patrick Lühne 8a82f52100 Wrapped translated SAS variable definitions for usability in meta encodings. 2016-08-13 01:36:08 +02:00
Patrick Lühne d0864b9efe Extended parser tests. 2016-08-08 12:40:02 +02:00
Patrick Lühne 18bd606262 Extended parser tests. 2016-08-07 16:46:48 +02:00
Patrick Lühne 252f50108b Removed unnecessary file. 2016-08-07 16:22:26 +02:00
Patrick Lühne 015c34fc2b Minor refactoring. 2016-08-03 00:33:20 +02:00
Patrick Lühne d7b47797df Made Stream members protected again. 2016-08-03 00:28:22 +02:00
Patrick Lühne 544d4e0635 Major refactoring of underlying Parser class. 2016-08-02 20:33:49 +02:00
Patrick Lühne 73c9d6c1f3 Checking that Parser initially is case-sensitive. 2016-06-22 09:14:01 +01:00
Patrick Lühne d9578b6f1c Testing Parser position with seek and advance. 2016-06-22 09:07:19 +01:00
Patrick Lühne b5e325cbee Testing Parser’s reset method. 2016-06-22 09:02:46 +01:00
Patrick Lühne 234938349c Fixed incorrect seek positions. 2016-06-22 08:59:18 +01:00
Patrick Lühne 9ed7277ec9 Fixed minor formatting issue with axiom rules. 2016-06-22 08:45:48 +01:00
Patrick Lühne dc87c09442 Merge branch 'master' of github.com:potassco/plasp into develop 2016-06-15 00:57:01 +02:00
Patrick Lühne 00688765fd Fixed typos in readme file. 2016-06-15 00:56:17 +02:00
Patrick Lühne 3702b72feb Version bump after release 3.0.1. 2016-06-15 00:18:09 +02:00
Patrick Lühne 9af383d2f6 Version bump for release 3.0.1. 2016-06-14 19:26:41 +02:00
Patrick Lühne d3039d55e5 Fixed typo in PDDL translation output. 2016-06-14 19:21:27 +02:00
Patrick Lühne 6b5c8df03a Fixed issues with color output. 2016-06-14 19:14:26 +02:00
Patrick Lühne 8084fe5574 Merge branch 'develop' of github.com:potassco/plasp 2016-06-14 18:54:43 +02:00
Patrick Lühne 3d661cd1f4 Fixed unescaped ASP identifier. 2016-06-14 18:53:50 +02:00
Patrick Lühne 853d7471c2 Added error message when using command-line options incorrectly. 2016-06-14 18:47:02 +02:00
Patrick Lühne 0a205680fe Made default color policy autodetection again. 2016-06-14 18:46:47 +02:00
Patrick Lühne 52fee6a4c1 Made the language command-line option lowercase for consistency. 2016-06-14 18:42:29 +02:00
Patrick Lühne fcdd3bba2b Added command-line options to readme file. 2016-06-14 18:40:40 +02:00
Patrick Lühne b491efa9f4 Minor rephrasing. 2016-06-14 18:30:06 +02:00
Patrick Lühne 401cf79cf6 Fixed incorrect usage information in help message. 2016-06-14 18:28:45 +02:00
Patrick Lühne 44a20ca7e3 Updated usage information in the readme file. 2016-06-14 18:25:24 +02:00
Patrick Lühne 5bda1c2245 Reordered change log items. 2016-06-14 18:08:32 +02:00
Patrick Lühne eb3d91f085 Added command-line option to autodetect, enable, or disable color output. 2016-06-14 18:02:59 +02:00
Patrick Lühne aff396d919 Colorizing numbers in translated SAS output. 2016-06-14 17:41:41 +02:00
Patrick Lühne f7cd24b67a Colorized output for SAS translator. 2016-06-14 17:35:32 +02:00
Patrick Lühne 1e21457efb Refactored color output of headings. 2016-06-14 17:11:45 +02:00
Patrick Lühne 583ec78eef Removed deleted methods. 2016-06-14 17:06:07 +02:00
Patrick Lühne 9969281b11 Refactored color output of variables and keywords. 2016-06-14 17:05:41 +02:00
Patrick Lühne 6fec1cc409 Made all error and warning messages lowercase consistently. 2016-06-14 16:53:48 +02:00
Patrick Lühne 2984da773d Fixed errors with gcc. 2016-06-14 16:47:11 +02:00
Patrick Lühne 1b83708a6d Colorized PDDL translator output. 2016-06-14 16:38:41 +02:00
Patrick Lühne 0de2489440 Using LogStreams in the PDDL translator. 2016-06-14 16:14:39 +02:00
Patrick Lühne fd5416c94e Removed template from LogStream. 2016-06-14 16:09:47 +02:00
Patrick Lühne 48137ec24d Fixed an issue with gcc 5. 2016-06-14 15:59:16 +02:00
Patrick Lühne febef4bed4 Made output and error streams members of the logger. 2016-06-14 15:56:35 +02:00
Patrick Lühne b599670572 Added LogStream class for uniform color output handling. 2016-06-14 15:53:53 +02:00
Patrick Lühne 57e9de6b05 Renamed method to »logWarning.« 2016-06-14 15:12:45 +02:00
Patrick Lühne 9679706a08 Removed ParserWarning class. 2016-06-14 15:09:39 +02:00
Patrick Lühne 777c9839a1 Removed error message prefixes. 2016-06-14 15:06:43 +02:00
Patrick Lühne a6c9434590 Fixed missing error message prefix. 2016-06-14 15:00:56 +02:00
Patrick Lühne fd77b65226 Merge branch 'master' of github.com:potassco/plasp into colored-output 2016-06-14 14:59:23 +02:00
Patrick Lühne a23063fd4f Minor formatting. 2016-06-14 14:22:41 +02:00
Patrick Lühne a7cf696357 Minor formatting. 2016-06-14 14:18:38 +02:00
Patrick Lühne 94d448d438 Minor formatting. 2016-06-14 14:05:38 +02:00
Patrick Lühne c62f3f88f1 Handling untyped variables as variables of type »object« in PDDL translator for simplicity. 2016-06-14 13:53:09 +02:00
Patrick Lühne 39a32a6e0a Handling untyped variables correctly in the PDDL translator. 2016-06-14 13:21:41 +02:00
Patrick Lühne 342a346fce Started implementing colored output. 2016-06-14 12:47:39 +02:00
Patrick Lühne e0dd9833a3 Made unsupported expressions a separate type for disambiguation to fix issues with unsupported features. 2016-06-14 01:31:22 +02:00
Patrick Lühne 591d3fcafd Correctly terminate plasp with failure exit code when unhandled exceptions are caught. 2016-06-14 00:32:26 +02:00
Patrick Lühne 22f294493e Removed bloated translation feature support checks and replaced them with inline ones. 2016-06-13 19:20:00 +02:00
Patrick Lühne 5d3496fa41 Fixed missing assignment of member variable in At expression parser. 2016-06-13 19:19:17 +02:00
Patrick Lühne 4b500e4bf6 Implemented At expressions. 2016-06-13 19:02:15 +02:00
Patrick Lühne da85e5dd9b Checking whether variables have types before accessing them in the PDDL translator. 2016-06-13 16:37:35 +02:00
Patrick Lühne 2b55d156ae Fixed performance issue caused by skipping over unsupported sections multiple times. 2016-06-13 16:17:55 +02:00
Patrick Lühne f24491cd5a Updated help message with PDDL support. 2016-06-13 15:01:23 +02:00
Patrick Lühne 268bee3c5f Updated change log with new command-line option --warning-level. 2016-06-13 14:46:30 +02:00
Patrick Lühne 5c3ea28e48 Added command-line option for treating warnings as errors or completely ignoring them. 2016-06-13 14:45:31 +02:00
Patrick Lühne fdbcb261df Avoiding empty arguments in n-ary expressions. 2016-06-13 14:04:12 +02:00
Patrick Lühne 2c3481d027 Initializing PDDL problem description only if available. 2016-06-13 13:37:18 +02:00
Patrick Lühne 1c2ad0ceec Updated change log with addition of basic PDDL translation. 2016-06-13 03:59:48 +02:00
Patrick Lühne 7899d3e262 Added simple encoding for translated PDDL instances. 2016-06-13 03:48:04 +02:00
Patrick Lühne 6b88cb7926 Renamed SAS → ASP encoding for clarity. 2016-06-13 03:32:58 +02:00
Patrick Lühne 421125fee6 Escaping PDDL identifiers for use with ASP. 2016-06-13 03:31:41 +02:00
Patrick Lühne 8563011939 Minor formatting. 2016-06-13 03:22:48 +02:00
Patrick Lühne e07672ffe6 Added transitive deduction of object types to PDDL translation. 2016-06-13 03:22:19 +02:00
Patrick Lühne 23f6f9b26b Added translation of a PDDL problem’s goal. 2016-06-13 03:19:24 +02:00
Patrick Lühne e9c464b319 Added translation of a PDDL problem’s initial state. 2016-06-13 02:59:43 +02:00
Patrick Lühne d3dc9101dd Added translation of objects in PDDL problems. 2016-06-13 02:48:16 +02:00
Patrick Lühne e018cdbc91 Added translation of effects of PDDL actions. 2016-06-13 02:41:23 +02:00
Patrick Lühne e2b8fd2880 Added translation for preconditions of PDDL actions. 2016-06-13 02:38:56 +02:00
Patrick Lühne 680206b40b Removed Reference expressions. 2016-06-13 01:38:56 +02:00
Patrick Lühne 1c8af793c2 Made PDDL action preconditions and effects optional. 2016-06-12 23:51:45 +02:00
Patrick Lühne 46351b2fe7 Ensuring that input contains only predicates, negations, and conjunctions for the time being. 2016-06-12 23:38:44 +02:00
Patrick Lühne 30cfa1b45e Fixes lambda issue with gcc. 2016-06-12 22:58:17 +02:00
Patrick Lühne 0756d63769 Put translation of PDDL variable lists into separate method. 2016-06-12 22:55:35 +02:00
Patrick Lühne 87ca54a253 Translating names of PDDL actions. 2016-06-12 22:47:39 +02:00
Patrick Lühne 9c2f49e4a0 Put PDDL translation sections into separate methods. 2016-06-12 22:39:04 +02:00
Patrick Lühne 49002ac52d Made output stream a member of the SAS translator for convenience. 2016-06-12 22:35:31 +02:00
Patrick Lühne b70e62ff3b Made output stream a member of the PDDL translator for convenience. 2016-06-12 22:31:31 +02:00
Patrick Lühne 046f803538 Implemented translation of PDDL predicates (with primitive types only). 2016-06-12 22:25:12 +02:00
Patrick Lühne 639b7646c9 Making sure that PDDL predicates contain only primitive types for the time being. 2016-06-12 22:19:55 +02:00
Patrick Lühne 89bb54a3ec Hiding translated PDDL sections if empty. 2016-06-12 22:19:24 +02:00
Patrick Lühne 979d9509c1 Added function for escaping ASP variables. 2016-06-12 22:12:43 +02:00
Patrick Lühne e9d48bcb7d Removing visitor pattern and replacing it with CRTP. 2016-06-12 22:12:09 +02:00
Patrick Lühne 318bd8297c Disambiguation of parser and translation errors in plasp binary. 2016-06-12 22:09:47 +02:00
Patrick Lühne 0513b3aa0c Implemented translation of PDDL domain constants. 2016-06-10 17:52:19 +02:00
Patrick Lühne 458dbd723c Restructured translated PDDL type output. 2016-06-10 17:48:17 +02:00
Patrick Lühne 8f0f4bfa65 Implemented translation of PDDL domain types. 2016-06-10 17:40:32 +02:00
Patrick Lühne da71d4947b Added method for checking whether PDDL description contains problem. 2016-06-10 17:26:36 +02:00
Patrick Lühne 6a83147ac0 Moved TranslatorException class to utils directory. 2016-06-10 17:21:56 +02:00
Patrick Lühne f6cfc55e21 Put exception handling back into plasp binary for convenient use. 2016-06-10 17:12:23 +02:00
Patrick Lühne 34a413cf05 Clarified error message. 2016-06-10 17:12:08 +02:00
Patrick Lühne 854ade5fa9 Ensuring input to contain only one SAS description. 2016-06-10 17:09:06 +02:00
Patrick Lühne be09230410 Added test for PDDL comment parsing. 2016-06-10 16:50:08 +02:00
Patrick Lühne 20b40d3e1c Allowing primitive type »objects« for compatibility. 2016-06-10 16:46:02 +02:00
Patrick Lühne 9f0e784a4a Implemented recognition of comments in PDDL. 2016-06-10 16:40:43 +02:00
Patrick Lühne 168fcc874e Added PDDL-related changes to change log. 2016-06-10 01:30:30 +02:00
Patrick Lühne d446c192cf Made plasp’s help message more precise. 2016-06-10 01:28:13 +02:00
Patrick Lühne eb5a120286 Fixed wrong comparison for language detection. 2016-06-10 01:25:51 +02:00
Patrick Lühne 2e1a011dcf Implemented automatic language detection for plasp application. 2016-06-10 01:23:41 +02:00
Patrick Lühne 8ef874eb22 Simplified plasp application by initializing parser externally. 2016-06-10 00:59:44 +02:00
Patrick Lühne c6dc84f27f Removed now unnecessary check for number of files with SAS parser. 2016-06-10 00:51:31 +02:00
Patrick Lühne 8bb25e9b90 Implemented construction of SAS and PDDL Descriptions from Parser object. 2016-06-10 00:46:40 +02:00
Patrick Lühne c6bdfe3f38 Renamed issue checking test. 2016-06-09 23:35:57 +02:00
Patrick Lühne d1063b345d Renamed error detection tests. 2016-06-09 23:31:12 +02:00
Patrick Lühne dea879199a Removed debug output. 2016-06-09 23:26:00 +02:00
Patrick Lühne 9a034cb556 Testing goal for Storage problem. 2016-06-09 23:21:05 +02:00
Patrick Lühne 5cd22d284b Testing goal for Blocks World problem. 2016-06-09 23:19:20 +02:00
Patrick Lühne f8fc1865a2 Added to-do. 2016-06-09 22:55:16 +02:00
Patrick Lühne 85444f235b Parsing goal section of PDDL problem specifications. 2016-06-09 22:54:39 +02:00
Patrick Lühne 15061f75a9 Added test covering last issue. 2016-06-09 18:48:16 +02:00
Patrick Lühne d138e869fc Fixed further white space issue with empty n-ary predicates. 2016-06-09 18:46:06 +02:00
Patrick Lühne 23170e170a Added test covering last two issues. 2016-06-09 18:32:55 +02:00
Patrick Lühne 156dfd88c2 Fixed issue with parsing unsupported sections. 2016-06-09 18:30:34 +02:00
Patrick Lühne 730a9b7e63 Fixed whitespace issues when parsing constants. 2016-06-09 18:26:04 +02:00
Patrick Lühne 3041b6a278 Testing initial state for Storage problem. 2016-06-09 18:16:51 +02:00
Patrick Lühne 2da5be548a Testing initial state for Blocks World problem. 2016-06-09 18:13:19 +02:00
Patrick Lühne 6f1b38cdb7 Fixed parsing issue with predicates in problem description. 2016-06-09 18:04:24 +02:00
Patrick Lühne a8e4ef7234 Added missing implementation of facts accessor of InitialState. 2016-06-09 18:03:43 +02:00
Patrick Lühne c7405e054f Minor formatting. 2016-06-09 18:03:32 +02:00
Patrick Lühne 9506dcb31e Refactored parsing of expressions, all classes parse from opening to closing parenthesis now. 2016-06-09 17:51:10 +02:00
Patrick Lühne 04aac10f1d Allowing empty and expressions for compatibility and added a warning if used. 2016-06-09 15:56:14 +02:00
Patrick Lühne bbb6379907 Added goal-utilities requirement with a warning if used for compatibility. 2016-06-09 15:52:57 +02:00
Patrick Lühne 26d7e216a6 Fixed issue with invalid suffixes on section names. 2016-06-09 15:33:09 +02:00
Patrick Lühne d629f50661 Added many PDDL syntax error tests. 2016-06-09 15:19:01 +02:00
Patrick Lühne 2245422d0f Made parser exception message more meaningful. 2016-06-09 15:18:36 +02:00
Patrick Lühne 87889f5efe Implemented two-pass parsing for PDDL problems. 2016-06-09 14:39:03 +02:00
Patrick Lühne fb15a131ac Enabling tests by default. 2016-06-09 01:25:50 +02:00
Patrick Lühne 8428c20bd4 Parsing domains in two passes and continued working on parsing the initial state. 2016-06-09 01:25:18 +02:00
Patrick Lühne ff7a6b8c8f Removed unnecessary include. 2016-06-08 16:52:44 +02:00
Patrick Lühne d92a3e9239 Started testing PDDL problem parsing for a Storage problem. 2016-06-08 13:57:01 +02:00
Patrick Lühne d23ec14e9d Started testing PDDL problem parsing for a Blocks World problem. 2016-06-08 13:52:36 +02:00
Patrick Lühne ad23c89266 Refactored PDDL tests. 2016-06-08 13:41:17 +02:00
Patrick Lühne 1c8958ad9d Check that variables are not declared multiple times. 2016-06-08 13:35:10 +02:00
Patrick Lühne c99b7018c6 Checking that type declarations are not missing. 2016-06-08 13:34:41 +02:00
Patrick Lühne f2089f48b8 Fixed typo. 2016-06-08 12:56:50 +02:00
Patrick Lühne 75e51c856e Implemented early checking for typing requirement in Variables and Constants. 2016-06-08 12:51:39 +02:00
Patrick Lühne e60af33f75 Added functions for checking PDDL requirements. 2016-06-08 12:22:31 +02:00
Patrick Lühne 993d14d409 Implemented type requirement checking for problem objects. 2016-06-08 01:51:45 +02:00
Patrick Lühne bf0e636d57 Fixed PDDL problem header parsing. 2016-06-08 01:51:21 +02:00
Patrick Lühne 374ac3b07f Removed unneeded temporary object. 2016-06-08 01:44:06 +02:00
Patrick Lühne 183b0c954e Fixed debug output. 2016-06-08 01:41:21 +02:00
Patrick Lühne 42559fd601 Minor refactoring removing unnecessary temporary variable. 2016-06-08 01:31:14 +02:00
Patrick Lühne 069ad4ca99 To-dos and formatting. 2016-06-08 01:19:49 +02:00
Patrick Lühne 8db4b5a53e Implemented constant type checking. 2016-06-08 01:14:39 +02:00
Patrick Lühne 32883910bb Fixed typo. 2016-06-08 01:12:29 +02:00
Patrick Lühne 9b3f78559e Implemented primitive type declaration check. 2016-06-08 01:08:22 +02:00
Patrick Lühne 7bd2782fc8 Implemented variable type requirement checking. 2016-06-08 01:05:36 +02:00
Patrick Lühne 75fbb5fb48 Checking type requirement. 2016-06-08 00:48:33 +02:00
Patrick Lühne af2f9290c6 Removed obsolete functionality. 2016-06-08 00:36:48 +02:00
Patrick Lühne 31fb8ba79b Started parsing in a two-pass approach. 2016-06-08 00:34:59 +02:00
Patrick Lühne ee9626e4d2 Made the section skipping function a proper function. 2016-06-08 00:14:43 +02:00
Patrick Lühne 9360f4295a Extracted function for skipping entire sections. 2016-06-08 00:13:53 +02:00
Patrick Lühne abfa3b3ca1 Added -Wextra compiler flag. 2016-06-08 00:13:07 +02:00
Patrick Lühne a1b93624d6 Fixed accepting std::cin input when omitting input file arguments. 2016-06-08 00:06:54 +02:00
Patrick Lühne 69ff84eecc Added efficient probing functions to Parser. 2016-06-08 00:02:40 +02:00
Patrick Lühne 78889e18c6 Fixed accidentally removed std::cin support. 2016-06-07 23:31:09 +02:00
Patrick Lühne fa178d5ee1 Fixed SAS file input bug. 2016-06-07 20:59:02 +02:00
Patrick Lühne eea3272c56 Made Parser seekable for easier maintenance. 2016-06-07 18:41:01 +02:00
Patrick Lühne 27e76fc035 Added check that typing requirement is not added by PDDL problem. 2016-06-07 16:34:15 +02:00
Patrick Lühne 188165bc4d Added fix for gcc. 2016-06-07 16:14:35 +02:00
Patrick Lühne e6ddad5960 Checking that all variables in predicates have types if and only if typing is enabled. 2016-06-07 16:11:12 +02:00
Patrick Lühne 4228ca01dc Implemented multi-file input. 2016-06-07 15:54:01 +02:00
Patrick Lühne 64190ba55a Added more tests for PDDL actions. 2016-06-07 14:07:17 +02:00
Patrick Lühne c489c7fd5a Added tests for PDDL actions. 2016-06-07 14:00:29 +02:00
Patrick Lühne acc063822e Minor formatting in PDDL parser tests. 2016-06-07 13:40:01 +02:00
Patrick Lühne b612122180 Refactoring to make parsing expressions consistent across PDDL domains and problems. 2016-06-07 13:26:19 +02:00
Patrick Lühne d5fa00a4a4 Started parsing initial state and object sections. 2016-06-06 15:18:06 +02:00
Patrick Lühne e607ca4e8e Refactored PDDL parser to make all input case-insensitive. 2016-06-04 18:28:43 +02:00
Patrick Lühne d64c68f754 Improved error message. 2016-06-04 18:21:42 +02:00
Patrick Lühne e5bf7d754f Refactored expression parsing. 2016-06-04 18:12:41 +02:00
Patrick Lühne 0e739755b7 Making References transparent by forwarding visitors to their referee. 2016-06-04 18:08:34 +02:00
Patrick Lühne f8eab1cbb6 Removed unnecessary includes. 2016-06-04 18:07:57 +02:00
Patrick Lühne 0f2c81f894 Added to-dos. 2016-06-04 17:55:17 +02:00
Patrick Lühne e481732fae Started implementation of PDDL problem parser. 2016-06-04 17:53:42 +02:00
Patrick Lühne ee597c805e Added to-do. 2016-06-04 17:52:37 +02:00
Patrick Lühne e561c55f73 Made Action section parsing case-insensitive. 2016-06-04 17:51:21 +02:00
Patrick Lühne 2870bc6434 Made section identifier parsing case-insensitive. 2016-06-04 17:47:41 +02:00
Patrick Lühne 7e60631840 Refactored Requirement parsing. 2016-06-04 17:47:01 +02:00
Patrick Lühne f2a1528ea9 Fixed determination of default requirement (STRIPS). 2016-06-04 17:28:52 +02:00
Patrick Lühne 21af7e9983 Removed unnecessary include. 2016-06-04 17:22:57 +02:00
Patrick Lühne 4ae37603f4 Added support for Imply expression. 2016-06-04 17:20:25 +02:00
Patrick Lühne 30b4a1f614 Made include guards consistent. 2016-06-04 17:10:50 +02:00
Patrick Lühne 2797b58646 Added missing ParserWarning file. 2016-06-04 16:45:14 +02:00
Patrick Lühne 837612bb8d Made type warnings non-fatal by default. 2016-06-04 16:42:41 +02:00
Patrick Lühne 813fecbf15 Removed now unnecessary Parser function arguments. 2016-06-04 16:24:10 +02:00
Patrick Lühne a776fc9e06 Put Parser into Context. 2016-06-04 16:10:11 +02:00
Patrick Lühne 08eb14e400 Made section parsing function names consistent. 2016-06-04 15:07:18 +02:00
Patrick Lühne 60c072a2b3 Clean-up. 2016-06-04 15:06:04 +02:00
Patrick Lühne feedb95295 Turned exception about undeclared types into a consistency warning. 2016-06-04 15:04:18 +02:00
Patrick Lühne c93661f44e Finished refactoring of expressions. 2016-06-04 14:46:05 +02:00
Patrick Lühne daa063c338 Big refactoring (build still broken). 2016-06-03 17:12:39 +02:00
Patrick Lühne 5abf1f8a84 Removed obsolete Variable class. 2016-06-03 13:37:23 +02:00
Patrick Lühne 133aa051eb Shortened Expression class names. 2016-06-03 13:33:05 +02:00
Patrick Lühne d334b4150b Started refactoring Variables as expressions. 2016-06-03 13:21:02 +02:00
Patrick Lühne 36e28994ee Updated change log. 2016-06-03 00:19:05 +02:00
Patrick Lühne 01908c52f8 Merge branch 'master' of github.com:potassco/plasp into develop 2016-06-03 00:15:40 +02:00
Patrick Lühne f9463d629a Added Travis badge for develop branch to readme file. 2016-06-03 00:14:51 +02:00
Patrick Lühne 50315f5fae Relaxing white space requirements. 2016-06-02 23:41:40 +02:00
Patrick Lühne 8817a3f226 Fixed whitespace parsing issue. 2016-06-02 22:47:25 +02:00
Patrick Lühne fcde9c9b6b Finished basic support for action parsing. 2016-06-02 22:31:02 +02:00
Patrick Lühne fb5a5a71a5 Removed unnecessary include. 2016-06-02 21:56:40 +02:00
Patrick Lühne 8134c6af80 Started parsing action effects. 2016-06-02 21:53:10 +02:00
Patrick Lühne 7271a5e52b Implemented predicate expressions. 2016-06-02 18:31:47 +02:00
Patrick Lühne 7baf15d9f0 Implemented And expressions. 2016-06-02 17:35:01 +02:00
Patrick Lühne d070b5be9e Added expression visitor base class. 2016-06-02 16:29:17 +02:00
Patrick Lühne 63d74e3524 Replaced tabs with spaces in test file to get more accurate parser positions in errors. 2016-06-02 16:28:26 +02:00
Patrick Lühne a07019801c Refactored expressions to inherit from base class. 2016-06-02 16:28:08 +02:00
Patrick Lühne 97ab22461c Started implementing parsing of action preconditions. 2016-06-02 16:06:11 +02:00
Patrick Lühne 138db460a9 Merge branch 'master' of github.com:potassco/plasp into pddl-parser 2016-06-01 22:54:49 +02:00
Patrick Lühne a9c0431ded Changed Travis configuration to use 3 threads for building. 2016-06-01 22:49:59 +02:00
Patrick Lühne 7e4a05e1db Assuming parent types to be declared properly. 2016-06-01 18:09:40 +02:00
Patrick Lühne 0a4541a401 Put parsing of typed variables into Variables class. 2016-06-01 17:20:34 +02:00
Patrick Lühne 79773ba634 Removed unnecessary include. 2016-06-01 17:06:23 +02:00
Patrick Lühne b249e1cbf8 Put generic Type parsing in separate function. 2016-06-01 17:02:35 +02:00
Patrick Lühne 25cf7c8ae8 Implemented parsing of PDDL constants. 2016-06-01 16:47:34 +02:00
Patrick Lühne 3c97ced486 Implemented predicate parsing and refactored context storage. 2016-06-01 14:11:13 +02:00
Patrick Lühne 44482ae438 Renamed TypePrimitive to PrimitiveType and made Type hash map contain PrimitiveTypes only. 2016-06-01 01:54:43 +02:00
Patrick Lühne f597b3ab80 Moved include to the right location. 2016-06-01 01:32:49 +02:00
Patrick Lühne b8223b42bd Removed unnecessary include. 2016-06-01 01:31:14 +02:00
Patrick Lühne ced1fd0038 Started refactoring Types with variants. 2016-06-01 01:29:46 +02:00
Patrick Lühne 2654a6ff23 Started implementing predicate parsing. 2016-05-31 16:43:25 +02:00
Patrick Lühne 5f763e90fc Refactored Requirement to be a proper class. 2016-05-31 14:11:21 +02:00
Patrick Lühne cf1c66a085 Refactored interface for parsing Types. 2016-05-31 14:01:18 +02:00
Patrick Lühne 1395b62e60 Added checks that used types are correctly declared previously. 2016-05-31 13:50:30 +02:00
Patrick Lühne 85da5024ea Refactored type parsing. 2016-05-31 01:06:57 +02:00
Patrick Lühne a989f5f86e Started implementing PDDL type parsing. 2016-05-30 20:43:36 +02:00
Patrick Lühne 1c4c035acc Added missing test file for PDDL parser tests. 2016-05-30 15:47:57 +02:00
Patrick Lühne d26ff2df77 Implemented computation of derived requirements. 2016-05-30 15:44:13 +02:00
Patrick Lühne 5c37026ec7 Parsing PDDL requirements. 2016-05-30 15:06:04 +02:00
Patrick Lühne 8aa419b5c2 Implemented requirement parsing. 2016-05-30 14:34:17 +02:00
Patrick Lühne c191b418f2 Added PDDL requirements enum. 2016-05-30 13:36:47 +02:00
Patrick Lühne 0eb2714c9e Removed incorrect parentheses check. 2016-05-30 13:22:17 +02:00
Patrick Lühne 0b33ac0e7d Minor formatting. 2016-05-30 13:06:10 +02:00
Patrick Lühne f55e366b17 Removed unnecessary statement. 2016-05-30 13:03:18 +02:00
Patrick Lühne b89b1708c3 Additional line-skipping tests for Parser. 2016-05-30 13:00:55 +02:00
Patrick Lühne f9c5a830e1 Additional assertions in Parser test cases. 2016-05-30 12:58:10 +02:00
Patrick Lühne 348bd98de8 Extended Parser tests with whitespace handling check. 2016-05-30 12:56:30 +02:00
Patrick Lühne 4d984d32c3 Refactoring of Parser class with std::istreambuf_iterator. 2016-05-30 12:54:56 +02:00
Patrick Lühne 8d879344f2 Merge branch 'pddl-parser' of github.com:potassco/plasp into pddl-parser 2016-05-30 12:54:41 +02:00
Patrick Lühne 40547691a0 Started implementing PDDL domain parser. 2016-05-30 12:51:00 +02:00
Patrick Lühne 8f705b0737 Added test for Parser’s cursor position. 2016-05-30 12:32:13 +02:00
Patrick Lühne 67c9e2148d Started implementing PDDL domain parser. 2016-05-29 16:55:43 +02:00
Patrick Lühne 42fda5925d Simplified Parser interface. 2016-05-29 15:08:10 +02:00
Patrick Lühne 2c564f47d3 Refactored predicate argument parsing. 2016-05-28 14:21:05 +02:00
Patrick Lühne b4bc347006 Removed unnecessary include. 2016-05-28 14:18:51 +02:00
Patrick Lühne f81fd1a1b4 Introduced alias for parser’s underlying character type. 2016-05-27 19:25:59 +02:00
Patrick Lühne a1b334a302 Made Parser constructor explicit. 2016-05-27 19:08:31 +02:00
Patrick Lühne ff420fbe57 Minor formatting. 2016-05-27 18:39:43 +02:00
Patrick Lühne 07eb23b312 Refactored basic parsing. 2016-05-27 03:58:59 +02:00
Patrick Lühne 6017cfe3d5 Removed version numbers from contributors to earlier versions. 2016-05-26 13:01:46 +02:00
Patrick Lühne 8eb0a4847f Refactoring of TranslatorASP class. 2016-05-26 12:59:18 +02:00
Patrick Lühne 47f269782e Reduced the number of boost dependencies with Travis. 2016-05-26 00:23:30 +02:00
Patrick Lühne d9a40af3f0 Using unsigned constants in tests to avoid warnings with Google Test. 2016-05-26 00:17:55 +02:00
Patrick Lühne 2281967176 Added info about running the tests to the readme file. 2016-05-26 00:11:32 +02:00
Patrick Lühne 6b38b55c58 Merge branch 'master' of github.com:potassco/plasp 2016-05-25 23:50:38 +02:00
Patrick Lühne 12ffbb4d80 Ignoring configuration files for exporting the repository. 2016-05-25 23:49:58 +02:00
Patrick Lühne 045239b620 Fixed wrong operator in debug output. 2016-05-25 23:22:25 +02:00
Patrick Lühne dda81e9011 Merge branch 'master' of github.com:potassco/plasp 2016-05-25 23:02:17 +02:00
Patrick Lühne 98a15bbf8e Removed gtest package from Travis configuration to properly use the git submodule instead. 2016-05-25 23:01:42 +02:00
Patrick Lühne 7a8b562173 Fixed URLs in readme file. 2016-05-25 18:11:00 +02:00
Patrick Lühne 0cbb3453bd Added version badge to readme file. 2016-05-25 18:04:49 +02:00
Patrick Lühne 062a04233f Changed license to Markdown format. 2016-05-25 12:44:28 +02:00
Patrick Lühne 75c841e3c5 Added change log. 2016-05-25 12:42:31 +02:00
Patrick Lühne 441b8b0154 Added support for input from std::cin. 2016-05-25 12:36:45 +02:00
333 changed files with 37725 additions and 880 deletions

6
.gitattributes vendored
View File

@ -1 +1,7 @@
.gitignore export-ignore
.gitattributes export-ignore
.gitmodules export-ignore
.travis.yml export-ignore
tests/data/* linguist-documentation
instances/* linguist-documentation

16
.gitmodules vendored
View File

@ -1,4 +1,12 @@
[submodule "tests/googletest"]
path = tests/googletest
url = https://github.com/google/googletest.git
ignore = dirty
[submodule "lib/catch"]
path = lib/catch
url = https://github.com/catchorg/Catch2
[submodule "lib/variant"]
path = lib/variant
url = https://github.com/mapbox/variant
[submodule "tests/data/pddl-instances"]
path = tests/data/pddl-instances
url = https://github.com/potassco/pddl-instances.git
[submodule "lib/cxxopts"]
path = lib/cxxopts
url = https://github.com/jarro2783/cxxopts

View File

@ -1,21 +1,29 @@
# Use container-based distribution
sudo: false
language: c++
addons:
apt:
sources: &default_sources
- ubuntu-toolchain-r-test
matrix:
include:
- compiler: gcc
- env: COMPILER_NAME=g++ _CXX=g++-6
os: linux
language: cpp
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- boost-latest
- *default_sources
packages:
- g++-5
- libboost1.55-all-dev
- libgtest-dev
env: COMPILER=g++-5
- g++-6
script:
- mkdir build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DCMAKE_CXX_COMPILER=$COMPILER
- make && make run-tests
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http://www.cmake.org/files/v3.9/cmake-3.9.4-Linux-x86_64.tar.gz";
mkdir cmake-bin && wget --quiet --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake-bin;
export PATH=${PWD}/cmake-bin/bin:${PATH};
fi
- git submodule update --recursive --init
- mkdir -p build/debug
- cd build/debug
- cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=$_CXX -DTOKENIZE_BUILD_TESTS=ON -DPDDL_BUILD_TESTS=ON -DPLASP_BUILD_TESTS=ON
- make -j3 plasp-app && make -j3 run-tokenize-tests && make -j3 run-pddl-tests && make -j3 run-tests

84
CHANGELOG.md Normal file
View File

@ -0,0 +1,84 @@
# Changelog
## (unreleased)
## 3.1.1 (2017-11-25)
### Bug Fixes
* fixes ASP syntax issues caused by hyphens in variable names by replacing all user-defined variables with `X1`, `X2`, etc.
## 3.1.0 (2017-11-17)
### Changes
* new command-line interface based on `plasp` commands:
* `plasp translate`: translate PDDL and SAS to ASP facts (replaces former, plain `plasp` calls)
* `plasp normalize`: normalize PDDL to plasps custom PDDL format
* `plasp check-syntax`: check the syntax of PDDL specifications
* `plasp beautify`: cleanly format PDDL specifications
* new output format to accommodate for new PDDL features
### Features
* extended PDDL 3.1 support:
* arbitrarily nested expressions in preconditions, effects, and goal description (via derived predicates)
* universal and existential quantifiers
* disjunctions
* conditional effects
* implications
* equality (parser only)
* new output option `--log-level` to control which status messages to show
* new basic option `--warnings-as-errors` to abort program execution upon warnings (replaces `--warning-level`)
* new compatibility mode for parser to support more legacy domains
* new parser option `--parsing-mode` to specify whether to apply strict or compatibility parsing rules
### Internal
* PDDL parser reimplemented from scratch in stand-alone `pddl` library
* removes dependency to Boost
## 3.0.3 (2016-09-02)
### Bug Fixes
* fixes incorrect output format of conditional effects with SAS
* fixes parsing issue with unexpected whitespaces in SAS files
## 3.0.2 (2016-08-18)
### Features
* unified translation format for SAS and PDDL files
* documentation of `plasp`s output format
* improved output syntax highlighting
* uses ASP string literals to avoid escaping PDDL identifiers
### Bug Fixes
* fixes minor formatting issues in SAS translation
* fixes issue with unsupported expression negations
## 3.0.1 (2016-06-14)
### Features
* basic support for parsing PDDL 3.1 domains and problems
* limited support for translating PDDL 3.1 domains and problems to ASP facts
* automatic language detection for PDDL and SAS
* supports input from `std::cin`
* supports colorized output
* new command-line option `--language` to explicitly specify input language
* new command-line option `--warning-level` to treat warnings as errors or to ignore warnings
* new command-line option `--color` to autodetect, enable, or disable color output
### Bug Fixes
* fixes bug in translation of SAS axiom rules
## 3.0.0 (2016-05-24)
### Features
* parses [SAS](http://www.fast-downward.org/TranslatorOutputFormat) files created with [Fast Downward](http://www.fast-downward.org/)
* experimental translation from SAS to ASP facts

View File

@ -1,20 +1,40 @@
cmake_minimum_required(VERSION 2.6)
project(plasp CXX)
find_package(Boost 1.55.0 COMPONENTS program_options iostreams system filesystem REQUIRED)
option(PLASP_BUILD_TESTS "Build unit tests" OFF)
option(PLASP_BUILD_STATIC "Build static binaries" OFF)
set(CMAKE_CXX_FLAGS "-Wall -Wpedantic")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
add_definitions(-std=c++14)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -Werror ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-g ${CMAKE_CXX_FLAGS_DEBUG}")
option(BUILD_TESTS "Build unit tests" OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(PLASP_BUILD_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "-static")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)
set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
endif()
if (CMAKE_GENERATOR STREQUAL "Ninja" AND
((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)))
# Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support.
# Rationale in https://github.com/ninja-build/ninja/issues/814
set(CMAKE_CXX_FLAGS "-fdiagnostics-color=always ${CMAKE_CXX_FLAGS}")
endif()
add_subdirectory(lib/tokenize)
add_subdirectory(lib/colorlog)
add_subdirectory(lib/pddl)
add_subdirectory(src)
add_subdirectory(apps)
if(BUILD_TESTS)
add_subdirectory(app)
if(PLASP_BUILD_TESTS)
add_subdirectory(tests)
endif(BUILD_TESTS)
endif(PLASP_BUILD_TESTS)

20
KNOWN-ISSUES.md Normal file
View File

@ -0,0 +1,20 @@
# Known Issues
## Parser
- multiple PDDL features are not yet supported (see list of PDDL features supported by `plasp`)
- several error messages obtained with syntax errors are misleading
## Translator
- in compatibility mode, the outdated `vars` sections within action definitions are handled just like `parameters`, which is semantically incorrect
- equality expressions currently partly supported by parser but not the translator
## ASP Output Format
- SAS axiom rules and `plasp`s derived predicates (obtained through normalization) are semantically similar, but differently represented
## Encodings
- the [simple example encoding](encodings/sequential-horizon.lp) does not SAS axiom rules
- [multiple encodings](encodings/outdated) are outdated and need to be adapted to the output format introduced with `plasp` 3.1.0

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
# The MIT License (MIT)
Copyright (c) 2016 Patrick Lühne
Copyright © 2016 Patrick Lühne
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,56 +1,89 @@
# plasp—Translate PDDL to ASP
# plasp [![GitHub Release](https://img.shields.io/github/release/potassco/plasp.svg?maxAge=3600)](https://github.com/potassco/plasp/releases) [![Build Status](https://img.shields.io/travis/potassco/plasp/master.svg?maxAge=3600&label=build%20%28master%29)](https://travis-ci.org/potassco/plasp?branch=master) [![Build Status](https://img.shields.io/travis/potassco/plasp/develop.svg?maxAge=3600&label=build%20%28develop%29)](https://travis-ci.org/potassco/plasp?branch=develop)
[![Build Status](https://travis-ci.org/potassco/plasp.svg?branch=master)](https://travis-ci.org/potassco/plasp)
> ASP planning tools for PDDL
`plasp` 3 is in early development and not intended for productive use yet.
## Overview
As of now, `plasp` 3 experimentally supports the full [SAS Format](http://www.fast-downward.org/TranslatorOutputFormat) (as of version 3) used by [Fast Downward](http://www.fast-downward.org/).
`plasp` is a tool collection for planning in [*answer set programming*](https://en.wikipedia.org/wiki/Answer_set_programming).
`plasp` 3 supports the input languages [PDDL 3.1](https://helios.hud.ac.uk/scommv/IPC-14/software.html) (except for advanced features such as durative actions, numerical fluents, and preferences) and [SAS](http://www.fast-downward.org/TranslatorOutputFormat) (full support of SAS 3), which is used by [Fast Downward](http://www.fast-downward.org/).
Please get in touch with [Patrick Lühne](https://www.luehne.de) if you have any suggestions.
The most notable tool provided by `plasp` is `plasp translate`, which translates PDDL descriptions to ASP facts.
## Usage
## Translating PDDL to ASP Facts
To translate an SAS file into ASP facts, call:
PDDL instances are translated to ASP facts as follows:
```bash
$ plasp file.sas
```sh
plasp translate domain.pddl problem.pddl
```
For instance, a PDDL instance can be solved as follows.
First, use [Fast Downward](http://www.fast-downward.org/) to translate the files from PDDL to SAS:
Alternatively, PDDL instances may first be translated to SAS, the output format of [Fast Downward](http://www.fast-downward.org/).
```bash
$ ./fast-downward.py --translate --build=release64 domain.pddl instance.pddl
```sh
./fast-downward.py --translate --build=release64 domain.pddl problem.pddl
```
This creates the file `output.sas`.
The translated SAS instance can now be solved incrementally with `clingo` and the meta encoding `meta-sequential-incremental.lp`:
This creates a file called `output.sas`, which may now be translated by `plasp` as well.
```bash
$ plasp output.sas > instance.lp
$ clingo encodings/meta-sequential-incremental.lp instance.lp
```sh
plasp translate output.sas
```
### Solving the Translated Instance
The translated instance can finally be solved with `clingo` and a meta encoding, for instance, [`sequential-horizon.lp`](encodings/sequential-horizon.lp):
```sh
plasp translate domain.pddl problem.pddl > instance.lp
clingo encodings/sequential-horizon.lp -c horizon=10 instance.lp
```
### Translator Output Format
`plasp translate` provides a uniform output format for SAS and PDDL input problems.
See [output format](doc/output-format.md) for more details.
If you want to write your own meta encoding for `plasp translate`s output, this [simple example encoding](encodings/sequential-horizon.lp) gets you started.
## Provided Tools
```sh
plasp <command> [<option>...] [<input file>...]
```
Aside from translating PDDL to ASP facts, `plasp` provides the following commands:
| command | description |
|---|---|
| `translate` | Translate PDDL and SAS to ASP facts |
| `normalize` | Normalize PDDL to plasps custom PDDL format |
| `check-syntax` | Check the syntax of PDDL specifications |
| `beautify` | Cleanly format PDDL specifications |
| `help` | Display help message |
| `version` | Display version information |
`plasp help` shows a list of all commands provided by `plasp`.
To list all available options of a command, call `plasp <command> --help` or `plasp help <command>`.
`plasp` automatically detects the language (PDDL or SAS) of the input descriptions.
## Building
`plasp` requires a C++14 compiler (preferrably GCC ≥ 6.1), the `boost` libraries (≥ 1.55), and CMake for building.
`plasp` is built with CMake and a C++ compiler.
See [building](doc/building.md) for more details.
```bash
$ git clone https://github.com/potassco/plasp.git
$ cd plasp
$ mkdir -p build/release
$ cd build/release
$ cmake ../.. -DCMAKE_BUILD_TYPE=Release
$ make
```
## PDDL Feature Support
The built `plasp` binary is then located at `plasp/build/release/bin/plasp`.
`plasp` supports a subset of PDDL 3.1.
See [PDDL feature support](doc/pddl-feature-support.md) for a list of supported and unsupported PDDL 3.1 features.
## Contributors
* [Patrick Lühne](https://www.luehne.de) (`plasp` 3)
* [Patrick Lühne](https://www.luehne.de)
* Martin Gebser (encodings)
* Torsten Schaub (encodings)
### Earlier Versions
* René Knaebel (`plasp` 2)
* Murat Knecht (`plasp`)
* René Knaebel
* Murat Knecht

1
app/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory(src)

View File

@ -0,0 +1,71 @@
#ifndef __PLASP_APP__COMMAND_H
#define __PLASP_APP__COMMAND_H
#include <tuple>
#include <cxxopts.hpp>
#include <plasp-app/Utils.h>
#include <plasp-app/Version.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command
//
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class Derived, class... OptionGroups>
class Command
{
public:
void printHelp()
{
const auto numberOfOptionGroups = std::tuple_size<std::decay_t<decltype(m_optionGroups)>>();
std::vector<std::string> optionGroupNames;
optionGroupNames.reserve(numberOfOptionGroups + 1);
optionGroupNames.emplace_back("");
forEach(m_optionGroups,
[&](auto &optionGroup)
{
optionGroupNames.emplace_back(optionGroup.Name);
});
std::cout << m_options.help(optionGroupNames) << std::endl;
}
protected:
Command()
: m_options(std::string("plasp ") + Derived::Name, std::string(Derived::Description) + ".")
{
forEach(m_optionGroups,
[&](auto &optionGroup)
{
optionGroup.addTo(m_options);
});
}
void parseOptions(int argc, char **argv)
{
const auto parseResult = m_options.parse(argc, argv);
forEach(m_optionGroups,
[&](auto &optionGroup)
{
optionGroup.read(parseResult);
});
}
static void printVersion()
{
std::cout << Version << std::endl;
}
cxxopts::Options m_options;
std::tuple<OptionGroups...> m_optionGroups;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,67 @@
#ifndef __PLASP_APP__COMMAND_TYPE_H
#define __PLASP_APP__COMMAND_TYPE_H
#include <map>
#include <string>
#include <plasp-app/commands/CommandBeautify.h>
#include <plasp-app/commands/CommandCheckSyntax.h>
#include <plasp-app/commands/CommandHelp.h>
#include <plasp-app/commands/CommandNormalize.h>
#include <plasp-app/commands/CommandTranslate.h>
#include <plasp-app/commands/CommandVersion.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Type
//
////////////////////////////////////////////////////////////////////////////////////////////////////
enum class CommandType
{
Help,
Version,
CheckSyntax,
Requirements,
Beautify,
Normalize,
Translate
};
////////////////////////////////////////////////////////////////////////////////////////////////////
static const std::map<std::string, CommandType> commandNames =
{
{"help", CommandType::Help},
{"-h", CommandType::Help},
{"--help", CommandType::Help},
{"version", CommandType::Version},
{"-v", CommandType::Version},
{"--version", CommandType::Version},
{"check-syntax", CommandType::CheckSyntax},
{"requirements", CommandType::Requirements},
{"beautify", CommandType::Beautify},
{"normalize", CommandType::Normalize},
{"translate", CommandType::Translate},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
const auto parseCommandType =
[](const std::string &commandString)
{
const auto matchingCommand = commandNames.find(commandString);
if (matchingCommand == commandNames.cend())
throw std::runtime_error(std::string("") + commandString + "” is not a plasp command");
return matchingCommand->second;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
using AvailableCommands = std::tuple<CommandTranslate, CommandNormalize, CommandCheckSyntax, CommandBeautify, CommandHelp, CommandVersion>;
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,69 @@
#ifndef __PLASP_APP__OPTION_GROUPS_H
#define __PLASP_APP__OPTION_GROUPS_H
#include <cxxopts.hpp>
#include <colorlog/ColorStream.h>
#include <colorlog/Priority.h>
#include <pddl/Exception.h>
#include <pddl/Mode.h>
#include <plasp/Language.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Option Groups
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class OptionException : public pddl::Exception
{
public:
using Exception::Exception;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
struct OptionGroupBasic
{
static constexpr const auto Name = "basic";
void addTo(cxxopts::Options &options);
void read(const cxxopts::ParseResult &parseResult);
bool help = false;
bool version = false;
bool warningsAsErrors = false;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
struct OptionGroupOutput
{
static constexpr const auto Name = "output";
void addTo(cxxopts::Options &options);
void read(const cxxopts::ParseResult &parseResult);
colorlog::ColorStream::ColorPolicy colorPolicy = colorlog::ColorStream::ColorPolicy::Auto;
colorlog::Priority logPriority = colorlog::Priority::Info;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
struct OptionGroupParser
{
static constexpr const auto Name = "parser";
void addTo(cxxopts::Options &options);
void read(const cxxopts::ParseResult &parseResult);
std::vector<std::string> inputFiles;
pddl::Mode parsingMode = pddl::Mode::Strict;
plasp::Language::Type language = plasp::Language::Type::Automatic;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,46 @@
#ifndef __PLASP_APP__UTILS_H
#define __PLASP_APP__UTILS_H
#include <cxxopts.hpp>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command
//
////////////////////////////////////////////////////////////////////////////////////////////////////
template <std::size_t... Index>
auto makeIndexDispatcher(std::index_sequence<Index...>)
{
return
[](auto &&f)
{
(f(std::integral_constant<std::size_t, Index>{}), ...);
};
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template <std::size_t N>
auto makeIndexDispatcher()
{
return makeIndexDispatcher(std::make_index_sequence<N>{});
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename Tuple, typename Functor>
void forEach(Tuple &&tuple, Functor &&functor)
{
constexpr auto n = std::tuple_size<std::decay_t<Tuple>>::value;
auto dispatcher = makeIndexDispatcher<n>();
dispatcher(
[&functor, &tuple](auto index)
{
functor(std::get<index>(std::forward<Tuple>(tuple)));
});
}
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,14 @@
#ifndef __PLASP_APP__VERSION_H
#define __PLASP_APP__VERSION_H
#include <string>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Version
//
////////////////////////////////////////////////////////////////////////////////////////////////////
static constexpr const auto Version = "plasp version 3.1.1-git";
#endif

View File

@ -0,0 +1,25 @@
#ifndef __PLASP_APP__COMMANDS__COMMAND_BEAUTIFY_H
#define __PLASP_APP__COMMANDS__COMMAND_BEAUTIFY_H
#include <plasp-app/Command.h>
#include <plasp-app/OptionGroups.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Beautify
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class CommandBeautify : public Command<CommandBeautify, OptionGroupBasic, OptionGroupOutput, OptionGroupParser>
{
public:
static constexpr auto Name = "beautify";
static constexpr auto Description = "Cleanly format PDDL specifications";
public:
int run(int argc, char **argv);
};
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,25 @@
#ifndef __PLASP_APP__COMMANDS__COMMAND_CHECK_SYNTAX_H
#define __PLASP_APP__COMMANDS__COMMAND_CHECK_SYNTAX_H
#include <plasp-app/Command.h>
#include <plasp-app/OptionGroups.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Check Syntax
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class CommandCheckSyntax : public Command<CommandCheckSyntax, OptionGroupBasic, OptionGroupOutput, OptionGroupParser>
{
public:
static constexpr auto Name = "check-syntax";
static constexpr auto Description = "Check the syntax of PDDL specifications";
public:
int run(int argc, char **argv);
};
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,25 @@
#ifndef __PLASP_APP__COMMANDS__COMMAND_HELP_H
#define __PLASP_APP__COMMANDS__COMMAND_HELP_H
#include <plasp-app/Command.h>
#include <plasp-app/OptionGroups.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Help
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class CommandHelp : public Command<CommandHelp>
{
public:
static constexpr auto Name = "help";
static constexpr auto Description = "Display this help message";
public:
int run(int argc, char **argv);
};
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,25 @@
#ifndef __PLASP_APP__COMMANDS__COMMAND_NORMALIZE_H
#define __PLASP_APP__COMMANDS__COMMAND_NORMALIZE_H
#include <plasp-app/Command.h>
#include <plasp-app/OptionGroups.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Normalize
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class CommandNormalize : public Command<CommandNormalize, OptionGroupBasic, OptionGroupOutput, OptionGroupParser>
{
public:
static constexpr auto Name = "normalize";
static constexpr auto Description = "Normalize PDDL to plasps custom PDDL format";
public:
int run(int argc, char **argv);
};
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,25 @@
#ifndef __PLASP_APP__COMMANDS__COMMAND_TRANSLATE_H
#define __PLASP_APP__COMMANDS__COMMAND_TRANSLATE_H
#include <plasp-app/Command.h>
#include <plasp-app/OptionGroups.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Translate
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class CommandTranslate : public Command<CommandTranslate, OptionGroupBasic, OptionGroupOutput, OptionGroupParser>
{
public:
static constexpr auto Name = "translate";
static constexpr auto Description = "Translate PDDL and SAS to ASP facts";
public:
int run(int argc, char **argv);
};
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,25 @@
#ifndef __PLASP_APP__COMMANDS__COMMAND_VERSION_H
#define __PLASP_APP__COMMANDS__COMMAND_VERSION_H
#include <plasp-app/Command.h>
#include <plasp-app/OptionGroups.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Version
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class CommandVersion : public Command<CommandVersion>
{
public:
static constexpr auto Name = "version";
static constexpr auto Description = "Display version information";
public:
int run(int argc, char **argv);
};
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif

34
app/src/CMakeLists.txt Normal file
View File

@ -0,0 +1,34 @@
set(target plasp-app)
file(GLOB core_sources "plasp-app/*.cpp")
file(GLOB core_headers "../include/plasp-app/*.h")
file(GLOB commands_sources "plasp-app/commands/*.cpp")
file(GLOB commands_headers "../include/plasp-app/commands/*.h")
set(includes
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/lib/tokenize/include
${PROJECT_SOURCE_DIR}/lib/colorlog/include
${PROJECT_SOURCE_DIR}/lib/variant/include
${PROJECT_SOURCE_DIR}/lib/pddl/include
${PROJECT_SOURCE_DIR}/lib/cxxopts/include
${PROJECT_SOURCE_DIR}/app/include
)
set(sources
${core_sources}
${core_headers}
${commands_sources}
${commands_headers}
)
set(libraries
stdc++fs
plasp
)
add_executable(${target} ${sources})
target_include_directories(${target} PRIVATE ${includes})
target_link_libraries(${target} ${libraries})
set_target_properties(${target} PROPERTIES OUTPUT_NAME plasp)

View File

@ -0,0 +1,108 @@
#include <plasp-app/OptionGroups.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Option Groups
//
////////////////////////////////////////////////////////////////////////////////////////////////////
// Nasty workaround needed for GCC prior to version 7
constexpr decltype(OptionGroupBasic::Name) OptionGroupBasic::Name;
////////////////////////////////////////////////////////////////////////////////////////////////////
void OptionGroupBasic::addTo(cxxopts::Options &options)
{
options.add_options(Name)
("h,help", "Display this help message")
("v,version", "Display version information")
("warnings-as-errors", "Treat warnings as errors");
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void OptionGroupBasic::read(const cxxopts::ParseResult &parseResult)
{
help = (parseResult.count("help") > 0);
version = (parseResult.count("version") > 0);
warningsAsErrors = (parseResult.count("warnings-as-errors") > 0);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Nasty workaround needed for GCC prior to version 7
constexpr decltype(OptionGroupOutput::Name) OptionGroupOutput::Name;
////////////////////////////////////////////////////////////////////////////////////////////////////
void OptionGroupOutput::addTo(cxxopts::Options &options)
{
options.add_options(Name)
("color", "Colorize output (always, never, auto)", cxxopts::value<std::string>()->default_value("auto"))
("p,log-priority", "Log messages starting from this priority (debug, info, warning, error)", cxxopts::value<std::string>()->default_value("info"));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void OptionGroupOutput::read(const cxxopts::ParseResult &parseResult)
{
const auto colorPolicyString = parseResult["color"].as<std::string>();
if (colorPolicyString == "auto")
colorPolicy = colorlog::ColorStream::ColorPolicy::Auto;
else if (colorPolicyString == "never")
colorPolicy = colorlog::ColorStream::ColorPolicy::Never;
else if (colorPolicyString == "always")
colorPolicy = colorlog::ColorStream::ColorPolicy::Always;
else
throw OptionException("unknown color policy “" + colorPolicyString + "");
const auto logPriorityString = parseResult["log-priority"].as<std::string>();
try
{
logPriority = colorlog::priorityFromName(logPriorityString.c_str());
}
catch (const std::exception &e)
{
throw OptionException(e.what());
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Nasty workaround needed for GCC prior to version 7
constexpr decltype(OptionGroupParser::Name) OptionGroupParser::Name;
////////////////////////////////////////////////////////////////////////////////////////////////////
void OptionGroupParser::addTo(cxxopts::Options &options)
{
options.add_options(Name)
("i,input", "Input files (in PDDL or SAS format)", cxxopts::value<std::vector<std::string>>())
("parsing-mode", "Parsing mode (strict, compatibility)", cxxopts::value<std::string>()->default_value("strict"))
("l,language", "Input language (pddl, sas, auto)", cxxopts::value<std::string>()->default_value("auto"));
options.parse_positional("input");
options.positional_help("[<input file...>]");
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void OptionGroupParser::read(const cxxopts::ParseResult &parseResult)
{
const auto parsingModeString = parseResult["parsing-mode"].as<std::string>();
if (parsingModeString == "compatibility")
parsingMode = pddl::Mode::Compatibility;
else if (parsingModeString != "strict")
throw OptionException("unknown parsing mode “" + parsingModeString + "");
if (parseResult.count("input"))
inputFiles = parseResult["input"].as<std::vector<std::string>>();
const auto languageName = parseResult["language"].as<std::string>();
language = plasp::Language::fromString(languageName);
if (language == plasp::Language::Type::Unknown)
throw OptionException("unknown input language “" + languageName + "");
}

View File

@ -0,0 +1,145 @@
#include <plasp-app/commands/CommandBeautify.h>
#include <iostream>
#include <string>
#include <cxxopts.hpp>
#include <colorlog/ColorStream.h>
#include <colorlog/Logger.h>
#include <colorlog/Priority.h>
#include <pddl/AST.h>
#include <pddl/ASTOutput.h>
#include <pddl/Exception.h>
#include <pddl/Mode.h>
#include <pddl/Parse.h>
#include <plasp/LanguageDetection.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Beautify
//
////////////////////////////////////////////////////////////////////////////////////////////////////
int CommandBeautify::run(int argc, char **argv)
{
parseOptions(argc, argv);
const auto &basicOptions = std::get<OptionGroupBasic>(m_optionGroups);
const auto &outputOptions = std::get<OptionGroupOutput>(m_optionGroups);
const auto &parserOptions = std::get<OptionGroupParser>(m_optionGroups);
if (basicOptions.help)
{
printHelp();
return EXIT_SUCCESS;
}
if (basicOptions.version)
{
printVersion();
return EXIT_SUCCESS;
}
colorlog::Logger logger;
logger.setColorPolicy(outputOptions.colorPolicy);
logger.setLogPriority(outputOptions.logPriority);
if (basicOptions.warningsAsErrors)
logger.setAbortPriority(colorlog::Priority::Warning);
const auto printCompatibilityInfo =
[&]()
{
if (parserOptions.parsingMode != pddl::Mode::Compatibility)
logger.log(colorlog::Priority::Info, "try using --parsing-mode=compatibility for extended legacy feature support");
};
try
{
tokenize::Tokenizer<tokenize::CaseInsensitiveTokenizerPolicy> tokenizer;
if (!parserOptions.inputFiles.empty())
std::for_each(parserOptions.inputFiles.cbegin(), parserOptions.inputFiles.cend(),
[&](const auto &inputFile)
{
tokenizer.read(inputFile);
});
else
{
logger.log(colorlog::Priority::Info, "reading from stdin");
tokenizer.read("std::cin", std::cin);
}
const auto detectLanguage =
[&]()
{
if (parserOptions.language == plasp::Language::Type::Automatic)
return plasp::detectLanguage(tokenizer);
return parserOptions.language;
};
switch (detectLanguage())
{
case plasp::Language::Type::Automatic:
case plasp::Language::Type::Unknown:
{
logger.log(colorlog::Priority::Error, "unknown input language");
std::cout << std::endl;
printHelp();
return EXIT_FAILURE;
}
// TODO: get rid of unknown language type, use exception instead
case plasp::Language::Type::PDDL:
{
const auto logWarning =
[&](const auto &location, const auto &warning)
{
logger.log(colorlog::Priority::Warning, location, warning);
};
auto context = pddl::Context(std::move(tokenizer), logWarning);
context.mode = parserOptions.parsingMode;
auto description = pddl::parseDescription(context);
logger.outputStream() << description;
break;
}
case plasp::Language::Type::SAS:
{
logger.log(colorlog::Priority::Error, "Beautification is only supported for PDDL specifications");
return EXIT_FAILURE;
}
}
}
catch (const tokenize::TokenizerException &e)
{
logger.log(colorlog::Priority::Error, e.location(), e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const pddl::ParserException &e)
{
if (e.location())
logger.log(colorlog::Priority::Error, e.location().value(), e.message().c_str());
else
logger.log(colorlog::Priority::Error, e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const std::exception &e)
{
logger.log(colorlog::Priority::Error, e.what());
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,145 @@
#include <plasp-app/commands/CommandCheckSyntax.h>
#include <iostream>
#include <string>
#include <cxxopts.hpp>
#include <colorlog/ColorStream.h>
#include <colorlog/Logger.h>
#include <colorlog/Priority.h>
#include <pddl/AST.h>
#include <pddl/ASTOutput.h>
#include <pddl/Exception.h>
#include <pddl/Mode.h>
#include <pddl/Parse.h>
#include <plasp/LanguageDetection.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Check Syntax
//
////////////////////////////////////////////////////////////////////////////////////////////////////
int CommandCheckSyntax::run(int argc, char **argv)
{
parseOptions(argc, argv);
const auto &basicOptions = std::get<OptionGroupBasic>(m_optionGroups);
const auto &outputOptions = std::get<OptionGroupOutput>(m_optionGroups);
const auto &parserOptions = std::get<OptionGroupParser>(m_optionGroups);
if (basicOptions.help)
{
printHelp();
return EXIT_SUCCESS;
}
if (basicOptions.version)
{
printVersion();
return EXIT_SUCCESS;
}
colorlog::Logger logger;
logger.setColorPolicy(outputOptions.colorPolicy);
logger.setLogPriority(outputOptions.logPriority);
if (basicOptions.warningsAsErrors)
logger.setAbortPriority(colorlog::Priority::Warning);
const auto printCompatibilityInfo =
[&]()
{
if (parserOptions.parsingMode != pddl::Mode::Compatibility)
logger.log(colorlog::Priority::Info, "try using --parsing-mode=compatibility for extended legacy feature support");
};
try
{
tokenize::Tokenizer<tokenize::CaseInsensitiveTokenizerPolicy> tokenizer;
if (!parserOptions.inputFiles.empty())
std::for_each(parserOptions.inputFiles.cbegin(), parserOptions.inputFiles.cend(),
[&](const auto &inputFile)
{
tokenizer.read(inputFile);
});
else
{
logger.log(colorlog::Priority::Info, "reading from stdin");
tokenizer.read("std::cin", std::cin);
}
const auto detectLanguage =
[&]()
{
if (parserOptions.language == plasp::Language::Type::Automatic)
return plasp::detectLanguage(tokenizer);
return parserOptions.language;
};
switch (detectLanguage())
{
case plasp::Language::Type::Automatic:
case plasp::Language::Type::Unknown:
{
logger.log(colorlog::Priority::Error, "unknown input language");
std::cout << std::endl;
printHelp();
return EXIT_FAILURE;
}
// TODO: get rid of unknown language type, use exception instead
case plasp::Language::Type::PDDL:
{
const auto logWarning =
[&](const auto &location, const auto &warning)
{
logger.log(colorlog::Priority::Warning, location, warning);
};
auto context = pddl::Context(std::move(tokenizer), logWarning);
context.mode = parserOptions.parsingMode;
auto description = pddl::parseDescription(context);
logger.log(colorlog::Priority::Info, "no syntax errors found");
return EXIT_SUCCESS;
}
case plasp::Language::Type::SAS:
{
logger.log(colorlog::Priority::Error, "Syntax checking is only supported for PDDL specifications");
return EXIT_FAILURE;
}
}
}
catch (const tokenize::TokenizerException &e)
{
logger.log(colorlog::Priority::Error, e.location(), e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const pddl::ParserException &e)
{
if (e.location())
logger.log(colorlog::Priority::Error, e.location().value(), e.message().c_str());
else
logger.log(colorlog::Priority::Error, e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const std::exception &e)
{
logger.log(colorlog::Priority::Error, e.what());
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,87 @@
#include <plasp-app/commands/CommandHelp.h>
#include <colorlog/Logger.h>
#include <plasp-app/CommandType.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Help
//
////////////////////////////////////////////////////////////////////////////////////////////////////
int CommandHelp::run(int argc, char **argv)
{
colorlog::Logger logger;
if (argc > 1)
{
try
{
switch (parseCommandType(argv[1]))
{
case CommandType::Help:
case CommandType::Version:
break;
case CommandType::Translate:
CommandTranslate().printHelp();
return EXIT_SUCCESS;
case CommandType::Normalize:
CommandNormalize().printHelp();
return EXIT_SUCCESS;
case CommandType::Beautify:
CommandBeautify().printHelp();
return EXIT_SUCCESS;
case CommandType::CheckSyntax:
CommandCheckSyntax().printHelp();
return EXIT_SUCCESS;
default:
logger.log(colorlog::Priority::Error, std::string("command “") + argv[1] + "” not yet implemented");
exit(EXIT_FAILURE);
}
}
catch (std::exception &exception)
{
}
}
std::cout
<< "ASP planning tools for PDDL." << std::endl
<< "Usage:" << std::endl
<< " plasp <command> [<arguments>]" << std::endl << std::endl
<< " available commands:" << std::endl;
AvailableCommands availableCommands;
size_t lengthOfLongestCommandName = 0;
forEach(availableCommands,
[&](const auto &command)
{
lengthOfLongestCommandName = std::max(lengthOfLongestCommandName, std::strlen(command.Name));
});
const auto printSpaces =
[](const auto numberOfSpaces)
{
for (auto i = static_cast<decltype(numberOfSpaces)>(0); i < numberOfSpaces; i++)
std::cout << " ";
};
forEach(availableCommands,
[&](const auto &command)
{
const auto lengthOfCommandName = std::strlen(command.Name);
std::cout << " " << command.Name;
printSpaces(lengthOfLongestCommandName - lengthOfCommandName + 2);
std::cout << command.Description << std::endl;
});
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,148 @@
#include <plasp-app/commands/CommandNormalize.h>
#include <iostream>
#include <string>
#include <cxxopts.hpp>
#include <colorlog/ColorStream.h>
#include <colorlog/Logger.h>
#include <colorlog/Priority.h>
#include <pddl/AST.h>
#include <pddl/Exception.h>
#include <pddl/Mode.h>
#include <pddl/Normalize.h>
#include <pddl/NormalizedASTOutput.h>
#include <pddl/Parse.h>
#include <pddl/detail/normalization/Reduction.h>
#include <plasp/LanguageDetection.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Normalize
//
////////////////////////////////////////////////////////////////////////////////////////////////////
int CommandNormalize::run(int argc, char **argv)
{
parseOptions(argc, argv);
const auto &basicOptions = std::get<OptionGroupBasic>(m_optionGroups);
const auto &outputOptions = std::get<OptionGroupOutput>(m_optionGroups);
const auto &parserOptions = std::get<OptionGroupParser>(m_optionGroups);
if (basicOptions.help)
{
printHelp();
return EXIT_SUCCESS;
}
if (basicOptions.version)
{
printVersion();
return EXIT_SUCCESS;
}
colorlog::Logger logger;
logger.setColorPolicy(outputOptions.colorPolicy);
logger.setLogPriority(outputOptions.logPriority);
if (basicOptions.warningsAsErrors)
logger.setAbortPriority(colorlog::Priority::Warning);
const auto printCompatibilityInfo =
[&]()
{
if (parserOptions.parsingMode != pddl::Mode::Compatibility)
logger.log(colorlog::Priority::Info, "try using --parsing-mode=compatibility for extended legacy feature support");
};
try
{
tokenize::Tokenizer<tokenize::CaseInsensitiveTokenizerPolicy> tokenizer;
if (!parserOptions.inputFiles.empty())
std::for_each(parserOptions.inputFiles.cbegin(), parserOptions.inputFiles.cend(),
[&](const auto &inputFile)
{
tokenizer.read(inputFile);
});
else
{
logger.log(colorlog::Priority::Info, "reading from stdin");
tokenizer.read("std::cin", std::cin);
}
const auto detectLanguage =
[&]()
{
if (parserOptions.language == plasp::Language::Type::Automatic)
return plasp::detectLanguage(tokenizer);
return parserOptions.language;
};
switch (detectLanguage())
{
case plasp::Language::Type::Automatic:
case plasp::Language::Type::Unknown:
{
logger.log(colorlog::Priority::Error, "unknown input language");
std::cout << std::endl;
printHelp();
return EXIT_FAILURE;
}
// TODO: get rid of unknown language type, use exception instead
case plasp::Language::Type::PDDL:
{
const auto logWarning =
[&](const auto &location, const auto &warning)
{
logger.log(colorlog::Priority::Warning, location, warning);
};
auto context = pddl::Context(std::move(tokenizer), logWarning);
context.mode = parserOptions.parsingMode;
auto description = pddl::parseDescription(context);
auto normalizedDescription = pddl::normalize(std::move(description));
logger.outputStream() << normalizedDescription;
return EXIT_SUCCESS;
}
case plasp::Language::Type::SAS:
{
logger.log(colorlog::Priority::Error, "Normalization is only supported for PDDL specifications");
return EXIT_FAILURE;
}
}
}
catch (const tokenize::TokenizerException &e)
{
logger.log(colorlog::Priority::Error, e.location(), e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const pddl::ParserException &e)
{
if (e.location())
logger.log(colorlog::Priority::Error, e.location().value(), e.message().c_str());
else
logger.log(colorlog::Priority::Error, e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const std::exception &e)
{
logger.log(colorlog::Priority::Error, e.what());
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,161 @@
#include <plasp-app/commands/CommandTranslate.h>
#include <iostream>
#include <string>
#include <cxxopts.hpp>
#include <colorlog/ColorStream.h>
#include <colorlog/Logger.h>
#include <colorlog/Priority.h>
#include <pddl/AST.h>
#include <pddl/Exception.h>
#include <pddl/Mode.h>
#include <pddl/Normalize.h>
#include <pddl/NormalizedASTOutput.h>
#include <pddl/Parse.h>
#include <pddl/detail/normalization/Reduction.h>
#include <plasp/LanguageDetection.h>
#include <plasp/TranslatorException.h>
#include <plasp/pddl/TranslatorASP.h>
#include <plasp/sas/Description.h>
#include <plasp/sas/TranslatorASP.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Translate
//
////////////////////////////////////////////////////////////////////////////////////////////////////
int CommandTranslate::run(int argc, char **argv)
{
parseOptions(argc, argv);
const auto &basicOptions = std::get<OptionGroupBasic>(m_optionGroups);
const auto &outputOptions = std::get<OptionGroupOutput>(m_optionGroups);
const auto &parserOptions = std::get<OptionGroupParser>(m_optionGroups);
if (basicOptions.help)
{
printHelp();
return EXIT_SUCCESS;
}
if (basicOptions.version)
{
printVersion();
return EXIT_SUCCESS;
}
colorlog::Logger logger;
logger.setColorPolicy(outputOptions.colorPolicy);
logger.setLogPriority(outputOptions.logPriority);
if (basicOptions.warningsAsErrors)
logger.setAbortPriority(colorlog::Priority::Warning);
const auto printCompatibilityInfo =
[&]()
{
if (parserOptions.parsingMode != pddl::Mode::Compatibility)
logger.log(colorlog::Priority::Info, "try using --parsing-mode=compatibility for extended legacy feature support");
};
try
{
tokenize::Tokenizer<tokenize::CaseInsensitiveTokenizerPolicy> tokenizer;
if (!parserOptions.inputFiles.empty())
std::for_each(parserOptions.inputFiles.cbegin(), parserOptions.inputFiles.cend(),
[&](const auto &inputFile)
{
tokenizer.read(inputFile);
});
else
{
logger.log(colorlog::Priority::Info, "reading from stdin");
tokenizer.read("std::cin", std::cin);
}
const auto detectLanguage =
[&]()
{
if (parserOptions.language == plasp::Language::Type::Automatic)
return plasp::detectLanguage(tokenizer);
return parserOptions.language;
};
switch (detectLanguage())
{
case plasp::Language::Type::Automatic:
case plasp::Language::Type::Unknown:
{
logger.log(colorlog::Priority::Error, "unknown input language");
std::cout << std::endl;
printHelp();
return EXIT_FAILURE;
}
// TODO: get rid of unknown language type, use exception instead
case plasp::Language::Type::PDDL:
{
const auto logWarning =
[&](const auto &location, const auto &warning)
{
logger.log(colorlog::Priority::Warning, location, warning);
};
auto context = pddl::Context(std::move(tokenizer), logWarning);
context.mode = parserOptions.parsingMode;
auto description = pddl::parseDescription(context);
auto normalizedDescription = pddl::normalize(std::move(description));
const auto translator = plasp::pddl::TranslatorASP(std::move(normalizedDescription), logger.outputStream());
translator.translate();
return EXIT_SUCCESS;
}
case plasp::Language::Type::SAS:
{
const auto description = plasp::sas::Description::fromTokenizer(std::move(tokenizer));
const auto translator = plasp::sas::TranslatorASP(description, logger.outputStream());
translator.translate();
return EXIT_SUCCESS;
}
}
}
catch (const tokenize::TokenizerException &e)
{
logger.log(colorlog::Priority::Error, e.location(), e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const pddl::ParserException &e)
{
if (e.location())
logger.log(colorlog::Priority::Error, e.location().value(), e.message().c_str());
else
logger.log(colorlog::Priority::Error, e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const plasp::TranslatorException &e)
{
logger.log(colorlog::Priority::Error, e.what());
return EXIT_FAILURE;
}
catch (const std::exception &e)
{
logger.log(colorlog::Priority::Error, e.what());
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,14 @@
#include <plasp-app/commands/CommandVersion.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Command Version
//
////////////////////////////////////////////////////////////////////////////////////////////////////
int CommandVersion::run(int, char **)
{
printVersion();
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,69 @@
#include <algorithm>
#include <iostream>
#include <string>
#include <cxxopts.hpp>
#include <colorlog/Logger.h>
#include <colorlog/Priority.h>
#include <plasp-app/Command.h>
#include <plasp-app/CommandType.h>
#include <plasp-app/Version.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Main
//
////////////////////////////////////////////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
colorlog::Logger logger;
if (argc < 2)
{
CommandHelp().run(argc - 1, &argv[1]);
return EXIT_FAILURE;
}
try
{
switch (parseCommandType(argv[1]))
{
case CommandType::Help:
return CommandHelp().run(argc - 1, &argv[1]);
case CommandType::Version:
return CommandVersion().run(argc - 1, &argv[1]);
case CommandType::Translate:
return CommandTranslate().run(argc - 1, &argv[1]);
case CommandType::Normalize:
return CommandNormalize().run(argc - 1, &argv[1]);
case CommandType::Beautify:
return CommandBeautify().run(argc - 1, &argv[1]);
case CommandType::CheckSyntax:
return CommandCheckSyntax().run(argc - 1, &argv[1]);
default:
logger.log(colorlog::Priority::Error, std::string("command “") + argv[1] + "” not yet implemented");
exit(EXIT_FAILURE);
}
}
catch (std::exception &exception)
{
logger.log(colorlog::Priority::Error, exception.what());
std::cout << std::endl;
CommandHelp().run(argc - 1, &argv[1]);
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}

View File

@ -1 +0,0 @@
add_subdirectory(plasp-app)

View File

@ -1,23 +0,0 @@
set(target plasp_app)
file(GLOB core_sources "*.cpp")
file(GLOB core_headers "*.h")
include_directories(
${Boost_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
)
set(sources
${core_sources}
${core_headers}
)
set(libraries
${Boost_LIBRARIES}
plasp
)
add_executable(${target} ${sources})
target_link_libraries(${target} ${libraries})
set_target_properties(plasp_app PROPERTIES OUTPUT_NAME plasp)

View File

@ -1,81 +0,0 @@
#include <iostream>
#include <boost/program_options.hpp>
#include <plasp/sas/Description.h>
#include <plasp/sas/TranslatorASP.h>
int main(int argc, char **argv)
{
namespace po = boost::program_options;
po::options_description description("Allowed options");
description.add_options()
("help,h", "Display this help message.")
("version,v", "Display version information.")
("input,i", po::value<std::string>(), "Specify the SAS input file.");
po::positional_options_description positionalOptionsDescription;
positionalOptionsDescription.add("input", -1);
po::variables_map variablesMap;
const auto printHelp =
[&]()
{
std::cout << "Usage: plasp file [options]" << std::endl;
std::cout << "Translate PDDL instances to ASP facts." << std::endl << std::endl;
std::cout << description;
};
try
{
po::store(po::command_line_parser(argc, argv)
.options(description)
.positional(positionalOptionsDescription)
.run(),
variablesMap);
po::notify(variablesMap);
}
catch (const po::error &e)
{
std::cerr << "Error: " << e.what() << std::endl << std::endl;
printHelp();
return EXIT_FAILURE;
}
if (variablesMap.count("help"))
{
printHelp();
return EXIT_SUCCESS;
}
if (variablesMap.count("version"))
{
std::cout << "plasp version 3.0.0" << std::endl;
return EXIT_SUCCESS;
}
if (!variablesMap.count("input"))
{
std::cerr << "Error: No input file specified" << std::endl << std::endl;
printHelp();
return EXIT_FAILURE;
}
try
{
const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as<std::string>());
const auto sasTranslator = plasp::sas::TranslatorASP(sasDescription);
sasTranslator.translate(std::cout);
}
catch (const std::exception &e)
{
std::cerr << "Error: " << e.what() << std::endl << std::endl;
printHelp();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

47
doc/building.md Normal file
View File

@ -0,0 +1,47 @@
# Building
`plasp` requires a C++17 compiler (preferably GCC ≥ 6.1 or clang ≥ 3.8) and CMake for building.
```sh
git clone https://github.com/potassco/plasp.git
cd plasp
mkdir -p build/release
cd build/release
cmake ../.. -DCMAKE_BUILD_TYPE=Release
make
```
The built `plasp` binary is then located at `plasp/build/release/bin/plasp`.
To update `plasp` to the most recent version, perform the following steps:
```sh
cd plasp
git checkout master
git pull
cd build/release
cmake .
make
```
## Running the Tests
`plasp` provides unit tests written with [Catch2](https://github.com/catchorg/Catch2).
Before building and running the tests, make sure you have fetched the Catch submodule:
```sh
git submodule init
git submodule update
```
Afterward, enable the flag `BUILD_TESTS` in your CMake configuration.
Finally, build and run the tests as follows:
```sh
make run-tokenize-tests
make run-pddl-tests
make run-tests
```
After updating `plasp`, make sure to execute CMake again in order for the tests to run correctly.
Else, external files required by the test suite may be reported missing.

View File

@ -0,0 +1,22 @@
# Feature Requirements
Feature requirements are part of `plasp`s [output format](output-format.md).
Currently, `plasp` detects feature requirements only for SAS problems.
`plasp` supports the following feature requirements:
SAS feature | description
------------|------------
`actionCosts` | actions have associated costs (see [action costs](output-format.md#action-costs))
`axiomRules` | immediate actions are used, which are executed as soon as the preconditions are satisfied (see [axiom rules](output-format.md#axiom-rules))
`conditionalEffects` | some effects of an action may have additional conditions (see [actions](output-format.md#actions))
## Example
The following specifies that the input problem has the two requirements `actionCosts` and `conditionalEffects`.
```prolog
% requirements
requiresFeature(actionCosts).
requiresFeature(conditionalEffects).
```

290
doc/output-format.md Normal file
View File

@ -0,0 +1,290 @@
# Output Format
`plasp` 3 translates SAS and PDDL files into a uniform ASP fact format.
## Overview
Essentially, `plasp`s output format consists of [state variables](#variables) that are modified by [actions](#actions) if their preconditions are fulfilled.
Variables reference [entities](#constants-objects) that are affected by the actions.
As with PDDL, the objective is to achieve a specific [goal](#goal) starting from an [initial state](#initial-state) by executing a sequence of actions.
`plasp`s variables correspond to the multivalued variables in SAS.
PDDL predicates are turned into Boolean variables to make the output format consistent.
Actions are modeled exactly as PDDL actions and SAS operators.
## In a Nutshell
Consider the following, simplistic PDDL problem of turning a switch on:
```lisp
; simplistic example of turning a switch on
(define (domain switch)
(:requirements :typing)
(:types switch)
(:predicates
(on ?x - switch))
(:action turn-on
:parameters
(?x - switch)
:precondition
(not (on ?x))
:effect
(on ?x)))
; example problem with one switch
(define (problem switch-problem)
(:domain switch)
(:objects a - switch)
(:init
(not (on a)))
(:goal
(on a)))
```
This is translated by `plasp translate` into the following output format (slightly restructured for clarity):
```prolog
% declares the type “type("switch")”
type(type("switch")).
% introduces a switch “constant("a")”
constant(constant("a")).
has(constant("a"), type("switch")).
% declares a variable “variable(on(X))” for switches X
variable(variable(("on", X))) :- has(X, type("switch")).
% variables may have the values true and false
boolean(true).
boolean(false).
contains(X, value(X, B)) :- variable(X), boolean(B).
% declares the action “action(turnOn(X))”, which requires switch X to be off and then turns it on
action(action(("turn-on", X))) :- has(X, type("switch")).
precondition(action(("turn-on", X)), variable(("on", X)), value(variable(("on", X)), false))
:- action(action(("turn-on", X))).
postcondition(action(("turn-on", X)), effect(unconditional), variable(("on", X)), value(variable(("on", X)), true))
:- action(action(("turn-on", X))).
% initially, the switch is off
initialState(variable(("on", constant("a"))), value(variable(("on", constant("a"))), false)).
% in the end, the switch should be on
goal(variable(("on", constant("a"))), value(variable(("on", constant("a"))), true)).
```
## Syntax and Semantics
`plasp` structures the translated ASP facts into multiple sections, which are explained in the following.
### Feature Requirements
```prolog
% declares a required feature
requires(feature(<name>)).
```
`plasp` recognizes and declares advanced features used by the input problem, such as [conditional effects](#actions), [mutex groups](#mutex-groups) and [axiom rules](#axiom-rules) (currently only SAS).
See the [full list of supported features](feature-requirements.md) for more information.
The feature requirement predicates may be used in meta encodings to warn about unsupported features.
### Types
```prolog
% declares a <type>
type(type(<name>)).
% specifies that <type 1> inherits <type 2>
inherits(<type 1>, <type 2>).
% specifies <constant> to have type <type>
has(<constant>, <type>).
```
[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
```prolog
% declares a <variable>
variable(variable(<name>)).
% adds a <value> to the domain of a <variable>
contains(<variable>, <value>).
```
`plasp`s variables represent the current state of the planning problem.
Variables are linked to the problem's [objects](#constants-objects) and [constants](#constants-objects).
`plasp`s variables are multivalued, and each variable has exactly one value at each point in time.
With SAS, variable names are numbers starting at 0, `variable(<number>)`.
SAS variables are inherently multivalued, which results in two or more values of the form `value(<SAS predicate>, <SAS value>)` for each variable.
With PDDL, Boolean variables are created from the PDDL predicates.
Variables are named after the PDDL predicate signatures, `variable(<PDDL predicate>).`
Each variable contains exactly two values (one `true`, one `false`) of the form `value(<variable>, <bool>)`.
Note that with PDDL, values contain the corresponding variables as the first argument to make the format consistent with the multi-valued variables obtained with SAS input.
### Derived Variables
```prolog
% declares a <derived variable>
derivedVariable(derivedVariable(<name>)).
% adds a <value> to the domain of a <derived variable>
contains(<derived variable>, <value>).
```
Derived variables are introduced whenever the translator needs to use [derived predicates](#derived-predicates).
When the preconditions of a [derived predicate](#derived-predicates) are met, the corresponding derived variable (named after the derived predicate) is set as an effect.
Derived variables are analogously defined to common variables and may also be referenced in preconditions, conditions of conditional effects, and goal descriptions, just as variables.
In contrast to common variables, derived variables *are not subject to inertia rules.*
In other words, derived variables are computed for each time step separately, and reset when going to the next time step (their values dont automatically carry over to the next time step).
### Actions
```prolog
% declares an <action>
action(action(<name>)).
% defines that as a precondition to <action>, <variable> and <derived variable> must have value <value>
precondition(<action>, <variable>, <value>).
precondition(<action>, <derived variable>, <value>).
% defines that after applying <action>, <variable> is assigned <value>
postcondition(<action>, effect(<number>), <variable>, <value>).
% defines the condition of a conditional effect
precondition(effect(<number>), <variable>, <value>).
precondition(effect(<number>), <derived variable>, <value>).
% specifies the costs of applying <action>
costs(<action>, <number>).
```
Actions may require certain [variables](#variables) (or [derived variables](#derived-variables)) to have specific values in order to be executed.
After applying an action, variables get new values according to the action's postconditions.
Actions may have *conditional effects*, that is, certain postconditions are only applied if additional conditions are satisfied.
For this reason, each conditional effect is uniquely identified with a predicate `effect(<number>)` as the second argument of the `postcondition` facts.
The conditions of conditional effects are given by additional `precondition` facts that take the respective `effect(<number>)` predicates as the first argument.
Unconditional effects are identified with `effect(unconditional)`.
Conditional effects are currently only supported with SAS input problems.
Actions may also have *action costs* required to apply them. Action costs are currently supported for SAS only.
### Derived Predicates
```prolog
% declares a <derived predicate> of with conjunctive (type(and)) or disjunctive (type(or)) preconditions
derivedPredicate(derivedPredicate(<name>), type(<and/or>)).
% defines that as a precondition to <derived predicate>, <variable> and <derived variable> must have value <value>
precondition(<derived predicate>, type(<and/or>), <variable>, <value>).
precondition(<derived predicate>, type(<and/or>), <derived variable>, <value>).
% defines that after applying <action>, <derived variable> is assigned <value>
postcondition(<derived predicate>, type(<and/or>), effect(<number>), <derived variable>, <value>).
% defines the condition of a conditional effect
precondition(effect(<number>), <variable>, <value>).
precondition(effect(<number>), <derived variable>, <value>).
% specifies the costs of applying <action>
costs(<action>, <number>).
```
Derived predicates are introduced by the translator when there are nested expressions or disjunctions in action preconditions, conditions of conditional effects, or goal descriptions.
Derived predicates operate on [derived variables](#derived-variables) of the same name.
Like actions, derived predicates must satisfy preconditions in order for their effect to be applicable.
The effect of all derived predicates is to set the corresponding [derived variables](#derived-variables) to `true` or `false`.
In contrast to actions, however, derived predicates specify whether their preconditions are to be interpreted as a *conjunction* (`type(and)`) or as a *disjunction* (`type(or)`).
Encoding authors need to ensure that derived predicate preconditions are interpreted in the correct way.
### Constants/Objects
```prolog
% declares a <constant> or object
constant(constant(<name>)).
% specifies <constant> to have type type(<name>)
has(<constant>, <type>).
```
Constants and objects are the entities that are affected by [actions](#actions), for instance, the blocks in a Blocks World problem.
Constants are global for a domain, while objects are problem-specific.
`plasp` does not distinguish between the two (modeling both as constants), as both are identically used static identifiers.
### Initial State
```prolog
% initializes <variable> with a specific <value>
initialState(<variable>, <value>).
```
The initial state contains all [variable](#variables) assignments that hold before executing any [actions](#actions).
Note that with PDDL, `plasp` sets all unspecified initial state variables to `false` in order to make the initial state total.
### Goal
```prolog
% specifies that <variable> and <derived variable> shall obtain a respective <value> in the end
goal(<variable>, <value>).
goal(<derived variable>, <value>).
```
The goal specifies all assignments of [variables](#variables) and [derived variables](#derived-variables) that have to be fulfilled after executing the action sequence.
### Mutex Groups
```prolog
% declares a <mutex group>
mutexGroup(mutexGroup(<number>)).
% adds the assignment of <variable> to <value> to a <mutex group>
contains(<mutex group>, <variable>, <value>).
```
SAS contains information about mutually exclusive [variable](#variables) assignments.
That is, *at most one* variable assignment of each mutex group must be satisfied at all times.
Mutex group facts are only present with SAS input programs and not PDDL.
Mutex groups contain essential information in order to find plans correctly.
That is, if mutex groups are present in `plasp`s output, they have to be accounted for appropriately.
### Axiom Rules
```prolog
% declares an <axiom rule>
axiomRule(axiomRule(<number>)).
% defines that as a precondition to <axiom rule>, <variable> must have value <value>
precondition(<axiom rule>, <variable>, <value>).
% defines that after applying <axiom rule>, <variable> is assigned <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.
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 rules contain essential information in order to find plans correctly.
That is, if axiom rules are present in `plasp`s output, they have to be accounted for appropriately.

View File

@ -0,0 +1,27 @@
# PDDL Feature Support
This document describes the PDDL features are currently supported by `plasp`s very own translator.
This doesnt cover PDDL feature support through SAS conversion with [Fast Downward](http://www.fast-downward.org/) (please refer to [Fast Downwards homepage](http://www.fast-downward.org/) for more information).
The table below lists the features of PDDL 3.1 and whether or not they are supported by `plasp`.
Unless otherwise noted, this refers to `plasp`s parser, normalizer, translator, and ASP output format.
| PDDL feature | description | supported by `plasp` |
|---|---|---|
| STRIPS | basic STRIPS functionality, the general PDDL sections (`:domain`, `:problem`, `:predicates`, `:action`) | yes |
| typing | typed variables and constants, type inheritance | yes (except for `either` type directives) |
| negative preconditions | typed variables and constants, type inheritance | yes |
| disjunctive preconditions | `or` expressions in preconditions | yes |
| existential preconditions | `exists` expressions in preconditions | yes |
| universal preconditions | `forall` expressions in preconditions | yes |
| conditional effects | `when` expressions in action effects | yes |
| universal effects | `forall` expressions in effects | yes |
| equality | `=` expressions for atomic formulas | no (parser support only) |
| numeric fluents | numeric function definitions in `:functions` section, assignment operators, arithmetic preconditions | no |
| action costs | actions are assigned costs through numeric fluents | no |
| durative actions | temporal planning with action durations | no |
| derived predicates | predicates whose truth value is defined by a formula | no (`plasp` introduces *custom* derived predicates to support nested expressions, but derived predicates specified in the PDDL input are currently not supported) |
| timed initial literals | initial state may specify literals that become true at a specified time point | no |
| preferences | preferences in action preconditions and goals | no |
| constraints | additional constraints for domain and problem | no |

View File

@ -1,40 +0,0 @@
#include <incmode>.
% Check feature requirements
:- requiresFeature(actionCosts).
:- requiresFeature(axiomRules).
:- requiresFeature(conditionalEffects).
#program base.
% Establish initial state
holds(Var, Val, 0) :- initialState(Var, Val).
#program step(t).
% Perform actions
1 {occurs(action(A), t) : action(A)} 1.
% Check preconditions
:- occurs(A, t), precondition(A, Var, Val), not holds(Var, Val, t - 1).
% Apply effects
caused(Var, Val, t) :- occurs(A, t), postcondition(A, _, Var, Val).
modified(Var, t) :- caused(Var, Val, t).
holds(Var, Val, t) :- caused(Var, Val, t).
holds(Var, Val, t) :- holds(Var, Val, t - 1), not modified(Var, t).
% Check that variables have unique values
:- variable(X), Var = variable(X), not 1 {holds(Var, Val, t) : contains(Var, Val)} 1.
% Check mutexes
:- mutexGroup(X), M = mutexGroup(X), not {holds(Var, Val, t) : contains(M, Var, Val)} 1.
#program check(t).
% Verify that goal is met
:- query(t), goal(Var, Val), not holds(Var, Val, t).
#show query/1.
#show occurs/2.

View File

@ -0,0 +1,27 @@
#const horizon=1.
step(0..horizon).
precondition(Action,variable(Fluent),Value) :- precondition(Action, variable(Fluent),value(Fluent,Value)).
postcondition(Action,variable(Fluent),Value) :- postcondition(Action,effect(unconditional),variable(Fluent),value(Fluent,Value)).
holds(variable(Fluent),0) :- initialState(variable(Fluent),value(Fluent,true)).
{ occurs(Action,T) : action(Action) } = 1 :- step(T), T>0.
:- occurs(Action,T), precondition(Action,Fluent,true), not holds(Fluent,T-1).
:- occurs(Action,T), precondition(Action,Fluent,false), holds(Fluent,T-1).
caused(Fluent,T) :- occurs(Action,T), postcondition(Action,Fluent,true).
holds(Fluent,T) :- caused(Fluent,T).
holds(Fluent,T) :- holds(Fluent,T-1), not occurs(Action,T) : postcondition(Action,Fluent,false); T<=horizon.
goalAt(T) :- holds(variable(Variable),T) : goal(variable(Variable), value(Variable,true));
not holds(variable(Variable),T) : goal(variable(Variable), value(Variable,false));
T=horizon.
:- not goalAt(horizon).
#show occurs/2.
% #show holds/2.

View File

@ -0,0 +1,30 @@
#include <incmode>.
#program base.
precondition(Action,variable(Fluent),Value) :- precondition(Action, variable(Fluent),value(Fluent,Value)).
postcondition(Action,variable(Fluent),Value) :- postcondition(Action,effect(unconditional),variable(Fluent),value(Fluent,Value)).
holds(variable(Fluent),0) :- initialState(variable(Fluent),value(Fluent,true)).
#program step(t).
{ occurs(Action,t) : action(Action) } = 1.
:- occurs(Action,t), precondition(Action,Fluent,true), not holds(Fluent,t-1).
:- occurs(Action,t), precondition(Action,Fluent,false), holds(Fluent,t-1).
caused(Fluent,t) :- occurs(Action,t), postcondition(Action,Fluent,true).
holds(Fluent,t) :- caused(Fluent,t).
holds(Fluent,t) :- holds(Fluent,t-1), not occurs(Action,t) : postcondition(Action,Fluent,false).
#program check(t).
goalAt(t) :- holds(variable(Variable),t) : goal(variable(Variable), value(Variable,true));
not holds(variable(Variable),t) : goal(variable(Variable), value(Variable,false)).
:- not goalAt(t), query(t).
#show occurs/2.
% #show holds/2.

View File

@ -0,0 +1,52 @@
#include <incmode>.
% Check feature requirements
% :- requires(feature(actionCosts)).
#program base.
% Establish initial state
holds(Variable, Value, 0) :- initialState(Variable, Value), not stateVariable(Variable).
% Identify (head and) state variables
headVariable(Rule,Variable) :- variable(Variable), axiomRule(Rule), postcondition(Rule,_,Variable,_).
stateVariable(Variable) :- headVariable(_,Variable).
#program step(t). % t=1,2,...
% Perform actions
1 {occurs(Action, t) : action(Action)} 1.
% Check preconditions
:- occurs(Action, t), precondition(Action, Variable, Value), not holds(Variable, Value, t - 1).
% Apply effects
caused(Variable, Value, t) :- occurs(Action, t), postcondition(Action, Effect, Variable, Value),
holds(Variable', Value', t - 1) : precondition(Effect, Variable', Value').
changed(Variable, t) :- caused(Variable, Value, t).
holds(Variable, Value, t) :- caused(Variable, Value, t).
holds(Variable, Value, t) :- holds(Variable, Value, t - 1), not changed(Variable, t), not stateVariable(Variable).
#program check(t). % t=0,1,...
% Check that variables have unique values
:- variable(Variable), {holds(Variable, Value, t) : contains(Variable, Value)} != 1.
% Check mutexes
:- mutexGroup(MutexGroup), {holds(Variable, Value, t) : contains(MutexGroup, Variable, Value)} > 1.
% Apply axioms
derived(Variable, Value, t) :- axiomRule(Rule), postcondition(Rule,_,Variable,Value),
holds(Variable', Value', t) : precondition(Rule, Variable', Value'), not headVariable(Rule,Variable').
modified(Variable, t) :- derived(Variable, Value, t).
holds(Variable, Value, t) :- derived(Variable, Value, t), stateVariable(Variable).
holds(Variable, Value, t) :- not modified(Variable, t), stateVariable(Variable), initialState(Variable, Value).
% Verify that goal is met
:- query(t), goal(Variable, Value), not holds(Variable, Value, t).
#show occurs/2.
% #show holds/3.

View File

@ -0,0 +1,40 @@
#include <incmode>.
% Check feature requirements
:- requires(feature(actionCosts)).
:- requires(feature(axiomRules)).
:- requires(feature(conditionalEffects)).
#program base.
% Establish initial state
holds(Variable, Value, 0) :- initialState(Variable, Value).
#program step(t).
% Perform actions
1 {occurs(Action, t) : action(Action)} 1.
% Check preconditions
:- occurs(Action, t), precondition(Action, Variable, Value), not holds(Variable, Value, t - 1).
% Apply effects
caused(Variable, Value, t) :- occurs(Action, t), postcondition(Action, _, Variable, Value).
modified(Variable, t) :- caused(Variable, Value, t).
holds(Variable, Value, t) :- caused(Variable, Value, t).
holds(Variable, Value, t) :- holds(Variable, Value, t - 1), not modified(Variable, t).
% Check that variables have unique values
:- variable(Variable), not 1 {holds(Variable, Value, t) : contains(Variable, Value)} 1.
% Check mutexes
:- mutexGroup(MutexGroup), not {holds(Variable, Value, t) : contains(MutexGroup, Variable, Value)} 1.
#program check(t).
% Verify that goal is met
:- query(t), goal(Variable, Value), not holds(Variable, Value, t).
#show query/1.
#show occurs/2.

View File

@ -0,0 +1,71 @@
#const horizon=1.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Horizon, must be defined externally
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
time(0..horizon).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Establish initial state
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
holds(Variable, Value, 0) :- initialState(Variable, Value).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute derived predicates
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conjunctive preconditions
satisfied(DerivedPredicate, type(and), T) :- derivedPredicate(DerivedPredicate, type(and)), holds(Variable, Value, T) : precondition(DerivedPredicate, type(and), Variable, Value); time(T).
% disjunctive preconditions
satisfied(DerivedPredicate, type(or), T) :- precondition(DerivedPredicate, type(or), Variable, Value), holds(Variable, Value, T), time(T).
holds(DerivedVariable, Value, T) :- satisfied(DerivedPredicate, Type, T), postcondition(DerivedPredicate, Type, effect(unconditional), DerivedVariable, Value).
holds(derivedVariable(DerivedVariable), value(DerivedVariable, false), T) :- derivedVariable(DerivedVariable), not holds(derivedVariable(DerivedVariable), value(DerivedVariable, true), T), time(T).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Perform actions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1 {occurs(Action, T) : action(Action)} 1 :- time(T), T > 0.
% Check preconditions
:- occurs(Action, T), precondition(Action, Variable, Value), not holds(Variable, Value, T - 1).
% Apply effects
caused(Variable, Value, T) :-
occurs(Action, T),
postcondition(Action, Effect, Variable, Value),
holds(VariablePre, ValuePre, T - 1) : precondition(Effect, VariablePre, ValuePre).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Inertia rules
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
modified(Variable, T) :- caused(Variable, Value, T).
holds(Variable, Value, T) :- caused(Variable, Value, T).
holds(variable(V), Value, T) :- holds(variable(V), Value, T - 1), not modified(variable(V), T), time(T).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Variables and mutex groups
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check that variables have unique values
:- variable(Variable), not 1 {holds(Variable, Value, T) : contains(Variable, Value)} 1, time(T).
% Check mutexes
:- mutexGroup(MutexGroup), not {holds(Variable, Value, T) : contains(MutexGroup, Variable, Value)} 1, time(T).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Verify that goal is met
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- goal(Variable, Value), not holds(Variable, Value, horizon).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#show occurs/2.

View File

@ -0,0 +1,73 @@
# Incremental STRIPS Planning Encodings
This suite of incremental STRIPS planning encodings implements diverse methods.
The included encoding files provide the following functionalities:
## Encodings
### [incmode.lp](incmode.lp): include built-in “iclingo“ script for incremental grounding and solving
### [preprocess.lp](preprocess.lp): static analysis of potentially relevant actions
* Parameter: `_closure` (default value: `3`)
* Value `1`: forward chaining of effects w.r.t. initial variable values
* Value `2`: backward regression of effects w.r.t. goal variable values
* Value `3`: both forward chaining and backward regression of effects
* Otherwise: off (simply take all actions as given)
### [strips-incremental.lp](strips-incremental.lp): sequential and parallel planning encoding variants
* Parameter: `_parallel` (default value: `0`)
* Value `1`: “forall” parallel actions that can be arranged in any sequence
* Value `2`: “exists” parallel actions that can be arranged in some sequence
* Value `3`: “exists“ parallel actions omitting achievement of preconditions
* Value `4`: “exists“ parallel actions like `3` implemented by acyclicity
* Otherwise: sequential actions
* Parameter: `planner_on` (default value: `0`)
* Value `0`: no compatibility to ASP-based planner (no idle steps permitted)
* Otherwise: compatibility to ASP-based planner (idle steps permitted)
### [redundancy.lp](redundancy.lp): enforcement of redundant actions to constrain parallel plans
* Remarks:
* Only relevant together with parallel actions not implemented by acyclicity
* Encoded constraints seem rather ineffective though
* Heavy space overhead in combination with “exists” parallel actions
### [postprocess.lp](postprocess.lp): plan feasibility checking and conversion to sequential plan
## Usage Examples
Some example invocations (using `clingo` 5.1.0) are as follows:
```bash
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _closure=0
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _closure=1
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _closure=2
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _parallel=1
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _parallel=2
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _parallel=3
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _parallel=4
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _parallel=1 redundancy.lp
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _parallel=2 redundancy.lp
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp -c _parallel=3 redundancy.lp
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp --outf=1 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp --outf=1 -c _parallel=1 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp --outf=1 -c _parallel=2 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp --outf=1 -c _parallel=3 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - incmode.lp preprocess.lp strips-incremental.lp --outf=1 -c _parallel=4 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
```

View File

@ -0,0 +1,3 @@
% Include built-in "iclingo" script for incremental grounding and solving
#include <incmode>.

View File

@ -0,0 +1,58 @@
% Convert a plan (possibly with parallel actions), given by atoms over occurs/2,
% to a sequential plan, expressed by atoms over sequence/2
time(T) :- occurs(A,T).
time :- time(T).
:- goal(X,V), not initialState(X,V), not time.
last(T2) :- time, T2 = #max{T1 : time(T1)}.
offset(T2,M) :- time(T2), M = #count{A,T1 : occurs(A,T1), T1 < T2}.
finish(T,M+N) :- offset(T,M), N = #count{A : occurs(A,T)}.
index(T,M+1..N) :- offset(T,M), finish(T,N).
postcondition(A,X,V) :- postcondition(A,E,X,V), occurs(A,T).
postcondition(A,X) :- postcondition(A,X,V).
before(A1,A2,T) :- occurs(A1,T), occurs(A2,T), A1 != A2,
precondition(A1,X,V), postcondition(A2,X), not postcondition(A2,X,V).
order(A1,A2,T) :- occurs(A1,T), occurs(A2,T), A1 < A2, A <= A1 : occurs(A,T), A < A2.
first(A2,T) :- occurs(A2,T), #false : order(A1,A2,T).
undone(A,T,M) :- occurs(A,T), offset(T,M).
undone(A,T,N) :- undone(A,T,N-1), select(A1,T,N), A != A1, index(T,N+1).
done(A,T,N) :- select(A,T,N).
done(A,T,N) :- done(A,T,N-1), index(T,N).
:- finish(T,N), occurs(A,T), not done(A,T,N).
hold(X,V,0) :- initialState(X,V).
hold(X,V,N) :- select(A,T,N), postcondition(A,X,V).
hold(X,V,N) :- select(A,T,N), hold(X,V,N-1), not postcondition(A,X).
:- last(T), finish(T,N), goal(X,V), not hold(X,V,N).
hold(X,N) :- hold(X,V,N).
:- hold(X,N), #count{V : hold(X,V,N)} > 1.
preconditions(A,T,N) :- undone(A,T,N), hold(X,V,N) : precondition(A,X,V).
applicable(A,T,N) :- preconditions(A,T,N), done(A1,T,N) : before(A1,A,T).
inapplicable(A,T,N) :- done(A,T,N), index(T,N+1).
inapplicable(A,T,N) :- undone(A,T,N), precondition(A,X,V1), hold(X,V2,N), V1 != V2.
inapplicable(A,T,N) :- undone(A1,T,N), before(A1,A,T).
continue(A2,T,N) :- order(A1,A2,T), inapplicable(A1,T,N), first(A1,T).
continue(A2,T,N) :- order(A1,A2,T), inapplicable(A1,T,N), continue(A1,T,N).
select(A,T,N+1) :- applicable(A,T,N), first(A,T).
select(A,T,N+1) :- applicable(A,T,N), continue(A,T,N).
% DISPLAY PART
#show.
#show sequence(A,N) : select(A,T,N).

View File

@ -0,0 +1,50 @@
% Constant '_closure' to (de)activate analysis of potentially relevant actions
% - value '1': forward chaining of effects w.r.t. initial variable values
% - value '2': backward regression of effects w.r.t. goal variable values
% - value '3': both forward chaining and backward regression of effects
% - otherwise: off
#const _closure = 3.
% BASE PROGRAM
% Check feature requirements
:- requires(feature(actionCosts)).
:- requires(feature(axiomRules)).
:- requires(feature(conditionalEffects)).
% Basic redundancy check for actions
postcondition(A,X,V) :- postcondition(A,E,X,V).
has_condition(A,X,0) :- action(A), precondition(A,X,V).
has_condition(A,X,1) :- action(A), postcondition(A,X,V).
inconsistent(A) :- has_condition(A,X,P),
#count{V : precondition(A,X,V), P = 0;
V : postcondition(A,X,V), P = 1} > 1.
consistent(A) :- action(A), not inconsistent(A).
irredundant(A) :- consistent(A), postcondition(A,X,V), not precondition(A,X,V).
% Forward chaining of effects w.r.t. initial variable values
feasible(X,V) :- initialState(X,V).
feasible(X,V) :- possible(A), postcondition(A,X,V).
possible(A) :- irredundant(A), feasible(X,V) : precondition(A,X,V).
possible(A) :- irredundant(A), _closure != 1, _closure != 3.
:- goal(X,V), not feasible(X,V).
% Backward regression of effects w.r.t. goal variable values
produce(X,V) :- goal(X,V), not initialState(X,V).
produce(X,V) :- active(A), precondition(A,X,V), not initialState(X,V).
produce(X,V) :- persist(X,V), active(A), has_condition(A,X,1), not postcondition(A,X,V).
persist(X,V) :- goal(X,V), initialState(X,V).
persist(X,V) :- active(A), precondition(A,X,V), initialState(X,V).
active(A) :- possible(A), postcondition(A,X,V), produce(X,V).
active(A) :- possible(A), _closure != 2, _closure != 3.

View File

@ -0,0 +1,50 @@
% Additional rules for enforcing the inclusion of parallel actions in plans,
% whenever such 'redundant' actions are compatible with states and other actions
% BASE PROGRAM
selfdefeat(A) :- selfdefeat(A,X).
disjoin(A,A1) :- active(A), has_condition(A,X,P), selfdefeat(A1,X), not selfdefeat(A).
compatible(A,A1) :- active(A), active(A1), A != A1, 1 < _parallel, _parallel < 4,
not diverge(A,A1), not exclude(A,A1), not disable(A,A1) : disable(A1,A).
compatible(A) :- compatible(A,A1).
compatible(A) :- active(A), active(A1), A != A1, _parallel = 1, not selfdefeat(A),
not diverge(A,A1), not exclude(A,A1), not disjoin(A,A1).
disable(A,A1,A2) :- compatible(A,A1), compatible(A,A2), compatible(A1,A2),
disable(A1,A2), not disable(A1,A).
disabled(A,A1) :- compatible(A), disable(A,A1).
disabled(A,A2) :- simulate(A,A1), disable(A,A1,A2).
simulate(A,A1) :- compatible(A,A1), not disable(A1,A), disabled(A,A1).
simulate(A,A1) :- compatible(A,A1), not disable(A1,A), scope(X,V),
postcondition(A1,X,V), not precondition(A1,X,V).
% STEP PROGRAM
#program step(t).
defeated(A,t) :- compatible(A), postcondition(A,X,V), fluent(X), not holds(X,V,t).
defeated(A,t) :- compatible(A), precondition(A,X,V), not holds(X,V,t-1), _parallel != 2.
defeated(A,t) :- compatible(A), precondition(A,X,V), not has_condition(A,X,1), not holds(X,V,t),
_parallel = 1.
defeated(A,t) :- compatible(A), has_condition(A,X,1), not has_condition(A,X,0), single(X,t).
proceed(A,X,V,t) :- compatible(A), holds(X,V,t-1), scope(X,V).
proceed(A,X,V,t) :- simulate(A,A1), perform(A,A1,t), occurs(A1,t), scope(X,V),
postcondition(A1,X,V), not precondition(A1,X,V).
perform(A,A1,t) :- simulate(A,A1),
proceed(A,X,V,t) : precondition(A1,X,V), _parallel = 2;
alright(A,A2,t) : disable(A,A1,A2).
alright(A,A1,t) :- disabled(A,A1), not occurs(A1,t).
alright(A,A1,t) :- disabled(A,A1), perform(A,A1,t).
defeated(A,t) :- compatible(A), precondition(A,X,V), not proceed(A,X,V,t), _parallel = 2.
defeated(A,t) :- compatible(A), disable(A,A1), not alright(A,A1,t).
:- compatible(A), not occurs(A,t), not defeated(A,t), 0 < _parallel, _parallel < 4.

View File

@ -0,0 +1,143 @@
% Constant '_parallel' to enable parallel actions
% - value '0': parallel actions *without* checking for mutual disablement
% - value '1': "forall" parallel actions that can be arranged in any sequence
% - value '2': "exists" parallel actions that can be arranged in some sequence
% - value '3': "exists" parallel actions omitting achievement of preconditions
% - value '4': "exists" parallel actions like '3' implemented by acyclicity
% - otherwise: sequential actions
#const _parallel = 5.
% Constant '_shallow' to cheaply approximate mutually disabling parallel actions
% - value '0': detect incompatible pre/postconditions to reduce parallel actions
% - otherwise: over-approximate parallel actions (in testing mutual disablement)
#const _shallow = 0.
% Constant '_inertia' to choose flat or tiered format for transition constraints
% - value '0': use flat rules (integrity constraints) for transition constraints
% - otherwise: use rules that provide auxiliary atoms for transition constraints
#const _inertia = 0.
% Constant 'planner_on' to enable encoding support for ASP-based planner
% - value '0': no compatibility to ASP-based planner (no idle steps permitted)
% - otherwise: compatibility to ASP-based planner (idle steps permitted)
#const planner_on = 0.
% BASE PROGRAM
% Define auxiliary predicates for actions w.r.t. parallel mode
selfdefeat(A,X) :- active(A), precondition(A,X,V), _parallel = 1,
has_condition(A,X,1), not postcondition(A,X,V).
diverge(A1,A2,X) :- active(A1), active(A2), postcondition(A1,X,V),
has_condition(A2,X,1), not postcondition(A2,X,V),
0 <= _parallel, _parallel < 5, _shallow = 0.
diverge(A1,A2) :- diverge(A1,A2,X).
exclude(A1,A2) :- active(A1), active(A2), precondition(A1,X,V),
has_condition(A2,X,0), not precondition(A2,X,V),
0 <= _parallel, _parallel < 5, _parallel != 2, _shallow = 0.
disable(A1,A2) :- active(A1), active(A2), A1 != A2, postcondition(A1,X,V),
has_condition(A2,X,0), not precondition(A2,X,V),
not diverge(A1,A2), not exclude(A1,A2),
1 < _parallel, _parallel < 5.
disable :- _parallel = 4, #sum{1,A1 : disable(A1,A2); -1,A2 : disable(A1,A2)} > 0.
scope(X,V) :- active(A), precondition(A,X,V), _parallel = 2.
% Define relevant fluents w.r.t. parallel mode
fluent(X,V) :- produce(X,V).
fluent(X,V) :- persist(X,V).
fluent(X,V) :- initialState(X,V), fluent(X).
fluent(X,V) :- active(A), postcondition(A,X,V), fluent(X).
fluent(X) :- fluent(X,V).
fluent(X) :- diverge(A1,A2,X), not exclude(A1,A2).
fluent(X) :- active(A), has_condition(A,X,1), 0 <= _parallel, _parallel < 5, _shallow != 0.
% Define unsubsumed mutexes
mutex(G,X) :- mutexGroup(G), contains(G,X,V), fluent(X,V).
mutex(G) :- mutexGroup(G), #count{X : mutex(G,X)} > 1.
% Define initial state
holds(X,V,0) :- initialState(X,V), fluent(X).
:- fluent(X), #count{V : holds(X,V,0)} > 1.
:- mutex(G), #count{X,V : holds(X,V,0), contains(G,X,V)} > 1.
% STEP PROGRAM
#program step(t).
% Generate successor state
1 {holds(X,V,t) : fluent(X,V)} 1 :- fluent(X).
:- mutex(G), #count{X,V : holds(X,V,t), contains(G,X,V)} > 1.
change(X,t) :- holds(X,V,t-1), not holds(X,V,t), _inertia != 0.
% Generate actions
{occurs(A,t)} :- active(A).
:- planner_on = 0, not occurs(A,t) : active(A).
:- occurs(A,t), postcondition(A,X,V), fluent(X), not holds(X,V,t).
effect(X,t) :- occurs(A,t), postcondition(A,X,V), fluent(X), not precondition(A,X,V),
_inertia != 0.
:- change(X,t), not effect(X,t).
:- _inertia = 0, holds(X,V,t), not holds(X,V,t-1),
not occurs(A,t) : active(A), postcondition(A,X,V), not precondition(A,X,V).
% Checks w.r.t. parallel mode
:- _parallel != 0, _parallel != 1, _parallel != 2, _parallel != 3, _parallel != 4,
#count{A : occurs(A,t)} > 1.
:- _parallel != 2, occurs(A,t), precondition(A,X,V), not holds(X,V,t-1).
:- _parallel = 1, occurs(A,t), precondition(A,X,V), not has_condition(A,X,1), not holds(X,V,t).
single(X,t) :- occurs(A,t), selfdefeat(A,X).
:- single(X,t), #count{A : occurs(A,t), postcondition(A,X,V), not precondition(A,X,V)} > 1.
proceed(X,V,t) :- holds(X,V,t-1), scope(X,V).
proceed(X,V,t) :- perform(A,t), scope(X,V), postcondition(A,X,V), not precondition(A,X,V),
occurs(A,t).
perform(A,t) :- active(A), 1 < _parallel, _parallel < 4,
proceed(X,V,t) : precondition(A,X,V), _parallel = 2;
alright(A1,t) : disable(A,A1).
alright(A,t) :- active(A), 1 < _parallel, _parallel < 4, not occurs(A,t).
alright(A,t) :- perform(A,t).
:- 1 < _parallel, _parallel < 4, active(A), not alright(A,t).
#edge((A1,t),(A2,t)) : disable(A1,A2), occurs(A1,t), _parallel = 4, not disable.
#edge((A1,t),(A2,t)) : disable(A1,A2), occurs(A2,t), disable.
% CHECK PROGRAM
#program check(t).
% Check goal conditions
:- query(t), goal(X,V), not holds(X,V,t).
% DISPLAY PART
#show occurs/2.

36
include/plasp/Language.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef __PLASP__LANGUAGE_H
#define __PLASP__LANGUAGE_H
#include <string>
namespace plasp
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Language
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class Language
{
public:
enum class Type
{
Unknown,
Automatic,
PDDL,
SAS
};
static Language::Type fromString(const std::string &languageName);
public:
Language() = delete;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
}
#endif

View File

@ -0,0 +1,52 @@
#ifndef __PLASP__LANGUAGE_DETECTION_H
#define __PLASP__LANGUAGE_DETECTION_H
#include <tokenize/Tokenizer.h>
#include <plasp/Language.h>
namespace plasp
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// LanguageDetection
//
////////////////////////////////////////////////////////////////////////////////////////////////////
inline Language::Type detectLanguage(tokenize::Tokenizer<tokenize::CaseInsensitiveTokenizerPolicy> &tokenizer)
{
tokenizer.skipWhiteSpace();
// SAS begins with "begin_version"
if (tokenizer.testAndSkip<std::string>("begin"))
{
tokenizer.seek(0);
return Language::Type::SAS;
}
// Skip potential PDDL comments
while (tokenizer.currentCharacter() == ';')
{
tokenizer.skipLine();
tokenizer.skipWhiteSpace();
}
// PDDL contains sections starting with “(define”
// Some legacy domains contain “in-package” sections, however
if (tokenizer.testAndSkip<std::string>("(")
&& (tokenizer.testAndSkip<std::string>("define") || tokenizer.testAndSkip<std::string>("in-package")))
{
tokenizer.seek(std::ios::beg);
return Language::Type::PDDL;
}
tokenizer.seek(std::ios::beg);
return Language::Type::Unknown;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
#endif

View File

@ -1,13 +1,11 @@
#ifndef __PLASP__SAS__TRANSLATOR_EXCEPTION_H
#define __PLASP__SAS__TRANSLATOR_EXCEPTION_H
#ifndef __PLASP__TRANSLATOR_EXCEPTION_H
#define __PLASP__TRANSLATOR_EXCEPTION_H
#include <exception>
#include <string>
namespace plasp
{
namespace sas
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
@ -39,7 +37,7 @@ class TranslatorException: public std::exception
const char *what() const throw()
{
if (m_message.empty())
return "Unspecified error while translating SAS description";
return "Unspecified error while translating description";
return m_message.c_str();
}
@ -50,7 +48,6 @@ class TranslatorException: public std::exception
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,49 @@
#ifndef __PLASP__PDDL__TRANSLATOR_ASP_H
#define __PLASP__PDDL__TRANSLATOR_ASP_H
#include <colorlog/ColorStream.h>
#include <pddl/NormalizedASTForward.h>
#include <pddl/Parse.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// TranslatorASP
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class TranslatorASP
{
public:
explicit TranslatorASP(const ::pddl::normalizedAST::Description &description, colorlog::ColorStream &outputStream);
void translate() const;
private:
void translateDomain() const;
void translateUtils() const;
void translateTypes() const;
void translatePredicates() const;
void translateDerivedPredicates(const ::pddl::normalizedAST::DerivedPredicateDeclarations &derivedPredicates) const;
void translateActions() const;
void translateProblem() const;
void translateInitialState() const;
void translateGoal() const;
void translateConstants(const std::string &heading, const ::pddl::ast::ConstantDeclarations &constants) const;
const ::pddl::normalizedAST::Description &m_description;
colorlog::ColorStream &m_outputStream;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,110 @@
#ifndef __PLASP__PDDL__TRANSLATION__CONDITIONAL_EFFECT_H
#define __PLASP__PDDL__TRANSLATION__CONDITIONAL_EFFECT_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <plasp/TranslatorException.h>
#include <plasp/pddl/translation/Predicate.h>
#include <plasp/pddl/translation/Primitives.h>
#include <plasp/pddl/translation/Variables.h>
#include <plasp/pddl/translation/VariableStack.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// ConditionalEffect
//
////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PrintObjectName>
inline void translateConditionalEffect(colorlog::ColorStream &outputStream,
const ::pddl::normalizedAST::ConditionalEffect &conditionalEffect,
PrintObjectName printObjectName, VariableStack &variableStack,
size_t &numberOfConditionalEffects, VariableIDMap &variableIDs)
{
const auto handlePredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate, bool isPositive = true)
{
outputStream << std::endl << colorlog::Function("postcondition") << "(";
printObjectName();
outputStream
<< ", " << colorlog::Keyword("effect") << "("
<< colorlog::Number<size_t>(numberOfConditionalEffects) << ")"
<< ", ";
translatePredicateToVariable(outputStream, *predicate, variableIDs, isPositive);
outputStream << ") :- " << colorlog::Function("action") << "(";
printObjectName();
outputStream << ")";
if (!variableStack.layers.empty())
for (const auto &layer : variableStack.layers)
{
if (!layer->empty())
outputStream << ", ";
translateVariablesForRuleBody(outputStream, *layer, variableIDs);
}
outputStream << ".";
};
const auto handleNegatedPredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate)
{
handlePredicate(predicate, false);
};
const auto handleDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &, bool = true)
{
// TODO: refactor as to exclude derived predicates from the Effect variant
throw TranslatorException("derived predicates should not appear in effects, please report to the bug tracker");
};
const auto handleNegatedDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate)
{
handleDerivedPredicate(derivedPredicate, false);
};
const auto handleAtomicFormula =
[&](const ::pddl::normalizedAST::AtomicFormula &atomicFormula)
{
atomicFormula.match(handlePredicate, handleDerivedPredicate);
};
const auto handleNot =
[&](const ::pddl::normalizedAST::NotPointer<::pddl::normalizedAST::AtomicFormula> &not_)
{
not_->argument.match(handleNegatedPredicate, handleNegatedDerivedPredicate);
};
const auto handleLiteral =
[&](const ::pddl::normalizedAST::Literal &literal)
{
literal.match(handleAtomicFormula, handleNot);
};
const auto handleAnd =
[&](const ::pddl::normalizedAST::AndPointer<::pddl::normalizedAST::Literal> &and_)
{
for (const auto &argument : and_->arguments)
handleLiteral(argument);
};
conditionalEffect.match(handleAnd, handleLiteral);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,127 @@
#ifndef __PLASP__PDDL__TRANSLATION__DERIVED_PREDICATE_H
#define __PLASP__PDDL__TRANSLATION__DERIVED_PREDICATE_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <pddl/Parse.h>
#include <plasp/pddl/translation/Primitives.h>
#include <plasp/pddl/translation/Variables.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DerivedPredicate
//
////////////////////////////////////////////////////////////////////////////////////////////////////
void translateDerivedPredicate(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::DerivedPredicate &derivedPredicate, VariableIDMap &variableIDs);
void translateDerivedPredicateDeclaration(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::DerivedPredicateDeclaration &derivedPredicateDeclaration, VariableIDMap &variableIDs);
////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: avoid code duplication with translatePredicate
inline void translateDerivedPredicate(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::DerivedPredicate &derivedPredicate, VariableIDMap &variableIDs)
{
const auto &arguments = derivedPredicate.arguments;
if (arguments.empty())
{
outputStream << *derivedPredicate.declaration;
return;
}
outputStream << "(" << *derivedPredicate.declaration;
for (const auto &argument : arguments)
{
outputStream << ", ";
const auto handleConstant =
[&](const ::pddl::normalizedAST::ConstantPointer &constant)
{
outputStream << colorlog::Keyword("constant") << "(" << *constant << ")";
};
const auto handleVariable =
[&](const ::pddl::normalizedAST::VariablePointer &variable)
{
translateVariable(outputStream, *variable, variableIDs);
};
argument.match(handleConstant, handleVariable);
}
outputStream << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translateDerivedPredicateDeclaration(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::DerivedPredicateDeclaration &derivedPredicateDeclaration, VariableIDMap &variableIDs)
{
outputStream << colorlog::Keyword("derivedVariable") << "(";
if (derivedPredicateDeclaration.parameters.empty())
{
outputStream << derivedPredicateDeclaration << ")";
return;
}
outputStream << "(" << derivedPredicateDeclaration;
translateVariablesForRuleHead(outputStream, derivedPredicateDeclaration.parameters, variableIDs);
outputStream << "))";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translateDerivedPredicateToVariable(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::DerivedPredicate &derivedPredicate, VariableIDMap &variableIDs, bool isPositive = true)
{
outputStream << colorlog::Keyword("derivedVariable") << "(";
translateDerivedPredicate(outputStream, derivedPredicate, variableIDs);
outputStream
<< "), "
<< colorlog::Keyword("value") << "("
<< colorlog::Keyword("derivedVariable") << "(";
translateDerivedPredicate(outputStream, derivedPredicate, variableIDs);
outputStream << "), ";
if (isPositive)
outputStream << colorlog::Boolean("true");
else
outputStream << colorlog::Boolean("false");
outputStream << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translateDerivedPredicateDeclarationToVariable(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::DerivedPredicateDeclaration &derivedPredicateDeclaration, VariableIDMap &variableIDs, bool isPositive = true)
{
translateDerivedPredicateDeclaration(outputStream, derivedPredicateDeclaration, variableIDs);
outputStream << ", " << colorlog::Keyword("value") << "(";
translateDerivedPredicateDeclaration(outputStream, derivedPredicateDeclaration, variableIDs);
outputStream << ", ";
if (isPositive)
outputStream << colorlog::Boolean("true");
else
outputStream << colorlog::Boolean("false");
outputStream << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,106 @@
#ifndef __PLASP__PDDL__TRANSLATION__DERIVED_PREDICATE_PRECONDITION_H
#define __PLASP__PDDL__TRANSLATION__DERIVED_PREDICATE_PRECONDITION_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <plasp/TranslatorException.h>
#include <plasp/pddl/translation/DerivedPredicate.h>
#include <plasp/pddl/translation/Predicate.h>
#include <plasp/pddl/translation/Primitives.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DerivedPredicatePrecondition
//
////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PrintObjectName>
inline void translateDerivedPredicatePrecondition(colorlog::ColorStream &outputStream,
const ::pddl::normalizedAST::DerivedPredicatePrecondition &derivedPredicatePrecondition,
const std::string &objectType, PrintObjectName printObjectName, VariableIDMap &variableIDs)
{
const auto handlePredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate, bool isPositive = true)
{
outputStream << std::endl << colorlog::Function("precondition") << "(";
printObjectName();
outputStream << ", ";
translatePredicateToVariable(outputStream, *predicate, variableIDs, isPositive);
outputStream << ") :- " << colorlog::Function(objectType.c_str()) << "(";
printObjectName();
outputStream << ").";
};
const auto handleNegatedPredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate)
{
handlePredicate(predicate, false);
};
const auto handleDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate, bool isPositive = true)
{
outputStream << std::endl << colorlog::Function("precondition") << "(";
printObjectName();
outputStream << ", ";
translateDerivedPredicateToVariable(outputStream, *derivedPredicate, variableIDs, isPositive);
outputStream << ") :- " << colorlog::Function(objectType.c_str()) << "(";
printObjectName();
outputStream << ").";
};
const auto handleNegatedDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate)
{
handleDerivedPredicate(derivedPredicate, false);
};
const auto handleAtomicFormula =
[&](const ::pddl::normalizedAST::AtomicFormula &atomicFormula)
{
atomicFormula.match(handlePredicate, handleDerivedPredicate);
};
const auto handleNot =
[&](const ::pddl::normalizedAST::NotPointer<::pddl::normalizedAST::AtomicFormula> &not_)
{
not_->argument.match(handleNegatedPredicate, handleNegatedDerivedPredicate);
};
const auto handleLiteral =
[&](const ::pddl::normalizedAST::Literal &literal)
{
literal.match(handleAtomicFormula, handleNot);
};
const auto handleAnd =
[&](const ::pddl::normalizedAST::AndPointer<::pddl::normalizedAST::Literal> &and_)
{
for (const auto &argument : and_->arguments)
handleLiteral(argument);
};
const auto handleOr =
[&](const ::pddl::normalizedAST::OrPointer<::pddl::normalizedAST::Literal> &or_)
{
for (const auto &argument : or_->arguments)
handleLiteral(argument);
};
derivedPredicatePrecondition.match(handleLiteral, handleAnd, handleOr);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,172 @@
#ifndef __PLASP__PDDL__TRANSLATION__EFFECT_H
#define __PLASP__PDDL__TRANSLATION__EFFECT_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <plasp/TranslatorException.h>
#include <plasp/pddl/translation/ConditionalEffect.h>
#include <plasp/pddl/translation/Precondition.h>
#include <plasp/pddl/translation/Predicate.h>
#include <plasp/pddl/translation/Primitives.h>
#include <plasp/pddl/translation/Variables.h>
#include <plasp/pddl/translation/VariableStack.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Effect
//
////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PrintObjectName>
inline void translateEffect(colorlog::ColorStream &outputStream,
const ::pddl::normalizedAST::Effect &effect, PrintObjectName printObjectName,
VariableStack &variableStack, size_t &numberOfConditionalEffects, VariableIDMap &variableIDs)
{
const auto handlePredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate, bool isPositive = true)
{
outputStream << std::endl << colorlog::Function("postcondition") << "(";
printObjectName();
outputStream
<< ", " << colorlog::Keyword("effect") << "("
<< colorlog::Reserved("unconditional") << ")"
<< ", ";
translatePredicateToVariable(outputStream, *predicate, variableIDs, isPositive);
outputStream << ") :- " << colorlog::Function("action") << "(";
printObjectName();
outputStream << ")";
if (!variableStack.layers.empty())
for (const auto &layer : variableStack.layers)
{
if (!layer->empty())
outputStream << ", ";
translateVariablesForRuleBody(outputStream, *layer, variableIDs);
}
outputStream << ".";
};
const auto handleNegatedPredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate)
{
handlePredicate(predicate, false);
};
const auto handleDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &, bool = true)
{
// TODO: refactor as to exclude derived predicates from the Effect variant
throw TranslatorException("derived predicates should not appear in effects, please report to the bug tracker");
};
const auto handleNegatedDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate)
{
handleDerivedPredicate(derivedPredicate, false);
};
const auto handleAtomicFormula =
[&](const ::pddl::normalizedAST::AtomicFormula &atomicFormula)
{
atomicFormula.match(handlePredicate, handleDerivedPredicate);
};
const auto handleNot =
[&](const ::pddl::normalizedAST::NotPointer<::pddl::normalizedAST::AtomicFormula> &not_)
{
not_->argument.match(handleNegatedPredicate, handleNegatedDerivedPredicate);
};
const auto handleLiteral =
[&](const ::pddl::normalizedAST::Literal &literal)
{
literal.match(handleAtomicFormula, handleNot);
};
const auto handleAnd =
[&](const ::pddl::normalizedAST::AndPointer<::pddl::normalizedAST::Effect> &and_)
{
for (const auto &argument : and_->arguments)
translateEffect(outputStream, argument, printObjectName, variableStack,
numberOfConditionalEffects, variableIDs);
};
const auto handleForAll =
[&](const ::pddl::normalizedAST::ForAllPointer<::pddl::normalizedAST::Effect> &forAll)
{
variableStack.push(&forAll->parameters);
translateEffect(outputStream, forAll->argument, printObjectName,
variableStack, numberOfConditionalEffects, variableIDs);
variableStack.pop();
};
const auto handleWhen =
[&](const ::pddl::normalizedAST::WhenPointer<::pddl::normalizedAST::Precondition,
::pddl::normalizedAST::ConditionalEffect> &when)
{
numberOfConditionalEffects++;
const auto printConditionalEffectIdentifier =
[&]()
{
outputStream << colorlog::Keyword("effect") << "("
<< colorlog::Number<size_t>(numberOfConditionalEffects) << ")";
};
const auto printPreconditionRuleBody =
[&]()
{
outputStream << " :- " << colorlog::Function("action") << "(";
printObjectName();
outputStream << ")";
for (const auto &layer : variableStack.layers)
{
if (!layer->empty())
outputStream << ", ";
translateVariablesForRuleBody(outputStream, *layer, variableIDs);
}
};
translatePrecondition(outputStream, when->argumentLeft,
printConditionalEffectIdentifier, printPreconditionRuleBody, variableIDs);
translateConditionalEffect(outputStream, when->argumentRight, printObjectName,
variableStack, numberOfConditionalEffects, variableIDs);
};
effect.match(handleAnd, handleForAll, handleLiteral, handleWhen);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PrintObjectName>
inline void translateEffect(colorlog::ColorStream &outputStream,
const ::pddl::normalizedAST::Effect &effect, PrintObjectName printObjectName,
size_t &numberOfConditionalEffects, VariableIDMap &variableIDs)
{
VariableStack variableStack;
translateEffect(outputStream, effect, printObjectName, variableStack,
numberOfConditionalEffects, variableIDs);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,73 @@
#ifndef __PLASP__PDDL__TRANSLATION__FACT_H
#define __PLASP__PDDL__TRANSLATION__FACT_H
#include <pddl/NormalizedAST.h>
#include <plasp/TranslatorException.h>
#include <plasp/pddl/translation/Predicate.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Fact
//
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translateFact(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::Fact &fact)
{
outputStream << std::endl << colorlog::Function("initialState") << "(";
VariableIDMap variableIDs;
const auto handlePredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate, bool isPositive = true)
{
translatePredicateToVariable(outputStream, *predicate, variableIDs, isPositive);
};
const auto handleNegatedPredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate)
{
return handlePredicate(predicate, false);
};
const auto handleDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &, bool = true)
{
throw TranslatorException("derived predicates should not occur in initial state");
};
const auto handleNegatedDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate)
{
return handleDerivedPredicate(derivedPredicate, false);
};
const auto handleAtomicFormula =
[&](const ::pddl::normalizedAST::AtomicFormula &atomicFormula)
{
atomicFormula.match(handlePredicate, handleDerivedPredicate);
};
const auto handleNot =
[&](const ::pddl::normalizedAST::NotPointer<::pddl::normalizedAST::AtomicFormula> &not_)
{
not_->argument.match(handleNegatedPredicate, handleNegatedDerivedPredicate);
};
fact.match(handleAtomicFormula, handleNot);
outputStream << ").";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,102 @@
#ifndef __PLASP__PDDL__TRANSLATION__GOAL_H
#define __PLASP__PDDL__TRANSLATION__GOAL_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <plasp/TranslatorException.h>
#include <plasp/pddl/translation/DerivedPredicate.h>
#include <plasp/pddl/translation/Predicate.h>
#include <plasp/pddl/translation/Primitives.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Goal
//
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translateGoal(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::Goal &goal)
{
VariableIDMap variableIDs;
const auto ensureNoVariables =
[](const auto &predicate)
{
for (const auto &argument : predicate->arguments)
if (argument.template is<::pddl::normalizedAST::VariablePointer>())
throw TranslatorException("goal descriptions must be variable-free");
};
const auto handlePredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate, bool isPositive = true)
{
ensureNoVariables(predicate);
outputStream << std::endl << colorlog::Function("goal") << "(";
translatePredicateToVariable(outputStream, *predicate, variableIDs, isPositive);
outputStream << ").";
};
const auto handleNegatedPredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate)
{
handlePredicate(predicate, false);
};
const auto handleDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate, bool isPositive = true)
{
ensureNoVariables(derivedPredicate);
outputStream << std::endl << colorlog::Function("goal") << "(";
translateDerivedPredicateToVariable(outputStream, *derivedPredicate, variableIDs, isPositive);
outputStream << ").";
};
const auto handleNegatedDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate)
{
handleDerivedPredicate(derivedPredicate, false);
};
const auto handleAtomicFormula =
[&](const ::pddl::normalizedAST::AtomicFormula &atomicFormula)
{
atomicFormula.match(handlePredicate, handleDerivedPredicate);
};
const auto handleNot =
[&](const ::pddl::normalizedAST::NotPointer<::pddl::normalizedAST::AtomicFormula> &not_)
{
not_->argument.match(handleNegatedPredicate, handleNegatedDerivedPredicate);
};
const auto handleLiteral =
[&](const ::pddl::normalizedAST::Literal &literal)
{
literal.match(handleAtomicFormula, handleNot);
};
const auto handleAnd =
[&](const ::pddl::normalizedAST::AndPointer<::pddl::normalizedAST::Literal> &and_)
{
for (const auto &argument : and_->arguments)
handleLiteral(argument);
};
goal.match(handleLiteral, handleAnd);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,99 @@
#ifndef __PLASP__PDDL__TRANSLATION__PRECONDITION_H
#define __PLASP__PDDL__TRANSLATION__PRECONDITION_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <plasp/TranslatorException.h>
#include <plasp/pddl/translation/DerivedPredicate.h>
#include <plasp/pddl/translation/Predicate.h>
#include <plasp/pddl/translation/Primitives.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Precondition
//
////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PrintObjectName, typename PrintRuleBody>
inline void translatePrecondition(colorlog::ColorStream &outputStream,
const ::pddl::normalizedAST::Precondition &precondition, PrintObjectName printObjectName,
PrintRuleBody printRuleBody, VariableIDMap &variableIDs)
{
const auto handlePredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate, bool isPositive = true)
{
outputStream << std::endl << colorlog::Function("precondition") << "(";
printObjectName();
outputStream << ", ";
translatePredicateToVariable(outputStream, *predicate, variableIDs, isPositive);
outputStream << ")";
printRuleBody();
outputStream << ".";
};
const auto handleNegatedPredicate =
[&](const ::pddl::normalizedAST::PredicatePointer &predicate)
{
handlePredicate(predicate, false);
};
const auto handleDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate, bool isPositive = true)
{
outputStream << std::endl << colorlog::Function("precondition") << "(";
printObjectName();
outputStream << ", ";
translateDerivedPredicateToVariable(outputStream, *derivedPredicate, variableIDs, isPositive);
outputStream << ")";
printRuleBody();
outputStream << ".";
};
const auto handleNegatedDerivedPredicate =
[&](const ::pddl::normalizedAST::DerivedPredicatePointer &derivedPredicate)
{
handleDerivedPredicate(derivedPredicate, false);
};
const auto handleAtomicFormula =
[&](const ::pddl::normalizedAST::AtomicFormula &atomicFormula)
{
atomicFormula.match(handlePredicate, handleDerivedPredicate);
};
const auto handleNot =
[&](const ::pddl::normalizedAST::NotPointer<::pddl::normalizedAST::AtomicFormula> &not_)
{
not_->argument.match(handleNegatedPredicate, handleNegatedDerivedPredicate);
};
const auto handleLiteral =
[&](const ::pddl::normalizedAST::Literal &literal)
{
literal.match(handleAtomicFormula, handleNot);
};
const auto handleAnd =
[&](const ::pddl::normalizedAST::AndPointer<::pddl::normalizedAST::Literal> &and_)
{
for (const auto &argument : and_->arguments)
handleLiteral(argument);
};
precondition.match(handleLiteral, handleAnd);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,109 @@
#ifndef __PLASP__PDDL__TRANSLATION__PREDICATE_H
#define __PLASP__PDDL__TRANSLATION__PREDICATE_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <pddl/Parse.h>
#include <plasp/pddl/translation/Primitives.h>
#include <plasp/pddl/translation/Variables.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Predicate
//
////////////////////////////////////////////////////////////////////////////////////////////////////
void translatePredicate(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::Predicate &predicate, VariableIDMap &variableIDs);
void translatePredicateDeclaration(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::PredicateDeclaration &predicateDeclaration, VariableIDMap &variableIDs);
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translatePredicate(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::Predicate &predicate, VariableIDMap &variableIDs)
{
const auto &arguments = predicate.arguments;
if (arguments.empty())
{
outputStream << *predicate.declaration;
return;
}
outputStream << "(" << *predicate.declaration;
for (const auto &argument : arguments)
{
outputStream << ", ";
const auto handleConstant =
[&](const ::pddl::normalizedAST::ConstantPointer &constant)
{
outputStream << colorlog::Keyword("constant") << "(" << *constant << ")";
};
const auto handleVariable =
[&](const ::pddl::normalizedAST::VariablePointer &variable)
{
translateVariable(outputStream, *variable, variableIDs);
};
argument.match(handleConstant, handleVariable);
}
outputStream << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translatePredicateDeclaration(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::PredicateDeclaration &predicateDeclaration, VariableIDMap &variableIDs)
{
outputStream << colorlog::Keyword("variable") << "(";
if (predicateDeclaration.parameters.empty())
{
outputStream << predicateDeclaration << ")";
return;
}
outputStream << "(" << predicateDeclaration;
translateVariablesForRuleHead(outputStream, predicateDeclaration.parameters, variableIDs);
outputStream << "))";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void translatePredicateToVariable(colorlog::ColorStream &outputStream, const ::pddl::normalizedAST::Predicate &predicate, VariableIDMap &variableIDs, bool isPositive = true)
{
outputStream << colorlog::Keyword("variable") << "(";
translatePredicate(outputStream, predicate, variableIDs);
outputStream
<< "), "
<< colorlog::Keyword("value") << "("
<< colorlog::Keyword("variable") << "(";
translatePredicate(outputStream, predicate, variableIDs);
outputStream << "), ";
if (isPositive)
outputStream << colorlog::Boolean("true");
else
outputStream << colorlog::Boolean("false");
outputStream << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,100 @@
#ifndef __PLASP__PDDL__TRANSLATION__PRIMITIVES_H
#define __PLASP__PDDL__TRANSLATION__PRIMITIVES_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <plasp/TranslatorException.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Primitives
//
////////////////////////////////////////////////////////////////////////////////////////////////////
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::ConstantDeclaration &constantDeclaration)
{
assert(!constantDeclaration.name.empty());
return (stream << colorlog::String(constantDeclaration.name.c_str()));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::Constant &constant)
{
assert(constant.declaration != nullptr);
return (stream << *constant.declaration);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::PrimitiveTypeDeclaration &primitiveTypeDeclaration)
{
assert(!primitiveTypeDeclaration.name.empty());
return (stream << colorlog::String(primitiveTypeDeclaration.name.c_str()));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::PrimitiveType &primitiveType)
{
assert(primitiveType.declaration != nullptr);
return (stream << *primitiveType.declaration);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: move to appropriate header
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::Action &action)
{
return (stream << colorlog::String(action.name.c_str()));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: move to appropriate header
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::PredicateDeclaration &predicateDeclaration)
{
return (stream << colorlog::String(predicateDeclaration.name.c_str()));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: move to appropriate header
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::Predicate &predicate)
{
return (stream << *predicate.declaration);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: move to appropriate header
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::DerivedPredicateDeclaration &derivedPredicateDeclaration)
{
return (stream << colorlog::String(derivedPredicateDeclaration.name.c_str()));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: move to appropriate header
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::normalizedAST::DerivedPredicate &derivedPredicate)
{
return (stream << *derivedPredicate.declaration);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,64 @@
#ifndef __PLASP__PDDL__TRANSLATION__VARIABLE_H
#define __PLASP__PDDL__TRANSLATION__VARIABLE_H
#include <map>
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Variable
//
////////////////////////////////////////////////////////////////////////////////////////////////////
using VariableIDMap = std::map<const ::pddl::normalizedAST::VariableDeclaration *, size_t>;
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translateVariableDeclaration(colorlog::ColorStream &stream, ::pddl::normalizedAST::VariableDeclaration &variableDeclaration, VariableIDMap &variableIDs)
{
assert(!variableDeclaration.name.empty());
const auto variableID =
[&]()
{
const auto matchingVariableID = variableIDs.find(&variableDeclaration);
if (matchingVariableID != variableIDs.cend())
return matchingVariableID->second;
const auto variableID = variableIDs.size() + 1;
variableIDs.insert({&variableDeclaration, variableID});
return variableID;
};
stream
<< colorlog::Format({colorlog::Color::Green, colorlog::FontWeight::Bold})
<< "X" << variableID()
<< colorlog::ResetFormat();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
inline void translateVariable(colorlog::ColorStream &stream, ::pddl::normalizedAST::Variable &variable, VariableIDMap &variableIDs)
{
assert(variable.declaration != nullptr);
translateVariableDeclaration(stream, *variable.declaration, variableIDs);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,39 @@
#ifndef __PLASP__PDDL__TRANSLATION__VARIABLE_STACK_H
#define __PLASP__PDDL__TRANSLATION__VARIABLE_STACK_H
#include <pddl/NormalizedAST.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// VariableStack
//
////////////////////////////////////////////////////////////////////////////////////////////////////
struct VariableStack
{
using Layer = ::pddl::normalizedAST::VariableDeclarations *;
void push(Layer layer)
{
layers.push_back(layer);
}
void pop()
{
layers.pop_back();
}
std::vector<Layer> layers;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -0,0 +1,75 @@
#ifndef __PLASP__PDDL__TRANSLATION__VARIABLES_H
#define __PLASP__PDDL__TRANSLATION__VARIABLES_H
#include <colorlog/Formatting.h>
#include <pddl/NormalizedAST.h>
#include <pddl/Parse.h>
#include <plasp/TranslatorException.h>
#include <plasp/pddl/translation/Variable.h>
namespace plasp
{
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Variables
//
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class T>
void translateVariablesForRuleHead(colorlog::ColorStream &outputStream, const T &variables, VariableIDMap &variableIDs);
template<class T>
void translateVariablesForRuleBody(colorlog::ColorStream &outputStream, const T &variables, VariableIDMap &variableIDs);
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class T>
inline void translateVariablesForRuleHead(colorlog::ColorStream &outputStream, const T &variables, VariableIDMap &variableIDs)
{
for (const auto &variable : variables)
{
outputStream << ", ";
translateVariableDeclaration(outputStream, *variable, variableIDs);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class T>
void translateVariablesForRuleBody(colorlog::ColorStream &outputStream, const T &variables, VariableIDMap &variableIDs)
{
for (const auto &variable : variables)
{
if (&variable != &*variables.begin())
outputStream << ", ";
if (variable->type)
{
if (!variable->type.value().template is<::pddl::normalizedAST::PrimitiveTypePointer>())
throw TranslatorException("only primitive types supported currently");
const auto &type = variable->type.value().template get<::pddl::normalizedAST::PrimitiveTypePointer>();
outputStream << colorlog::Function("has") << "(";
translateVariableDeclaration(outputStream, *variable, variableIDs);
outputStream << ", " << colorlog::Keyword("type") << "(" << *type << "))";
}
else
{
outputStream << colorlog::Function("has") << "(";
translateVariableDeclaration(outputStream, *variable, variableIDs);
outputStream << ", " << colorlog::Keyword("type") << "(" << colorlog::String("object") << "))";
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -4,6 +4,8 @@
#include <iosfwd>
#include <vector>
#include <tokenize/Tokenizer.h>
#include <plasp/sas/Value.h>
#include <plasp/sas/Variable.h>
@ -26,8 +28,8 @@ using AssignedVariables = std::vector<AssignedVariable>;
class AssignedVariable
{
public:
static AssignedVariable fromSAS(std::istream &istream, const Variables &variables);
static AssignedVariable fromSAS(std::istream &istream, const Variable &variable);
static AssignedVariable fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
static AssignedVariable fromSAS(tokenize::Tokenizer<> &tokenizer, const Variable &variable);
public:
explicit AssignedVariable(const Variable &variable, const Value &value);

View File

@ -3,6 +3,8 @@
#include <vector>
#include <tokenize/Tokenizer.h>
#include <plasp/sas/AssignedVariable.h>
#include <plasp/sas/Variable.h>
@ -28,7 +30,7 @@ class AxiomRule
using Condition = AssignedVariable;
using Conditions = AssignedVariables;
static AxiomRule fromSAS(std::istream &istream, const Variables &variables);
static AxiomRule fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
public:
const Conditions &conditions() const;

View File

@ -3,6 +3,8 @@
#include <iosfwd>
#include <colorlog/ColorStream.h>
#include <plasp/sas/Description.h>
namespace plasp
@ -16,7 +18,7 @@ namespace sas
//
////////////////////////////////////////////////////////////////////////////////////////////////////
std::ostream &operator >>(std::ostream &ostream, const Description &description);
colorlog::ColorStream &operator<<(colorlog::ColorStream &ostream, const Description &description);
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1,11 +1,12 @@
#ifndef __PLASP__SAS__DESCRIPTION_H
#define __PLASP__SAS__DESCRIPTION_H
#include <experimental/filesystem>
#include <iosfwd>
#include <memory>
#include <vector>
#include <boost/filesystem/path.hpp>
#include <tokenize/Tokenizer.h>
#include <plasp/sas/AxiomRule.h>
#include <plasp/sas/Goal.h>
@ -28,8 +29,9 @@ namespace sas
class Description
{
public:
static Description fromTokenizer(tokenize::Tokenizer<> &&tokenizer);
static Description fromStream(std::istream &istream);
static Description fromFile(const boost::filesystem::path &path);
static Description fromFile(const std::experimental::filesystem::path &path);
public:
bool usesActionCosts() const;
@ -43,17 +45,21 @@ class Description
bool usesAxiomRules() const;
bool usesConditionalEffects() const;
bool hasRequirements() const;
private:
Description();
void parseVersionSection(std::istream &istream) const;
void parseMetricSection(std::istream &istream);
void parseVariablesSection(std::istream &istream);
void parseMutexSection(std::istream &istream);
void parseInitialStateSection(std::istream &istream);
void parseGoalSection(std::istream &istream);
void parseOperatorSection(std::istream &istream);
void parseAxiomSection(std::istream &istream);
void parseContent(tokenize::Tokenizer<> &tokenizer);
void parseVersionSection(tokenize::Tokenizer<> &tokenizer) const;
void parseMetricSection(tokenize::Tokenizer<> &tokenizer);
void parseVariablesSection(tokenize::Tokenizer<> &tokenizer);
void parseMutexSection(tokenize::Tokenizer<> &tokenizer);
void parseInitialStateSection(tokenize::Tokenizer<> &tokenizer);
void parseGoalSection(tokenize::Tokenizer<> &tokenizer);
void parseOperatorSection(tokenize::Tokenizer<> &tokenizer);
void parseAxiomSection(tokenize::Tokenizer<> &tokenizer);
bool m_usesActionCosts;

View File

@ -3,6 +3,8 @@
#include <vector>
#include <tokenize/Tokenizer.h>
#include <plasp/sas/AssignedVariable.h>
#include <plasp/sas/Variable.h>
@ -28,7 +30,7 @@ class Effect
using Condition = AssignedVariable;
using Conditions = AssignedVariables;
static Effect fromSAS(std::istream &istream, const Variables &variables, Conditions &preconditions);
static Effect fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables, Conditions &preconditions);
public:
const Conditions &conditions() const;

View File

@ -1,6 +1,8 @@
#ifndef __PLASP__SAS__GOAL_H
#define __PLASP__SAS__GOAL_H
#include <tokenize/Tokenizer.h>
#include <plasp/sas/AssignedVariable.h>
namespace plasp
@ -20,7 +22,7 @@ class Goal
using Fact = AssignedVariable;
using Facts = AssignedVariables;
static Goal fromSAS(std::istream &istream, const Variables &variables);
static Goal fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
public:
const Facts &facts() const;

View File

@ -1,6 +1,8 @@
#ifndef __PLASP__SAS__INITIAL_STATE_H
#define __PLASP__SAS__INITIAL_STATE_H
#include <tokenize/Tokenizer.h>
#include <plasp/sas/AssignedVariable.h>
namespace plasp
@ -20,7 +22,7 @@ class InitialState
using Fact = AssignedVariable;
using Facts = AssignedVariables;
static InitialState fromSAS(std::istream &istream, const Variables &variables);
static InitialState fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
public:
const Facts &facts() const;

View File

@ -3,6 +3,8 @@
#include <vector>
#include <tokenize/Tokenizer.h>
#include <plasp/sas/AssignedVariable.h>
namespace plasp
@ -27,7 +29,7 @@ class MutexGroup
using Fact = AssignedVariable;
using Facts = AssignedVariables;
static MutexGroup fromSAS(std::istream &istream, const Variables &variables);
static MutexGroup fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
public:
const Facts &facts() const;

View File

@ -4,11 +4,16 @@
#include <string>
#include <vector>
#include <tokenize/Tokenizer.h>
#include <colorlog/ColorStream.h>
#include <plasp/sas/AssignedVariable.h>
#include <plasp/sas/Effect.h>
#include <plasp/sas/Predicate.h>
#include <plasp/sas/Variable.h>
namespace plasp
{
namespace sas
@ -31,10 +36,10 @@ class Operator
using Condition = AssignedVariable;
using Conditions = AssignedVariables;
static Operator fromSAS(std::istream &istream, const Variables &variables);
static Operator fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
public:
void printPredicateAsASP(std::ostream &ostream) const;
void printPredicateAsASP(colorlog::ColorStream &stream) const;
const Predicate &predicate() const;
const Conditions &preconditions() const;

View File

@ -5,6 +5,10 @@
#include <string>
#include <vector>
#include <tokenize/Tokenizer.h>
#include <colorlog/ColorStream.h>
namespace plasp
{
namespace sas
@ -19,13 +23,13 @@ namespace sas
class Predicate
{
public:
static Predicate fromSAS(std::istream &istream);
static Predicate fromSAS(tokenize::Tokenizer<> &tokenizer);
using Arguments = std::vector<std::string>;
public:
void printAsSAS(std::ostream &ostream) const;
void printAsASP(std::ostream &ostream) const;
void printAsSAS(colorlog::ColorStream &stream) const;
void printAsASP(colorlog::ColorStream &stream) const;
const std::string &name() const;
const Arguments &arguments() const;

View File

@ -1,10 +1,12 @@
#ifndef __PLASP__SAS__TRANSLATOR_ASP_H
#define __PLASP__SAS__TRANSLATOR_ASP_H
#include <plasp/sas/Description.h>
#include <iosfwd>
#include <colorlog/ColorStream.h>
#include <plasp/sas/Description.h>
namespace plasp
{
namespace sas
@ -19,12 +21,21 @@ namespace sas
class TranslatorASP
{
public:
explicit TranslatorASP(const Description &description);
explicit TranslatorASP(const Description &description, colorlog::ColorStream &outputStream);
void translate(std::ostream &ostream) const;
void translate() const;
private:
void translateRequirements() const;
void translateInitialState() const;
void translateGoal() const;
void translateVariables() const;
void translateActions() const;
void translateMutexes() const;
void translateAxiomRules() const;
const Description &m_description;
colorlog::ColorStream &m_outputStream;
};
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -5,6 +5,10 @@
#include <string>
#include <vector>
#include <tokenize/Tokenizer.h>
#include <colorlog/ColorStream.h>
namespace plasp
{
namespace sas
@ -36,15 +40,14 @@ struct Value
static const Value Any;
static const Value None;
static Value fromSAS(std::istream &istream);
static const Value &referenceFromSAS(std::istream &istream, const Variable &variable);
static Value fromSAS(tokenize::Tokenizer<> &tokenizer);
static const Value &referenceFromSAS(tokenize::Tokenizer<> &tokenizer, const Variable &variable);
public:
Value negated() const;
void printAsSAS(std::ostream &ostream) const;
void printAsASP(std::ostream &ostream) const;
void printAsASPPredicate(std::ostream &ostream) const;
void printAsSAS(colorlog::ColorStream &stream) const;
void printAsASPPredicate(colorlog::ColorStream &stream) const;
Sign sign() const;
const std::string &name() const;

View File

@ -5,6 +5,10 @@
#include <string>
#include <vector>
#include <tokenize/Tokenizer.h>
#include <colorlog/ColorStream.h>
#include <plasp/sas/Value.h>
namespace plasp
@ -26,11 +30,11 @@ using Variables = std::vector<Variable>;
class Variable
{
public:
static Variable fromSAS(std::istream &istream);
static const Variable &referenceFromSAS(std::istream &istream, const Variables &variables);
static Variable fromSAS(tokenize::Tokenizer<> &tokenizer);
static const Variable &referenceFromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
public:
void printNameAsASPPredicate(std::ostream &ostream) const;
void printNameAsASPPredicate(colorlog::ColorStream &outputStream) const;
const std::string &name() const;
int axiomLayer() const;

View File

@ -3,6 +3,8 @@
#include <iosfwd>
#include <tokenize/Tokenizer.h>
#include <plasp/sas/Value.h>
#include <plasp/sas/Variable.h>
@ -25,7 +27,7 @@ using VariableTransitions = std::vector<VariableTransition>;
class VariableTransition
{
public:
static VariableTransition fromSAS(std::istream &istream, const Variables &variables);
static VariableTransition fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
public:
const Variable &variable() const;

View File

@ -1,56 +0,0 @@
#ifndef __PLASP__UTILS__PARSER_EXCEPTION_H
#define __PLASP__UTILS__PARSER_EXCEPTION_H
#include <exception>
#include <string>
namespace plasp
{
namespace utils
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// ParserException
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class ParserException: public std::exception
{
public:
explicit ParserException()
{
}
explicit ParserException(const char *message)
: m_message(message)
{
}
explicit ParserException(const std::string &message)
: m_message(message)
{
}
~ParserException() throw()
{
}
const char *what() const throw()
{
if (m_message.empty())
return "Unspecified error while parsing SAS description file";
return m_message.c_str();
}
private:
std::string m_message;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@ -1,91 +0,0 @@
#ifndef __PLASP__UTILS__PARSING_H
#define __PLASP__UTILS__PARSING_H
#include <algorithm>
#include <exception>
#include <iosfwd>
#include <sstream>
#include <string>
#include <typeinfo>
#include <boost/algorithm/string/replace.hpp>
#include <plasp/utils/ParserException.h>
namespace plasp
{
namespace utils
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Parsing
//
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class T>
T parse(std::istream &istream)
{
T value;
try
{
istream >> value;
}
catch (const std::exception &e)
{
throw ParserException(std::string("Could not parse value of type ") + typeid(T).name() + " (" + e.what() + ")");
}
return value;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
template<class T>
void parseExpected(std::istream &istream, const T &expectedValue)
{
const auto value = parse<T>(istream);
if (value == expectedValue)
return;
std::stringstream errorStream;
errorStream << "Invalid format, expected " << expectedValue << ", got " + value;
throw utils::ParserException(errorStream.str());
}
////////////////////////////////////////////////////////////////////////////////////////////////////
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;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View 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)))))

View 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))))

View 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))))

View File

@ -0,0 +1,4 @@
instance | minimal horizon | #solutions with minimal horizon
============================================================
problem-01.pddl | 11 | 384
problem-02.pddl | 17 | 46080

View 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)))))

View File

@ -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)))
)

View File

@ -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)))
)

View File

@ -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)))
)

View File

@ -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)))
)

View 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

View 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))))
)

View 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)
))
)

View 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)
))
)

View 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)
))
)

View 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)
))
)

View 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

View 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)))
)

View 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)
)
))

View 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)
)
))

View File

@ -0,0 +1,4 @@
instance | minimal horizon | #solutions with minimal horizon
============================================================
problem-01.pddl | 10 | 16
problem-02.pddl | 15 | 448

Some files were not shown because too many files have changed in this diff Show More