Perhaps a bit intense but this problem might lend itself to mixed integer 
linear programming.  MILP is a very broad formulation of optimization 
problems.  Optimal solution of MILP problems is NP-Hard but very mature 
software solutions exist.  I don't know what's out there in Clojure land 
for this but in Python the PuLP library offers idiomatic expression of MILP 
problems and connections to various open source solvers.  At the very least 
you may find their examples illuminating; MILP is a very powerful tool to 
have in your toolbox.

http://pythonhosted.org/PuLP/
http://pythonhosted.org/PuLP/CaseStudies/a_blending_problem.html

On Friday, September 13, 2013 7:52:04 AM UTC-7, Mark Watson wrote:
>
> Hi, newish user here.
>
> I want to make an app that finds a simple, optimized, fantasy baseball 
> lineup.
>
> Each player has a cost associated with them, as well as the average points 
> per game they score, and position. For example: Mike Napoli, 4600, 2.9, 1B
>
> You have to choose one of each position: catcher, pitcher, 1st base, 2nd 
> base, 3rd base, and shortstop. You also have to pick three outfielders. It 
> would be easy to just pick the players with the highest points per game, 
> but you also need to stay under a specified total cost.
>
> Currently, I iterate through every possibility, and swap an atom with a 
> new lineup if the total average points is higher, while staying under the 
> total cost limit.
>
> My issues are:
>
> 1) This seems like an inelegant solution (brute force)
> 2) I don't know how to best handle the fact that I need to select three 
> outfielders from a single list, and cannot select one player more than once
>
> Any advice, suggestions would be great. Thanks!
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to