|
Analysis of team ranking
This year's game is unusual in that there is no defense and for the most part robots work on their own in parallel to score points. As a result I figured it's reasonable (even more than usual!) to try to compute the average number of points a robot contributes to its alliance. I wrote a quick python3 script that takes as input match data (tested on the DC regional, where my former team 449 is currently playing) and outputs my ranking of teams and the number of points I think they contribute to their alliance. Apologies for the variable names, but hopefully I made up for it in with the comments.
Rankings:
1 (3419, 73.704492305515487)
2 (1731, 46.312538656273205)
3 (1418, 39.472531653896525)
4 (1895, 38.799337600450862)
5 (3490, 36.294428293019763)
6 (1599, 34.28821369481841)
7 (1885, 32.629205449774474)
8 (1033, 32.348123760832848)
9 (1421, 30.478697284154272)
10 (5338, 29.040436495747031)
11 (623, 27.745489727319374)
12 (5549, 27.121269236479719)
13 (1389, 26.60584843249497)
14 (383, 23.671855927551672)
15 (4099, 22.375266604669307)
16 (449, 21.912210928023729)
17 (116, 21.449547070425396)
18 (5243, 19.808177358212305)
19 (612, 17.344396301222865)
20 (4456, 16.61331712295609)
21 (5569, 16.37413112815706)
22 (122, 15.839607260787915)
23 (2377, 15.709065445693666)
24 (3941, 14.395635096324398)
25 (614, 13.631250573400411)
26 (2537, 11.955265914302434)
27 (686, 11.401428768949312)
28 (4541, 9.7651476520334057)
29 (4242, 8.7906915069887415)
30 (5587, 8.488917324654544)
31 (2068, 8.4789566363119739)
32 (3373, 8.3192241916003127)
33 (4821, 7.4396295708618432)
34 (2186, 6.5217325036723395)
35 (3650, 6.196980101798685)
36 (2912, 5.8563204263368132)
37 (620, 5.783804197530789)
38 (53, 5.3467216070143158)
39 (4472, 4.7981247189600955)
40 (2421, 4.7603990054157492)
41 (4464, 4.6403121971023475)
42 (2964, 4.075077317496544)
43 (1123, 3.2348248124167291)
44 (1915, -0.067152495721547467)
45 (4949, -1.8884154681926013)
46 (5520, -2.1497370184179658)
47 (3748, -2.471672298659696)
48 (611, -3.0598363988393888)
Source code:
Code:
import numpy as np
# load scores, copied from http://frc-events.usfirst.org/2015/DCWA/qualifications
f = open("score")
lines = f.readlines()
data = [l.split() for l in lines]
# these are the columns red teams, blue teams, red scores, and blue scores
# end up in when I copy/paste
redcols = [6,7,8]
bluecols = [9,10,11]
redscorecol = 12
bluescorecol = 13
# get list of teams
teams = set()
for d in data:
for tcol in (redcols + bluecols):
teams.add(int(d[tcol]))
teams = list(teams)
teams.sort()
# get a mapping from team number to index for efficient lookup
teamindex = {}
for i in range(len(teams)):
teamindex[teams[i]] = i
# enter each "match", where match = [red or blue teams, score]
# (i.e. 2 "matches" per actual match played, I'm assuming that
# the two sides are independent because there is no defense
# and that cooperatition points are on average the same score
# a team would have accumulated with normal socring in the same time)
# each row of match data has an entry for each team, 1 if it
# played or 0 if it didn't
# each entry of matchscores is the score
matchdata = []
matchscores = []
for d in data:
for (tc,tcs) in [(redcols, redscorecol), (bluecols, bluescorecol)]:
md = np.zeros(len(teams))
for tcol in tc:
md[teamindex[int(d[tcol])]] = 1
matchdata.append(md)
matchscores.append(int(d[tcs]))
matchdata = np.array(matchdata)
matchscores = np.array(matchscores)
# compute the amount of the score contributed by each team on average
teamscores = np.linalg.lstsq(matchdata, matchscores)
# print results, sorted in order of contribution
tcs = [(t, teamscores[0][teamindex[t]]) for t in teams]
tcs.sort(key=lambda x: x[1], reverse=True)
for i in range(len(tcs)):
print(i+1, tcs[i])
|