laziness, impatience, and hubris PerlMonks

### Optimization Algorithm Help

by jdlev (Scribe)
 on Aug 22, 2013 at 07:14 UTC Need Help??
jdlev has asked for the wisdom of the Perl Monks concerning the following question:

Help O wise Monks!

I'm totally stumped on how to develop what I'm calling my "fantasy football optimization algorithm".

Here's the general idear. You have \$100,000 to spend for 10 players (2 QB, 2RB, 2WR, 1TE, 2FLEX, 1DEF)...each position player costs you a bit of your \$100,000. So say Drew Brees costs you \$17,000, while some scrub costs you \$5,000. In other words, if you spend a bunch at quarterback, you'll have to get a scrub at running back or vice versa. In building this algorithm, I'm trying to maximize the teams projected points, while staying under \$100,000 in total salary.

So what I've done is converted each player's stats into a value based equation. It's simple. Basically, it's a "cost per point" analysis. In the case of Drew Brees, you have to pay \$17,000 to get him, and he's projected to score 22 points per game, meaning you would roughly have to pay ~\$750 per point.

What I'm trying to develop in perl is a program that looks at the players value rating, and runs through millions of iterations to assemble the team with the most projected points as close to the \$100,000 salary cap as I can.

I haven't been able to get very far. Any ideas on how to do something like this? Should I assemble all data in some arrays or use a mysql db? How should I track when one a new "high score" has been reached? Any help is appreciated, and I'll let you guys/gals know how I do in my league once this is complete :)

I love it when a program comes together - jdhannibal

Replies are listed 'Best First'.
Re: Optimization Algorithm Help (log splitter, cd space, cutting stock, bucketizer, knapsack)
by Anonymous Monk on Aug 22, 2013 at 07:25 UTC
I think the knapsack problem is exactly what I was looking for. Thanks :)
I love it when a program comes together - jdhannibal
Re: Optimization Algorithm Help
by BrowserUk (Pope) on Aug 22, 2013 at 09:27 UTC

I know nothing about football -- be it the English or American -- but I recall that teams over here have 11 players, so I'm assuming this is the American variant. Either way, the following question probably applies.

How do you value defenders given that they (usually?) don't score many points.

As described, your scoring mechanism would tend to favour picking a team of 10 quarterbacks. (I'm assuming they tend to score goals).

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

...(2 QB, 2RB, 2WR, 1TE, 2FLEX, 1DEF)...

It looks like there are limits on what positions can be drafted.

--MidLifeXis

I'm sure there would be, but without a way to comparatively value defenders against forwards, the algorithm reduces to; Fill defense with the cheapest available and spend the rest on the most expensive forwards you can afford; which surely cannot be good.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Create A New User
Node Status?
node history
Node Type: perlquestion [id://1050473]
Approved by BrowserUk
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2018-05-24 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
World peace can best be achieved by:

Results (181 votes). Check out past polls.

Notices?