 (def *collect-equal-outputs* true) ;; Collect identical output sets
 (def *decompose-cache*       true) ;; nil for none, or bind to hashmap
 (def *state-abstraction*     :eager ) ;; Or lazy or nil.
+(def *propagate-subusmption* false)
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

              (summaries/summary-changed! ret))
          (if (#{:SA :OC} (first (sp-name o))) 
            (add-sp-child! ret o)
            (connect-and-watch-stub! ret (make-output-collecting-stub (stub o))
              #(add-sp-child! ret %)))))) ;; No update needed
    ret))




;; TODO: we keep reward for :blocked case
;; Note: weirdly, sometimes ignoring it helps. (not always)
;; Three cases here: terminal, subsuming sp to piggyback, fresh.
(defn- make-atomic-subproblem [stb out-set reward status]
  (let [inp-set  (input-set stb)
        ri-fn    (fn [s ri] (get-stub (stub-name stb) ri))]
    (if (not (= status :live))
      (let [leaf-s #(summary/make-simple-summary (min (summaries/get-bound %) reward) status %)]
        (make-simple-subproblem stb out-set true leaf-s ri-fn))
      (let [ret (make-simple-subproblem stb out-set false summaries/or-summary ri-fn)]
        (if-let [subsuming-sps (seq (filter #(not (terminal? %)) (subsuming-sps (tree-summarizer stb))))]
          (connect-and-watch! ret (apply min-key (comp summary/max-reward summaries/summary sp-ts) subsuming-sps)
            (fn [sub-out]
              (add-sp-child-stub-up! ret (refine-input sub-out inp-set))))
          (doseq [child-name (map make-fs-seq-name (fs/child-seqs (second (stub-name stb)) inp-set))]
            (add-sp-child-stub! ret (get-stub child-name inp-set)))) 
        ret))))

;; Note: this is double-stage to lazily generate children.  Could be simpler single-stage.
