This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Frame | Round | Time [s] | Body_x | Body_y | Fist_x | Fist_y | Fist_z | Knee_x | Knee_y | Knee_z | |
---|---|---|---|---|---|---|---|---|---|---|---|
11000 | 2 | 150 | ?? | ?? | ?? | ?? | ?? | ?? | ?? | ?? | |
11025 | 2 | 151 | ?? | ?? | ?? | ?? | ?? | ?? | ?? | ?? | |
11050 | 2 | 152 | ?? | ?? | ?? | ?? | ?? | ?? | ?? | ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Frame | Period | Time [s] | Home_11_x | Home_11_y | Home_1_x | Home_1_y | ball_x | ball_y | |
---|---|---|---|---|---|---|---|---|---|
1 | 1 | 0.04 | -52.913 | 1.198 | -18.393 | -10.418 | -4.799 | 7.677 | |
2 | 1 | 0.08 | -52.898 | 1.198 | -18.393 | -10.418 | -0.376 | 6.353 | |
3 | 1 | 0.12 | -52.879 | 1.198 | -18.393 | -10.418 | 3.938 | 5.061 | |
4 | 1 | 0.16 | -52.871 | 1.198 | -18.420 | -10.415 | 5.666 | 5.282 | |
5 | 1 | 0.2 | -52.863 | 1.198 | -18.447 | -10.382 | 5.842 | 6.412 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pulp import * | |
player = [str(i) for i in range(data.shape[0])] | |
point = {str(i): data['Points'][i] for i in range(data.shape[0])} | |
cost = {str(i): data['Cost'][i] for i in range(data.shape[0])} | |
gk = {str(i): 1 if data['Position'][i] == 'GK' else 0 for i in range(data.shape[0])} | |
defe = {str(i): 1 if data['Position'][i] == 'DEF' else 0 for i in range(data.shape[0])} | |
mid = {str(i): 1 if data['Position'][i] == 'MID' else 0 for i in range(data.shape[0])} | |
stri = {str(i): 1 if data['Position'][i] == 'STR' else 0 for i in range(data.shape[0])} | |
xi = {str(i): 1 for i in range(data.shape[0])} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pulp import * | |
player = [str(i) for i in range(data.shape[0])] | |
point = {str(i): data['Points'][i] for i in range(data.shape[0])} | |
cost = {str(i): data['Cost'][i] for i in range(data.shape[0])} | |
gk = {str(i): 1 if data['Position'][i] == 'GK' else 0 for i in range(data.shape[0])} | |
defe = {str(i): 1 if data['Position'][i] == 'DEF' else 0 for i in range(data.shape[0])} | |
mid = {str(i): 1 if data['Position'][i] == 'MID' else 0 for i in range(data.shape[0])} | |
stri = {str(i): 1 if data['Position'][i] == 'STR' else 0 for i in range(data.shape[0])} | |
xi = {str(i): 1 for i in range(data.shape[0])} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.optimize import linprog | |
points = data['Points'] | |
cost = data['Cost'] | |
gk = data['Position'].apply(lambda x: 1 if x == 'GK' else 0) | |
defe = data['Position'].apply(lambda x: 1 if x == 'DEF' else 0) | |
mid = data['Position'].apply(lambda x: 1 if x == 'MID' else 0) | |
stri = data['Position'].apply(lambda x: 1 if x == 'STR' else 0) | |
xi = np.ones(data.shape[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example | |
val = [60, 100, 120, 120] | |
wt = [10, 20, 30, 20] | |
W = 50 | |
n = len(val) | |
K = knapSack(W, wt, val, n) | |
ix = knapSackIndex(W, wt, val, n ,K) | |
print("Max value:{}, with items:{}".format(K[-1][-1], str(ix))) | |
# Max value:280, with items:[3, 1, 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def knapSack(W, wt, val, n): | |
K = [[0 for x in range(W+1)] for x in range(n+1)] | |
for i in range(n+1): | |
for w in range(W+1): | |
if i==0 or w==0: | |
K[i][w] = 0 | |
elif wt[i-1] <= w: | |
K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w]) | |
else: | |
K[i][w] = K[i-1][w] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def random_walk(n): | |
return np.random.rand(11) * n | |
def to_int(x): | |
# gives players at each end equal probability to be picked | |
# 0.5 - 1.5 -> 1 | |
# 0.0 - 0.5 -> 0 (half the probability) | |
return (x - 0.5).astype(int) | |
def objective(x): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def constraint_all(x): | |
test = [constraint_cost(x) >= 0, | |
constraint_unique(x) == 0, | |
constraint_gk(x) == 0, | |
constraint_def_3(x) >= 0, | |
constraint_def_5(x) >= 0, | |
constraint_mid_3(x) >= 0, | |
constraint_mid_5(x) >= 0, | |
constraint_str_1(x) >= 0, | |
constraint_str_3(x) >= 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def constraint_unique(x): | |
n1 = x.size | |
n2 = np.unique(to_int(x)).size | |
return n1 - n2 | |
# if constraint_unique(x) == 0, test passed |
NewerOlder