Skip to content

Commit c45b584

Browse files
authored
Add additional ASDF systems to support HDDL manipulation (#4)
Add ASDF systems "hddl", "hddl-utils", and "hddl-to-json" to the library.
1 parent f947a9e commit c45b584

33 files changed

+3419
-57
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
I_AGREE_TO_ALLEGRO_EXPRESS_LICENSE: yes
3434

3535
steps:
36+
- name: install JSON wrangling binaries
37+
run: apt update && apt install -y jq python3 python3-pip && python3 -m pip install yq check-jsonschema
38+
3639
- uses: actions/checkout@v3
3740

3841
- run: install-quicklisp

README.org

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,49 @@
1-
* License
1+
* PDDL-TOOLS library
2+
3+
This library contains multiple Common Lisp ASDF systems for
4+
manipulating [[https://planning.wiki/guide/whatis/pddl][Planning Domain Definition Language (PDDL)]], and --
5+
newly added (summer 2023) -- [[https://arxiv.org/abs/1911.05499][Hierarchical Domain Definition Language (HDDL)]].
6+
7+
These libraries enable a programmer to parse PDDL and HDDL, generate
8+
and modify parsed PDDL and HDDL expressions, and then write these
9+
expressions to files for use by AI planners. Constructs handled
10+
include domain definitions, problem definitions, and plans.
11+
12+
Two additional special functionalities:
13+
+ PDDL-PLANNERS :: Attempts to provide a uniform CL interface to a
14+
number of AI planning systems to support automating their use.
15+
+ HDDL-JSON :: Provides JSON schemas for HDDL constructs (domains and
16+
problems) and code for emitting HDDL domains and problems as JSON.
17+
We hope to later provide the same capabilities for PDDL, and also
18+
support reading domains and problems as JSON, not just writing them,
19+
so that planning models can be authored in JSON as well as in PDDL/HDDL.
20+
We believe that this can streamline the development of AI planning
21+
by obviating the need to incorporate HDDL and PDDL parsers in
22+
planners.
23+
24+
** Notes
25+
26+
We plan to provide an executable wrapper around
27+
these libraries for parsing and translation, which will be available
28+
for building -- for those comfortable with Common Lisp -- or for use
29+
through Docker images.
30+
31+
Support for HDDL is as yet only partial. In particular, the library only
32+
support /totally-ordered/ subtasks, not partially-ordered ones. We
33+
expect to add this shortly. Since we do not ourselves need these
34+
constructs, getting it added will be hastened substantially by
35+
requests from potential users (or, even more, pull requests)!
36+
37+
** License
238

339
This code is made publicly available by SIFT, LLC under the terms of the
440
3-clause BSD license, attached as [[file:license.txt][license.txt]].
541

6-
* Component libraries
7-
** PDDL
42+
** Component libraries
43+
44+
*** PDDL
45+
46+
**** PDDL system
847

948
This does not provide any PDDL-wrangling functions (well, with the exception of
1049
=PPRINT-PDDL=, whose job it is to print PDDL /readably/). It simply provides
@@ -14,7 +53,7 @@ bits of code can all wrangle PDDL without getting into package hell. In
1453
particular, it means that one bit of code can read PDDL into an s-expression
1554
that other code can interact with.
1655

17-
** PDDL-UTILS
56+
**** PDDL-UTILS
1857

1958
PDDL-wrangling functions. These are made to allow you to read and write PDDL
2059
files, especially problem files, domain files, and plans. There are also
@@ -23,7 +62,7 @@ of this library is for programmers to be able to make derivative or templated
2362
domains and problems. You can read a problem (domain), set some of its slots
2463
programmatically, and then write it out to a file.
2564

26-
** PDDL-PLANNERS
65+
**** PDDL-PLANNERS
2766

2867
This attempts to provide a uniform-ish API to invoke a number of different
2968
planners from Common Lisp. This is just the core framework here.
@@ -36,6 +75,31 @@ This approach is only somewhat successful, since we find that planners often
3675
have very complex invocation procedures with very particular sets of
3776
configuration options.
3877

78+
*** HDDL
79+
80+
**** HDDL
81+
82+
Playing a role similar to the [[#PDDL system]], this library provides the
83+
~HDDL~ package (Common Lisp namespace) into which HDDL domain can be
84+
parsed.
85+
86+
**** HDDL-UTILS
87+
88+
This is the HDDL-wrangling system proper. It plays an analogous role
89+
to the [[#PDDL-UTILS]] system.
90+
91+
**** HDDL-JSON
92+
93+
This system provides the two key interface functions
94+
~HDDL-JSON:JSON-DUMP-DOMAIN~ and ~HDDL-JSON:JSON-DUMP-PROBLEM~ which,
95+
as their names suggest, provide the ability to write domains and
96+
problems to JSON files.
97+
98+
*** JSON-SCHEMAS
99+
100+
This is not a library, but rather a repository of JSON schemas for
101+
HDDL as written to JSON.
102+
39103

40104

41105
* COMMENT local variables block

do-test.lisp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,20 @@
3636
(asdf:*compile-file-warnings-behaviour* :error))
3737
(ql:quickload ,name :silent nil :verbose t))))
3838

39+
;;; these are done outside the bounds of BUILD-SYSTEM below, because
40+
;;; CL-PPCRE doesn't build clean (at least on SBCL) and CL-JSON does not
41+
;;; build clean on Allegro
42+
(ql:quickload "cl-ppcre")
43+
(ql:quickload "cl-json")
44+
45+
3946
(build-system "pddl-utils")
40-
;; (build-system "hddl-utils")
47+
(build-system "hddl-utils")
48+
(build-system "hddl-to-json")
4149

4250
(ql:quickload "pddl-utils/tests")
43-
;;(ql:quickload "hddl-utils/tests")
51+
(ql:quickload "hddl-utils/tests")
52+
(ql:quickload "hddl-to-json/tests")
4453

4554
(defmacro test-system (name)
4655
`(handler-case
@@ -49,6 +58,7 @@
4958
(uiop:quit 1))))
5059

5160
(test-system "pddl-utils")
52-
;; (test-system "hddl-utils")
61+
(test-system "hddl-utils")
62+
(test-system "hddl-to-json")
5363

5464
(uiop:quit 0)

hddl-to-json.asd

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
;;; -------------------------------------------------------------------------
2+
;;; Copyright 2023, Robert P. Goldman and SIFT, LLC
3+
;;; Available under the BSD 3-clause license, see license.txt
4+
;;;---------------------------------------------------------------------------
5+
6+
(defpackage :sift-hddl-to-json-asd
7+
(:use :common-lisp :asdf))
8+
9+
(in-package :sift-hddl-to-json-asd)
10+
11+
(load-system :fiveam-asdf)
12+
13+
(defsystem :hddl-to-json
14+
:name "SIFT-HDDL-TO-JSON"
15+
:license "BSD 3-clause (see license.txt)"
16+
:version "3.0"
17+
:depends-on (hddl-utils cl-json iterate)
18+
:in-order-to ((test-op (test-op hddl-to-json/tests)))
19+
:pathname "hddl-utils/"
20+
:components ((:file "json")))
21+
22+
(defsystem :hddl-to-json/tests
23+
:depends-on (hddl-to-json fiveam cl-ppcre)
24+
:defsystem-depends-on (fiveam-asdf)
25+
:serial t
26+
:class :fiveam-tester-system
27+
:test-names ((#:hddl-json-tests . :hddl-json-tests)
28+
)
29+
:pathname "hddl-utils/tests/"
30+
:components ((:file "json-tests")))

hddl-utils.asd

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
;;; -------------------------------------------------------------------------
2+
;;; Copyright 2011-2016, SIFT, LLC, Robert P. Goldman, and Ugur Kuter
3+
;;; Available under the BSD 3-clause license, see license.txt
4+
;;;---------------------------------------------------------------------------
5+
6+
(defpackage :sift-hddl-utils-asd
7+
(:use :common-lisp :asdf))
8+
9+
(in-package :sift-hddl-utils-asd)
10+
11+
(defsystem :hddl-utils
12+
:name "SIFT-HDDL-UTILS"
13+
:license "BSD 3-clause (see license.txt)"
14+
:version "3.0"
15+
:depends-on (hddl pddl-utils)
16+
:in-order-to ((test-op (test-op hddl-utils/tests)))
17+
:pathname "hddl-utils/"
18+
:components ((:file "package") ; Package definition.
19+
(:file "decls" :depends-on ("package"))
20+
(:file "commons" :depends-on ("package" "decls"))
21+
#+nil(:file "merger" :depends-on ("package"))
22+
#+nil(:file "problem-macros" :depends-on ("package"))
23+
; (:file "object-methods" :depends-on ("package" "decls"))
24+
))
25+
26+
27+
(defsystem :hddl-utils/tests
28+
:depends-on (pddl-utils fiveam)
29+
:defsystem-depends-on (fiveam-asdf)
30+
:serial t
31+
:class :fiveam-tester-system
32+
:test-names ((#:hddl-tests . :hddl-utils-tests)
33+
)
34+
:pathname "hddl-utils/tests/"
35+
:components ((:file "tests")
36+
(:file "hddl-data")))

0 commit comments

Comments
 (0)