About the problem of the algorithm (language is not limited, preferably PHP, to seek guidance)

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

  • Related Article

    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.