Skip to content

Instantly share code, notes, and snippets.

@kangeugine
Created August 2, 2018 15:55
Show Gist options
  • Save kangeugine/346a71f23537e6f40c24f94bc2017c6f to your computer and use it in GitHub Desktop.
Save kangeugine/346a71f23537e6f40c24f94bc2017c6f to your computer and use it in GitHub Desktop.
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):
x_int = to_int(x)
points11 = POINTS[x_int]
return -(points11.sum() + points11.max())
np.random.seed(0)
TRIALS = 10000
lineup = []
total_points = []
constraint_test = []
for i in range(TRIALS):
x = random_walk(N)
lineup.append(x)
total_points.append(-objective(x))
constraint_test.append(constraint_all(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment