1515
1616
1717'''Setting up strategies and relative proportions''' 
18- ''' 
18+ 1919strategies  =  [Strategies .Aselect (), Strategies .EGreedy (), Strategies .UCB (), Strategies .Satisficing (),
2020 Strategies .Softmax (), Strategies .FictitiousPlay (), Strategies .Bully (),
2121 Strategies .ProportionalRegretMatching ()]
@@ -47,13 +47,12 @@ def game_session(game_id: int, matrix_suite: MatrixSuite, strategies: List[Strat
4747
4848 grand_table .play_games ()
4949 print (grand_table )
50-  grand_table.to_latex("Game_" + str(game_id)) 
50+  #  grand_table.to_latex("Game_" + str(game_id))
5151
52-  i = 1 
53-  for proportion in proportions: 
52+  for  i , proportion  in  enumerate (proportions ):
5453 replicator_dynamic  =  ReplicatorDynamic (grand_table )
55-  replicator_dynamic.run(proportion, name="Game_" + str(game_id) + "_" + str(i)) 
56-  i+=1 
54+  replicator_dynamic .run (proportion , name = "Game_"  +  str (game_id ) +  "_"  +  str (i + 1 ))
55+ 5756
5857 print ("Gambit test result:" )
5958 Nash .nash_equilibria (strategies , grand_table )
@@ -74,37 +73,4 @@ def game_session(game_id: int, matrix_suite: MatrixSuite, strategies: List[Strat
7473
7574
7675
77- ''' 
78- ############# TEST AREA 
79- print ("BEGIN ########################################\n " )
80- 81- 82- matrix_suite  =  RandomIntMatrixSuite () # Create a matrix suite 
83- 84- row_strat  =  Strategies .Softmax () # Create the strategy you want to test. 
85- col_strat  =  Strategies .Softmax ()
86- row_strat .initialize (matrix_suite , "row" ) # Initialise it with the game suite and as either "row" or "col" player. 
87- col_strat .initialize (matrix_suite , "col" )
88- 89- for  round  in  range (0 , 500 ):
90-  row_action  =  row_strat .get_action (round ) # Get the next action 
91-  col_action  =  col_strat .get_action (round )
92-  print ("Row plays action:"  +  row_action .__repr__ ())
93-  print ("Col plays action:"  +  col_action .__repr__ ())
94- 95-  row_payoff , col_payoff  =  matrix_suite .get_payoffs (row_action , col_action )
96-  print ("Payoff: "  +  str ((row_payoff ,col_payoff )))
97- 98-  row_strat .update (round , row_action , row_payoff , col_action )
99-  col_strat .update (round , col_action , col_payoff , row_action )# Update the strategy with a fake payoff and opponent action. 
100- # Now you might want to look at the class attributes of the strategy, 
101- # which you can call the same as functions, just without any parentheses. 
102- print ("UCB actions:" )
103- print (row_strat .actions , " ROW" )
104- print (col_strat .actions , " COL" )
105- print ()
106- 107- 108- print ("END ########################################\n " )
109- ######################## 
11076
0 commit comments