   (expand-node        [se new-threshold]
     "Returns PartialResult of SearchNodes."))
 
+
+
 (deftype GoalNode [goal-state]
   SearchNode
   (extract-goal-state []           goal-state)
   (expand-node        [min-reward] (throw (UnsupportedOperationException.))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Named Node (Helper) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;; Named node is simple non-terminal node whose equality semantics are given by name.
 (deftype NamedNode [name expand-fn] :as this

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Outcome maps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defn make-descendents [state action prim-constructor ref-constructor]
  (if (env/primitive? action)
      (when-let [[ss sr] (and (env/applicable? action state) (env/successor action state))]
        [(prim-constructor (vary-meta ss assoc :opt [action]) sr)])
    (map ref-constructor (hierarchy/immediate-refinements action state))))

(defn generalize-outcome-pair [[outcome-state reward] gen-state reward-to-gen-state]
  [(vary-meta (env/apply-effects gen-state (env/extract-effects outcome-state)) assoc 
              :opt (concat (:opt (meta gen-state)) (:opt (meta outcome-state))))

                           context-state context-reward))))




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; State-Action searches ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(declare make-search-node)

(defn make-incremental-dijkstra-sa-search [state action]
  (make-incremental-dijkstra-search [(make-search-node :transparent [state 0] [action])]))

(defn make-abstracted-incremental-dijkstra-sa-search [state reward action]
  (let [context (env/precondition-context action state)]
    (make-search-in-context 
     (get-cached-search [(env/extract-context state context) (env/action-name action)] 
       (make-incremental-dijkstra-sa-search (env/get-logger state context) action))
     state reward)))

(defn make-abstracted-exhaustive-dijkstra-sa-search [state reward action]
  (make-exhaustive-search (make-abstracted-incremental-dijkstra-sa-search state reward action)))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Search Nodes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
