Skip to content

Commit

Permalink
Merge pull request #11 from rpgoldman/hddl-checker
Browse files Browse the repository at this point in the history
Add HDDL checker.
  • Loading branch information
rpgoldman authored Oct 18, 2023
2 parents 989f446 + 5a906b8 commit 48be4f3
Show file tree
Hide file tree
Showing 13 changed files with 492 additions and 49 deletions.
4 changes: 1 addition & 3 deletions hddl-utils.asd
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
:components ((:file "package") ; Package definition.
(:file "decls" :depends-on ("package"))
(:file "commons" :depends-on ("package" "decls"))
#+nil(:file "merger" :depends-on ("package"))
#+nil(:file "problem-macros" :depends-on ("package"))
; (:file "object-methods" :depends-on ("package" "decls"))
(:file "hddl-checker" :depends-on ("commons"))
))


Expand Down
32 changes: 24 additions & 8 deletions hddl-utils/commons.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,30 @@
(constants
(when (has-element-p old-domain :constants)
(domain-constants old-domain)))
(methods (domain-methods old-domain))
(methods (mapcar #'canonicalize-method (domain-methods old-domain)))
(tasks (domain-tasks old-domain))
(actions (domain-actions old-domain)))
(make-domain (domain-name old-domain)
:requirements requirements
:types types
:constants constants
:predicates predicates
:tasks tasks
:methods methods
:actions actions)))
:requirements requirements
:types types
:constants constants
:predicates predicates
:tasks tasks
:methods methods
:actions actions)))

(defun canonicalize-method (original)
(unless (or (find :ordered-subtasks original)
(find :ordered-tasks original))
(error "CANONICALIZE-METHOD does not yet support partially-ordered methods."))
(make-ordered-method (method-name original)
(method-task original)
(method-parameters original)
:precond (method-precondition original)
:tasks (let ((tasks (method-subtasks original)))
(if (eq (first tasks) 'and)
(rest tasks)
tasks))))

(defun make-problem (name &key requirements domain objects init goal
htn
Expand Down Expand Up @@ -248,6 +261,9 @@ arguments. Unless COMPLETE-P is NIL, will check for mandatory components."
(finally (return nil)))
(error "No ordered subtasks found in HTN: ~s" htn)))

(deftype hddl-variable ()
'pddl-variable)


;;; helper function
;;; allows us to match a tag against x as the first component,
Expand Down
Loading

0 comments on commit 48be4f3

Please sign in to comment.