From fd27884ee53664f8d3a597b896c6fff7d5795a53 Mon Sep 17 00:00:00 2001 From: Laurens Van Houtven <_@lvh.cc> Date: Thu, 6 Mar 2014 23:10:08 +0100 Subject: [PATCH] Move grant constraint definition back into let --- src/hood/constraint.clj | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/hood/constraint.clj b/src/hood/constraint.clj index 9287094..f051351 100644 --- a/src/hood/constraint.clj +++ b/src/hood/constraint.clj @@ -9,17 +9,11 @@ [apps] (for [a apps] [:allocation a])) -(defn grant-constraint - "An application will get between zero and the requested amount of - dollars." - [app] - ($in [:allocation app] 0 (:requested app))) - (defn ^:private solve "Throw the constraint problem into loco." [apps budget target] (let [allocs (alloc-vars apps) - grant-constraints (map grant-constraint apps) + grant-constraints (map #($in [:allocation %] 0 (:requested %)) apps) within-budget ($<= (apply $+ allocs) budget) constraints (conj grant-constraints within-budget)] (solution constraints :maximize target)))