 #_ (def  ^{:private true} cache-trait summaries/uncached-summarizer-node)
   (def ^{:private true} cache-trait summaries/eager-cached-summarizer-node)
 #_ (def ^{:private true} cache-trait summaries/less-eager-cached-summarizer-node)
-#_ (def ^{:private true} cache-trait summaries/lazy-cached-summarizer-node)
+ (def ^{:private true} cache-trait summaries/lazy-cached-summarizer-node)
 #_ (def ^{:private true} cache-trait summaries/pseudo-cached-summarizer-node)
+
+(def *no-identical-nonterminal-outputs* true)
+(def *decompose-cache* #_nil true) ;; nil for none, or bind to hashmap  
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;       Utilities      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn- make-fs-seq-stub
  ([inp-set fs] (make-fs-seq-stub inp-set fs (map fs/fs-name fs)))
  ([inp-set [first-fs & rest-fs] fs-names]
     (let [left-stub (make-atomic-stub nil inp-set first-fs)]
       (if (empty? rest-fs)
         left-stub
         (make-pair-stub1 nil left-stub (rest fs-names)

  (summaries/summary-changed-local! stub)
  (add-output! stub sp))

;; Would be nice to assert consistency, but hard to get before-summary...
;; This version keeps children with same input inside.
;; Actually makes things worse sometimes (more evaluations?!) -- with first, better with last.
(defn add-sp-child! [sp child-sp]
  (assert (not (terminal? sp)))
  (if (and *no-identical-nonterminal-outputs*
           (= (output-set sp) (output-set child-sp))
           (not (terminal? child-sp)))
    (do (connect-and-watch! sp child-sp #(add-sp-child! sp %))
        (summaries/summary-changed! sp ))
    (do (summaries/summary-changed-local! sp)
        (add-output! sp child-sp))))

;; Note: All nonterminal subproblems use or-summary for ri-fn
(defn make-simple-subproblem
