The following figure shows the situation: 1. I have two data tables, the basic player Information Table (with the club ID and position saved), and the player value table (with the player value saved). 2, players have four positions: striker, avant-garde, defender, goalkeeper 3. the lowest value of forward is 4.5, the lowest value of forward is 4, the lowest defender is 3.5, the lowest value of goalkeeper is 3, and the highest value of all players is 304, my initial money is 100. now I want to buy 11 players. during the purchase process, follow the following rules, make me leave less money, the better (of course & gt; 0) 5. rule 1 meets the requirements of the lineup: one goalkeeper is required, the number of striker-avantgarde-defender can range from 1-5-4-4-5-5-3-5, 2-4-php algorithm.
The situation is as follows:
1. I have two data tables, the basic player Information Table (with the club ID and position saved), and the player value table (with the player value saved)
2. players have four positions: forward, avant-garde, defender, and goalkeeper
3. the lowest price for a forward is 4.5, the lowest value for an avant-garde is 4, the lowest value for a guard is 3.5, the lowest value for a guard is 3, and the highest value for everyone is 30.
4. my initial money is 100. now I want to buy 11 players. the following rules should be followed during the purchase, make me leave less money, the better (of course> = 0)
5. rule 1 meets the requirements of the lineup: one goalkeeper is required, the number of striker-avantgarde-defender ranges from 1-5--1-4--2--3--4--5--4-3-3-3-4. select from the eight sorting options.
6. a maximum of three players can be selected for the same club.
I am just confused. I think a well-known algorithm may be used, as if it were a genetic algorithm? Solve similar packing problems, but I have never learned this one .... When finding the optimal solution, there may not be any records, for example, the optimal solution is to select 3 9.9 for the forward and 4 10.1 for the defender, however, the data table has less than three power forwards with a value of 9.9.
All the desired headers are fried =. =