Created
January 8, 2013 23:11
-
-
Save jobliz/4488927 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
demand_dist = (0.30, 0.45, 0.25) # [0]high, [1]medium, [2]low | |
positions = ( 36, 48, 60, 72, 84, 96) | |
high_demand = (0.05, 0.10, 0.25, 0.30, 0.20, 0.10) | |
med_demand = (0.10, 0.20, 0.30, 0.25, 0.10, 0.05) | |
low_demand = (0.15, 0.25, 0.35, 0.15, 0.05, 0.05) | |
demand_type = position_generator(demand_dist) | |
# be careful with order! | |
demand_amount = [ | |
position_generator(high_demand), | |
position_generator(med_demand), | |
position_generator(low_demand) | |
] | |
n = 10000 | |
for supply in positions: | |
count = 0 | |
total = 0 | |
for x in xrange(n): | |
demand = positions[demand_amount[demand_type.next()].next()] | |
total += profit(supply, demand) | |
count += 1 | |
print supply, total * 1.0 / count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment