 (defn make-incremental-dijkstra-search [initial-nodes]
   (let [q (make-queue initial-nodes)]
     (reify IncrementalSearch
-      (next-partial-solution [min-reward]
-        (incremental-dijkstra q min-reward expand-node extract-goal-state)))))
+           (next-partial-solution [min-reward]
+             (incremental-dijkstra q min-reward expand-node extract-goal-state)))))
+
 
 
 ;; TODO: need "generalized-goal" dijkstra search.  
+;; TODO: single-goal.
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exhaustive Search ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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))))

  (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 is simple non-terminal node whose equality semantics are given by name.
(deftype NamedNode [name expand-fn] :as this
