About the algorithm (language is not limited, preferably php, for some advice)

Source: Internet
Author: User
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 =. =

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.