PHP algorithm
The situation is as follows:
1, I have 2 data sheets, player basic information table (save player's ID and location), Player's value list (save players values)
2, players have 4 positions, striker, avant-garde, defender, goalkeeper
3, the striker is worth a minimum of 4.5, avantgarde minimum 4, defender minimum 3.5, goalkeeper minimum 3, all people up to 30
4, my initial money for 100, now I want to buy 11 players, the purchase process, to follow the following rules, after the purchase is completed, let my remaining money the less the better (of course >=0)
5, rule 1, meet the lineup requirements: Must have a goalkeeper, striker-avantgarde-defender of the number can be selected from the 1-5-4,1-4-5,2-5-3,2-3-5,2-4-4,3-5-2,3-4-3,3-3-4 of the 8 permutations.
6, the same club is allowed to choose up to 3 players
Just mengmengdongdong think it might be possible to use a well-known algorithm, like a genetic algorithm? Solve similar packing problems, but this piece has not learned .... And to find the optimal solution, there may be no records, such as the best solution is the forward election 3 9.9, the defender selected 4 10.1 and so on, but the data table value is 9.9 of the forward not enough 3.
The head of the mind is blown =.=