                   (* 0.2 d-range))))
       1)))
 
+
 (defn density
   "Objective function for a candidate density r and desired density rt (e.g. labels-per-cm)"
   [r rt]
   ;;Note the formula should be 2-, not 1- as in the paper.
   (- 2 (max (/ r rt) (/ rt r))))
 
+;;Since the arguments are the same, I don't see what the story is with density / max density.
+;;This isn't satisfactorily explained in the paper.
 (defn max-density [r rt]
   (if (>= r rt)
     (- 2 (/ r rt))

  "Balance the relative merits of different metrics"
  [[simplicity coverage density legibility]]
  (let [w [0.2 0.25 0.5 0.05]]
    (+ (* simplicity (w 1))
       (* coverage (w 2))
       (* density (w 3))
       (* legibility (w 4)))))



(defn search
  "Find best ticks for the data range (dmin, dmax) and target label density m"
  [dmin dmax m]
  )


(defn simplicity
  "Objective function modeling niceness of step sizes and whether a range includes zero."
  [q j label-range-contains-zero]
  (let [v (if label-range-contains-zero 1 0)]
    (if (<= (count Q) 1)
      (+ (- 1 j) v)
      (+ (- 1 (/ (index-of q Q) (dec (count Q))) j)
         v))))

(defn max-simplicity [q j] (simplicity q j true))

(defn coverage
  "Objective function based on distances between extreme data and extreme labels"
