I am trying to do a basic example of optimisation using loco.
I have a vector of costs the index of which corresponds to the integer value of a number of slots and would like to minimize the sum of the costs for a distinct subset of the slots.
Please see my attempt below, which fails to work because there is no "link" between the picked slots and the costs.
(def costs [10 10 20 20 30 30 40 40 10 10])
(let [slot-vars (for [i (range 5)] ($in [:slot i] 1 10))
cost-vars (for [i (range 10)] ($in [:cost i] 10 40))]
(solution
(concat
slot-vars
cost-vars
[($distinct (for [i (range 5)] [:slot i]))]
(for [i (range 5)]
($= [:cost i] (get costs i))))
:minimize (apply $+ (for [i (range 5)] [:slot i]))))