title: Formula/Class to find best lineup based on salary cap/points
body: <p>With all of the daily fantasy games out there, I am looking to see if I can easily implement a platform that will help identify the optimal lineup for a fantasy league based on a salary cap and projected points for each player.</p>
  
  <p>If given a pool of ~500 players and you need to find the highest scoring lineup of within the maximium salary cap restraints.
  1 Quarter Back
  2 Running Back
  3 Wide Receiver
  1 Tight End
  1 Kicker
  1 Defense</p>
  
  <p>Each player is assigned a salary (that changes weekly) and I will assign projected points for those players. I have this information in a MySQL DB and would prefer to use PHP/Pear or JQuery if that's the best option for calculating this.</p>
  
  <p>The Table looks something like this</p>
  
  <pre><code>player_id name         position salary ranking projected_points
  1         Joe Smith    QB       1000   2       21.7
  2         Jake Plummer QB       2500   6       11.9  
  </code></pre>
  
  <p>I've tried sorting by projected points and filling in the roster, but it obviously will provide the highest scoring team, but also exceeds the salary cap.  I cannot think of a way to have it intelligently remove players and continue to loop through and find the highest scoring lineup based on the salary constraints.</p>
  
  <p>So, is there any PHP or Pear class that you know of that will help "Solve" this type of problem?  Any articles you can point me to for reference?  I'm not asking for someone to do this, but I've been Googleing for a while and the best solution I currently have is this. <a href="http://office.microsoft.com/en-us/excel-help/pick-your-fantasy-football-team-with-solver-HA001124603.aspx" rel="nofollow">http://office.microsoft.com/en-us/excel-help/pick-your-fantasy-football-team-with-solver-HA001124603.aspx</a> and that's using Excel and limited to 200 objects.</p>