 (defprotocol Subproblem
   (sp-name             [s] "A name to identify this subproblem type (indep. of input)")
   (input-set           [s] "Input set for this subproblem.")
+  (output-set          [s] "Output set for this subproblem.")  
   (sp-ts               [s] "Summarizer that includes outputs/children.")
-  (evaluate!           [s] "Evaluate or throw exception if not evaluable.")
-
-  (get-output-set      [s]   "Return output pair or nil")
-  (add-output-watcher! [s w] "Add watcher to be notified of self when has output.")
-  (set-output-set!     [s o] "Set output set.")
-
-  (get-children        [s]       "List current children, for debugging only.")
-  (add-child-watcher!  [s w]     "Add a watcher to be notified of published child subproblems.")
-  (add-sp-child!       [s o up?] "Add a new subproblem child, published when ready.")
-
-  (add-all-child-watcher! [s w] "Internal.  Watch children, including unpublished ones.")
+  (expand!             [s] "Start expanding or throw exception if not expandable.")
+
+  (publish-child!      [s o] "Add a new subproblem child")
+  (list-children       [s] "List current children, primarily for debugging.")
+  (subscribe-children! [s w] "Register a callback to be called on all published children")
+
   (subsuming-sps       [s]      "Known subproblems with same name, >= inp-set") 
   (add-subsuming-sp!   [s subsuming-sp] "Add subsuming sp") 
 
-  (refine-input        [s refined-input-set] "Return a sp with same name, given subset of input-set. s must have output."))
-
-(defmethod print-method angelic.search.implicit.dash_astar_opt.Subproblem [sp o]
-  (print-method (format "#<SP$%8h %s %s>" (System/identityHashCode sp) (sp-name sp)
-                        (if (get-output-set sp) :OUT :STUB)) o))
+  (refine-input        [s refined-input-set] "Sp with same name, subset of input-set."))
+
+(defmethod print-method angelic.search.implicit.dash_astar_opt_simple.Subproblem [sp o]
+  (print-method (format "#<SP$%8h %s>" (System/identityHashCode sp) (sp-name sp)) o))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Auxillary fns  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   
-(defn- get-output-set! [sp] (let [o (get-output-set sp)] (assert o) o))
-
 (defn- terminal? [sp]
-  (and (empty? (get-children sp))
+  (and (empty? (list-children sp))
        (not (summary/live? (sg/summary sp)))))
 
 (defn- solved-terminal? [sp]
-  (and (empty? (get-children sp))
+  (and (empty? (list-children sp))
        (summary/solved? (sg/summary sp))))
 
 ;; Canonical SPs are Atomic and Pair; wrappers use TS of inner SP.




(defn atomic-name-fs [n] (assert (#{:Atomic} (first n))) (second n))
(defn log-input [fs inp-set] (if *state-abstraction* (fs/get-logger fs inp-set) inp-set))
(defn get-input-key [fs inp-set] (if *state-abstraction* (fs/extract-context fs inp-set) inp-set))


;; and output of right-sp as output of the pair.

;; The slightly tricky part is generating children.  Both left-sp and right-sp
;; may have childen, but to search systematically we branch on only one at a time.
;; This means that our summary should consist of the sum of summaries of
;;   - The subproblem whose children we branch on, and
;;   - The tree summarizer of the other subproblem.
