def main(): throw.init_board() num_games = 1000 #************************************************# # Uncomment the lines below to run the mdp code, # # using the simple dart thrower that matches # # the thrower specified in question 2. # #************************************************* # Default is to solve MDP and play 1 game throw.use_simple_thrower() test(100, "mdp") #*************************************************# # Uncomment the lines below to run the modelbased # # code using the complex dart thrower. # #*************************************************# # Seed the random number generator -- the default is # the current system time. Enter a specific number # into seed() to keep the dart thrower constant across # multiple calls to main(). # Then, initialize the throwing model and run # the modelbased algorithm. random.seed(181) throw.init_thrower() f = open("q4a_data_strat1.csv", "w") f.write("EPOCH_SIZE, AVG_TURNS\n") avg_turns = modelbased.modelbased(GAMMA, 5, 100) f.write("{0}, {1}\n".format(1, avg_turns))
def main(): throw.init_board() num_games = 19 #************************************************# # Uncomment the lines below to run the mdp code, # # using the simple dart thrower that matches # # the thrower specified in question 2. # #************************************************* # Default is to solve MDP and play 1 game #throw.use_simple_thrower() #test(1, "mdp") #*************************************************# # Uncomment the lines below to run the modelbased # # code using the complex dart thrower. # #*************************************************# # Seed the random number generator -- the default is # the current system time. Enter a specific number # into seed() to keep the dart thrower constant across # multiple calls to main(). # Then, initialize the throwing model and run # the modelbased algorithm. random.seed() throw.init_thrower() for epoch in range (20): print "Epoch size: " + str(200 - epoch * 10) modelbased.modelbased(GAMMA, 200 - 10 * epoch, num_games) #*************************************************# # Uncomment the lines below to run the modelfree # # code using the complex dart thrower. # #*************************************************# # Plays 1 game using a default player. No modelfree # code is provided. random.seed() throw.init_thrower() test(1, "modelfree")
def task(self): throw.NUM_WEDGES = 8 throw.wedges = [ 4, 6, 2, 7, 1, 8, 3, 5 ] throw.START_SCORE = 100 throw.init_board() random.seed() throw.init_thrower() num_games=10 epochs = [25,35,50]; listNames = map(lambda x: "Epoch "+`x`, epochs); y= map(lambda x: modelbased.modelbased(darts.GAMMA, x, num_games,2), epochs); listData = y chart = {"chart": {"defaultSeriesType": "line"}, "xAxis": {"categories": listNames}, "yAxis": {"title": {"text": "#Throws"}}, "title": {"text": "Average #throws to finish vs. #games"}, "series": [ {"name": "Average policy performance", "data": listData} ] } return chart
def main(): throw.init_board() num_games = 10 #************************************************# # Uncomment the lines below to run the mdp code, # # using the simple dart thrower that matches # # the thrower specified in question 2. # #************************************************* #Default is to solve MDP and play 1 game #throw.use_simple_thrower() #test(1, "mdp") #*************************************************# # Uncomment the lines below to run the modelbased # # code using the complex dart thrower. # #*************************************************# # Seed the random number generator -- the default is # the current system time. Enter a specific number # into seed() to keep the dart thrower constant across # multiple calls to main(). # Then, initialize the throwing model and run # the modelbased algorithm. random.seed() performance = [] epochs = range(10,21) throw.init_thrower() for i in range(len(epochs)): epoch = epochs[i] throw.init_thrower() performance.append(modelbased.modelbased(GAMMA, EPOCH_SIZE, 10)) print performance f = open("dumpfile2","w") pickle.dump([epochs,performance],f) f.close()
def task(self): throw.NUM_WEDGES = 8 throw.wedges = [4, 6, 2, 7, 1, 8, 3, 5] throw.START_SCORE = 100 throw.init_board() random.seed() throw.init_thrower() num_games = 10 epochs = [50] #25,35,50]; listNames = map(lambda x: "Epoch " + ` x `, epochs) y = map(lambda x: modelbased.modelbased(darts.GAMMA, x, num_games, 1), epochs) listData = y chart = { "chart": { "defaultSeriesType": "line" }, "xAxis": { "categories": listNames }, "yAxis": { "title": { "text": "#Throws" } }, "title": { "text": "Average #throws to finish vs. #games" }, "series": [{ "name": "Average policy performance", "data": listData }] } return chart
>>>>>>> 82275be991312c1b70027465c28ec5e1eaa887c8 #*************************************************# # Uncomment the lines below to run the modelbased # # code using the complex dart thrower. # #*************************************************# # Seed the random number generator -- the default is # the current system time. Enter a specific number # into seed() to keep the dart thrower constant across # multiple calls to main(). # Then, initialize the throwing model and run # the modelbased algorithm. random.seed() throw.init_thrower() modelbased.modelbased(GAMMA, EPOCH_SIZE, num_games) #x = [10,20,30,40,50,60,70,80,90] #for i in x: # EPOCH_SIZE = i # modelbased.modelbased(GAMMA, EPOCH_SIZE, num_games) #*************************************************# # Uncomment the lines below to run the modelfree # # code using the complex dart thrower. # #*************************************************# # Plays 1 game using a default player. No modelfree # code is provided. #random.seed() #throw.init_thrower() #x = [10,20,30,40,50,60,70,80,90,100]