dollabs / pamela

Probabalistic Advanced Modeling and Execution Learning Architecture
Apache License 2.0
233 stars 13 forks source link

HTN/TPN generation doesn't include bounds (or other metadata) declared for primitive methods #98

Closed dcerys closed 7 years ago

dcerys commented 7 years ago

In the following example, the :bounds declared for the primitive methods (e.g., do-a) aren't included in the generated TPN (generated using the htn action)

(defpclass plant []
           :meta {:doc "The Plant API"}
           :methods [(defpmethod do-a {:bounds [2 4]} [])
                     (defpmethod do-b {:bounds [3 6]} [])
                     (defpmethod do-c {:bounds [4 8]} [])
                     (defpmethod do-d [])                  
                     (defpmethod do-e {:bounds [5 10]} [])])

(defpclass infeasible-sequence [plnt]
           :meta {:doc "An example of infeasible sequence of activties"}
           :methods [(defpmethod start
                                 {:doc "Simple TPN with constraints"}
                                 []
                                 (sequence :bounds [10 30]
                                           (plnt.do-a)
                                           (plnt.do-b)
                                           (plnt.do-c)
                                           (plnt.do-d)
                                           (plnt.do-e)))])
dcerys commented 7 years ago

All of the metadata in a primitive method declaration is ignored. E.g., :bounds, :display-name

dcerys commented 7 years ago

Here's a slightly extended example that shows the use of :display-name in do-a, which is currently ignored:

(defpclass plant []
  :meta {:doc "The Plant API"}
  :methods [(defpmethod do-a {:bounds [2 4]
                              :display-name "Due Eh"} [])
            (defpmethod do-b {:bounds [3 6]} [])
            (defpmethod do-c {:bounds [4 8]} [])
            (defpmethod do-d [])
            (defpmethod do-e {:bounds [5 10]} [])])

(defpclass infeasible-sequence [plnt]
  :meta {:doc "An example of infeasible sequence of activties"}
  :methods [(defpmethod start
              {:doc "Simple TPN with constraints"
               :bounds [9 30]
               :display-name "START"}
              []
              (sequence ;;:bounds [10 30]
                (plnt.do-a)
                (plnt.do-b)
                (plnt.do-c)
                (plnt.do-d)
                (plnt.do-e)))])

;; NOTE this pclass must be defined to make the plant instanciation
;; explicit. Root-task: (infeasible-sequence.demo.run.start)
(defpclass infeasible-sequence-demo []
  :fields {:p1 (plant :id "p1" :plant-part "t1" :interface "RMQ")
           :run (infeasible-sequence p1)})
dcerys commented 7 years ago

:bounds is currently supported, but the other metadata still needs to be added.