        Greedy means we forget about reserving preconditions when free and we can fire right now (less branching).
        Sloppy means we ignore if preconditions are free, but require no action on them.
        Extra-sloppy means anything goes -- if you can execute ignoring commitments, go for it."
-  ([sas-problem] (make-asplan-env sas-problem true true :greedy))
-  ([sas-problem check-deadlock? check-components? edge-rule]
-  (assert (contains? #{:naive :greedy :sloppy :extra-sloppy} edge-rule))     
+  ([sas-problem & {:keys [directed? greedy? deadlock? dead-vars? components?] :as m
+                   :or   {directed? true greedy? true deadlock? true dead-vars? true components? false}}]
+     (assert (every? #{:directed? :greedy? :deadlock? :dead-vars? :components?} (keys m)))
      (def *add-count* (util/sref 0))
-;  (def *dead-count* (util/sref 0))
-     (let [causal-graph  (remove #(apply = %) (sas-analysis/standard-causal-graph sas-problem))
+     (let [edge-rule     (if greedy? :greedy :naive)
+           causal-graph  (remove #(apply = %) (sas-analysis/standard-causal-graph sas-problem))
            vars          (graphs/ancestor-set causal-graph [sas/goal-var-name])
            causal-graph  (filter (fn [[v1 v2]] (and (vars v1) (vars v2))) causal-graph)
            tsi           (graphs/topological-sort-indices causal-graph)

                          c)))))


;; TODO: remove redundant dead-end check ?
(defn possible-activation-actions  
   "Return a list of possible activation actions for var v possible in state s.
   To be possible parent, must be supported from below. "
   [s ancestor-map child-map v]
;   (activation-actions child-map v) #_   
   (for [c (child-map v) :when (not (or (dead-end? s ancestor-map child-map [[ v c]])))]
     (make-set-parent-var-action v c)))
;   (or (deadlocked? s child-map [[v c]]))



          :naive (make-fire-action (->> effect-var action-var (state/get-var s)))
          :greedy (make-greedy-fire-action s effect-var)
          (:sloppy :extra-sloppy) (make-sloppy-fire-action s effect-var))
     #_ (-> (env/applicable? s) assert)))



