Example #1
0
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))
Example #2
0
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))
Example #3
0
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(1, "mdp")    
Example #4
0
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(1, "mdp")    
Example #5
0
def main():
    scores = []
    throw.init_board()
    num_games = 100

#************************************************#
# 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.
    # sizes = [1,5,10,15]
    # for i in sizes:
    #     print "EPOCH SIZE: ", i
    #     random.seed()
    #     throw.init_thrower()
    #     modelbased.modelbased(GAMMA, i, 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. 

    learning = [0.8, 0.85, 0.9, 0.95, 1]
    for l in learning:
        print "LEARNING RATE: ", l
        random.seed()
        throw.init_thrower()
        test(1000, "modelfree", l)
Example #6
0
    def task(self):
        throw.init_board()
	throw.use_simple_thrower()
        y1= darts.test(1, "mdp")
        
        throw.init_board()
        throw.use_simple_thrower()
        y2=darts.test(5, "mdp")    	
	
	throw.init_board()
	throw.use_simple_thrower()
        y3=darts.test(10, "mdp")    	
		    	
	listNames = ["1 game", "5 games", "10 games"]
	listData = [y1, y2, y3]
	chart = {"chart": {"defaultSeriesType": "column"},
                 "xAxis": {"categories": listNames},
                 "yAxis": {"title": {"text": "#Throws"}},
                 "title": {"text": "Average #throws to finish vs. #games"}, 
                 "series": [ {"name": "Average policy performance", 
	                      "data": listData} ] }
        return chart
Example #7
0
    def task(self):
        throw.init_board()
        throw.use_simple_thrower()
        y1 = darts.test(1, "mdp")

        throw.init_board()
        throw.use_simple_thrower()
        y2 = darts.test(5, "mdp")

        throw.init_board()
        throw.use_simple_thrower()
        y3 = darts.test(10, "mdp")

        listNames = ["1 game", "5 games", "10 games"]
        listData = [y1, y2, y3]
        chart = {
            "chart": {
                "defaultSeriesType": "column"
            },
            "xAxis": {
                "categories": listNames
            },
            "yAxis": {
                "title": {
                    "text": "#Throws"
                }
            },
            "title": {
                "text": "Average #throws to finish vs. #games"
            },
            "series": [{
                "name": "Average policy performance",
                "data": listData
            }]
        }
        print darts.GAMMA
        return chart