Hindsight SuperCoach - The Math (some)

Discussion in 'Blog' started by Agent Orange, May 22, 2014.

By Agent Orange on May 22, 2014 at 10:00 AM
  1. Agent Orange

    Agent Orange Moderator

    Joined:
    Jan 3, 2016
    Messages:
    57
    Likes Received:
    0
    From a hindsight perspective the 3 bye-round have to be treated as a block, as running it before the completion of all 3 rounds will be meaningless. As such there was no Hindsight SC round 8 last week and there will be no Hindsight SC round 9 this week, but next week will be a big one covering all 3 bye rounds.
    Some of you have envisioned ginormous matrices, some have even tried brute force calculations in the past and some have just expressed an interest in how 'the math' actually works. I'll lift the veil a bit ...
    Statistics
    First of all, the statistics. Without them the math is just a theoretical excercise and initially this looked liked the biggest roadblock. Luckily walesy came through with the goods and now I collect them on a weekly basis from the TooSerious website. I'm only collecting the weekly salaries and scores of the players (having already done the once-off setup of the full list of players and their positions including dual position players); all other stats are interesting but of no use for Hindsight SC.
    Knapsack
    As mentioned in my round 2 post, in essence of the whole game of SuperCoach is a traditional knapsack problem, i.e. 'given a set of items, each with a mass and a value, determine the items to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible':
    <ul style='margin-left: 40px;]
    <li>Items = Players</li>
    <li>Mass = Salary</li>
    <li>Value = Score</li>
    <li>Limit = Salary Cap</li>
    </ul>
    This gives the following basic model:
    <p style='margin-left: 40px;]MAX SUM over [Players] of [Selected Player] * [Player Score]
    <p style='margin-left: 40px;]SUBJECT TO
    <ul style='margin-left: 80px;]
    <li>SUM over [Players] of [Selected Player] * [Player Salary] &amp;lt;= [Salary Cap]</li>
    <li>[Selected Player] in {0,1}</li>
    </ul>
    Knapsack - SuperCoach style
    ... with quite a few added complications that are the specific rules of SuperCoach, i.e. 23 rounds, salary movements, 30 trades max in total, 2 or 3 trades max per round, players position(s), team structure, bench players and captain.
    This is where it gets tricky as these rules need to be defined in the terms of and added to the basic model. I have done this and ended up with many more 'subject to' conditions in the model as well as over 240k variables (for the whole season). Nevertheless, the model is only some 63 lines long plus input statistics.
    Calculations
    Now the actual calculations need to be performed to find the optimal solution to the model with inputs. Brute force clearly won't work fast enough. This is where the 'big gun' comes into play ... you need a powerful computer and smart routines and heuristics like presolving, relaxation, simplex and branch & bound.
    At the end of season 2013 I was falling short, but I had the time to let the calculations run for over a week. For the 2014 weekly runs I had to step this up big time and now (7 rounds into the season) the calculations are still done in no time; a rerun of the 2013 season took 20 minute so I should be good until the end of the 2014 season.
    Finally I have to process the output (thousands of variables) back into a meaningful format to get the weekly teams and trades. This is quite painful and, time permitting, is my next focus for improvement.
     

Comments

Discussion in 'Blog' started by Agent Orange, May 22, 2014.

Share This Page