Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge in soln-to-alloc-map

  • Loading branch information...
commit 88afe27aac16510a0efa4f34c97c1b975a462ee0 1 parent 1e4db9c
@lvh authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/hood/constraint.clj
View
10 src/hood/constraint.clj
@@ -13,18 +13,16 @@
constraints (conj grant-constraints within-budget)]
(solution constraints :maximize target)))
-(defn ^:private soln-to-alloc-map
- [soln]
- (into {} (for [[[tag application] grant] soln] [application grant])))
-
-(def alloc
+(defn alloc
"Allocates using a constraint solver.
apps is a seq of all applications.
budget is the total budget.
target is the term to optimize.
"
- (comp soln-to-alloc-map solve))
+ [apps budget target]
+ (let [soln (solve apps budget target)]
+ (into {} (for [[[tag application] grant] soln] [application grant]))))
(defn ^:private $expt
[x n]
Please sign in to comment.
Something went wrong with that request. Please try again.