Created
August 2, 2018 15:55
-
-
Save kangeugine/346a71f23537e6f40c24f94bc2017c6f to your computer and use it in GitHub Desktop.
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): | |
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