    Reward is another linear combination term that will be added to the reward."  
   [state effects reward]
   (let [old-state-var-map (get-state-var-map state)
-	lp                (get-incremental-lp state)]
+	lp                (get-incremental-lp state)
+	reward            (map-linear-expr-vars old-state-var-map reward)]
     (make-lp-state* 
      (persistent!
       (reduce (fn [new-state-var-map [effect-var effect-lm]]


(defn make-lp-state 
  "Take a concrete assignment from all state variables to numeric values, and make a fresh
   lp-state.  nil will be a special lp parameter, set to unity."
  [initial-state-map]
;  (assert (every? vector? (keys initial-state-map)))
  (make-lp-state* 
   (map-vals #(hash-map nil %) initial-state-map)
   (lp/make-incremental-lp {nil [1 1]} {} {})))

(defn add-lp-state-param 
  "Add a new parameter to the LP, with optional bounds.  If no bounds give, param will start unbounded."



;(derive ::ContinuousLPState ::le/ContinuousState)
(defstruct lp-state-struct :state-var-map :incremental-lp :reward-const)
(util/deftype ::ContinuousLPState make-lp-state*
  (fn [state-var-map incremental-lp reward-const] 
    (struct lp-state-struct state-var-map incremental-lp reward-const))
  (fn [lps] (vals lps)))

(def get-state-var-map (accessor lp-state-struct :state-var-map))
(def get-incremental-lp (accessor lp-state-struct :incremental-lp))
(def get-reward-const (accessor lp-state-struct :reward-const))

; LP variables are verbatim HLA parameters, and should be unique symbols or keywords.  
; State variables should be vectors.  We will make explicit use of this here ...
