Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HDDL output for ESS SHOP. #152

Merged
merged 33 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e31438d
Extend SHOP plan trees to record method names.
rpgoldman Jul 16, 2023
a5fc7c1
Partial HDDL export support.
rpgoldman Jul 25, 2023
6a62b65
Add shop3/hddl system.
rpgoldman Sep 1, 2023
2d55638
Update PDDL and HDDL utils to version 3.1.
rpgoldman Oct 18, 2023
405c263
Full version of HDDL plan output.
rpgoldman Oct 18, 2023
f2dd4f0
Add tests for HDDL plan generation.
rpgoldman Oct 19, 2023
31595a3
ESS plan trees can be translated into HDDL plans.
rpgoldman Oct 20, 2023
36d0d2e
Fix type declaration causing SBCL to warn.
rpgoldman Oct 24, 2023
28387d7
Fix symbol name conflict.
rpgoldman Oct 24, 2023
c602ef1
Update SHOP package names.
rpgoldman Oct 24, 2023
5012bef
Update PDDL-TOOLS library.
rpgoldman Oct 25, 2023
2587f7a
Attempt to fix plan tree tests.
rpgoldman Oct 26, 2023
5ef066e
Add HDDL output from ESS.
rpgoldman Nov 3, 2023
88404dc
Minor plan tree enhancements.
rpgoldman Nov 3, 2023
fd98ec7
Fix reduction label handling in classic SHOP trees.
rpgoldman Nov 4, 2023
e35df8d
Disable HDDL plan tree output on classic SHOP.
rpgoldman Nov 4, 2023
b4a3155
Add README for buildapp-base applications.
rpgoldman Nov 6, 2023
1f2f953
Add CL applications and HDDL support to the manual.
rpgoldman Nov 6, 2023
09f329a
Fix tree and task matching.
rpgoldman Nov 28, 2023
71853ad
Fixed indexing nodes for HDDL output.
rpgoldman Nov 6, 2023
a4d96b4
Add PDDL output option to SHOP CLI apps.
rpgoldman Nov 6, 2023
edecd0f
Revise SHOP to use the random-state library for random choices.
rpgoldman Nov 28, 2023
f394ab5
Bump version to 3.12
rpgoldman Nov 28, 2023
abafc0f
Improve documentation only.
rpgoldman Jan 18, 2024
21fcbdd
Pull out plan-repair helper functions.
rpgoldman Feb 29, 2024
3bef4b2
Export PLAN-RETURN class name.
rpgoldman Feb 29, 2024
c1393e8
Add `orphans-ok` keyword argument to `hddl-plan`.
rpgoldman Feb 29, 2024
274ada5
Remove support for `:rationale` argument.
rpgoldman Aug 2, 2024
e2fa86e
Shadow CL:CHECK-TYPE.
rpgoldman Aug 2, 2024
7605276
External updates.
rpgoldman Aug 2, 2024
ae7c77c
Update test count.
rpgoldman Aug 3, 2024
f7ac23d
Minor improvements from lacrosse-0.
rpgoldman Aug 4, 2024
fe7eb75
Use install in Makefile.
rpgoldman Aug 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add PDDL output option to SHOP CLI apps.
  • Loading branch information
rpgoldman committed Aug 5, 2024
commit a4d96b407c4c0cf0d6d07952a86807cefd7406af
80 changes: 53 additions & 27 deletions shop3/buildapp/shop-app-entrypoints.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
(*package* (symbol-package (shop::problem-name shop::*problem*))))
(shop-hddl:print-hddl-plan hddl-plan (if (eq stream-arg t) *standard-output* stream-arg)))))

(defun print-pddl-plan (plan domain &optional (stream-arg t))
(shop:write-pddl-plan plan :domain domain :stream stream-arg))


(defun common/options ()
(list
Expand All @@ -107,10 +110,22 @@
(append
(list
(clingon:make-option
:flag
:description "Print plan tree as well as plan."
:key :plan-tree
:long-name "tree")
:flag
:description "Print plan in PDDL format."
:key :pddl
:long-name "pddl"
)
(clingon:make-option
:string
:description "Print PDDL output to file."
:key :pddl-file
:required nil
:long-name "pddl-file")
(clingon:make-option
:flag
:description "Print plan tree as well as plan."
:key :plan-tree
:long-name "tree")
(clingon:make-option
:string
:description "Print plan tree to file."
Expand Down Expand Up @@ -145,10 +160,14 @@
;; (trace shop-hddl::plan-tree->decompositions)
;; (trace shop-hddl::forest-roots))

(trace write-pddl-plan)

(defun ess/handler (cmd)
(let ((args (clingon:command-arguments cmd))
(plan-tree (or (clingon:getopt cmd :plan-tree)
(clingon:getopt cmd :tree-file)))
(pddl (or (clingon:getopt cmd :pddl)
(clingon:getopt cmd :pddl-file)))
(hddl (or (clingon:getopt cmd :hddl)
(clingon:getopt cmd :hddl-file)))
(verbosity (clingon:getopt cmd :verbose))
Expand All @@ -168,35 +187,42 @@
(error "Unable to find a plan for problem ~a"
(shop::problem-name shop::*problem*)))

(when pddl
(let ((domain (find-domain (domain-name shop::*problem*))))
(if (clingon:getopt cmd :pddl-file)
(write-pddl-plan (plan (first retvals)) :domain domain
:filename (clingon:getopt cmd :pddl-file))
(write-pddl-plan (plan (first retvals)) :domain domain))))

;; print the plan sequence
(unless hddl
(if (clingon:getopt cmd :plan-file)
(let ((plan-stream (open (clingon:getopt cmd :plan-file) :direction :output :if-exists :supersede)))
(unwind-protect
(print-plan (shop:plan (first retvals)) plan-stream)
(unless (eq plan-stream t) (close plan-stream))))
(print-plan (shop:plan (first retvals)) t))

;; print the plan-tree (if appropriate)
(when plan-tree
(if (clingon:getopt cmd :tree-file)
(let ((stream (open (clingon:getopt cmd :tree-file) :direction :output :if-exists :supersede)))
(unwind-protect
(print-ess-tree (tree (first retvals)) stream)
(close stream)))
(print-ess-tree (tree (first retvals)) t))))
(unless (or hddl pddl)
(if (clingon:getopt cmd :plan-file)
(let ((plan-stream (open (clingon:getopt cmd :plan-file) :direction :output :if-exists :supersede)))
(unwind-protect
(print-plan (shop:plan (first retvals)) plan-stream)
(unless (eq plan-stream t) (close plan-stream))))
(print-plan (shop:plan (first retvals)) t))

;; print the plan-tree (if appropriate)
(when plan-tree
(if (clingon:getopt cmd :tree-file)
(let ((stream (open (clingon:getopt cmd :tree-file) :direction :output :if-exists :supersede)))
(unwind-protect
(print-ess-tree (tree (first retvals)) stream)
(close stream)))
(print-ess-tree (tree (first retvals)) t))))

;; print the HDDL, if appropriate
(when hddl
(let ((plan (plan (first retvals)))
(tree (tree (first retvals))))
(if (clingon:getopt cmd :hddl-file)
(let ((stream
(open (clingon:getopt cmd :hddl-file) :direction :output :if-exists :supersede)))
(unwind-protect
(print-hddl-plan plan tree stream)
(unless (eq stream t) (close stream))))
(print-hddl-plan plan tree t))))))))
(if (clingon:getopt cmd :hddl-file)
(let ((stream
(open (clingon:getopt cmd :hddl-file) :direction :output :if-exists :supersede)))
(unwind-protect
(print-hddl-plan plan tree stream)
(unless (eq stream t) (close stream))))
(print-hddl-plan plan tree t))))))))

(defun classic/handler (cmd)
(let ((args (clingon:command-arguments cmd))
Expand Down
2 changes: 1 addition & 1 deletion shop3/pddl/pddl.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ This is an easier to use interface to the validator-export function, qv."
(when (and filename stream-supplied-p)
(error "Cannot supply both a filename and stream destination for write-pddl-plan."))
(when filename
(setf stream (open filename :direction :output)))
(setf stream (open filename :direction :output :if-exists :supersede)))
(unwind-protect
(validator-export shop3-domain shop-plan stream)
(when filename (close stream)))))
Expand Down