-
Notifications
You must be signed in to change notification settings - Fork 0
/
RunMCCFR.py
44 lines (32 loc) · 969 Bytes
/
RunMCCFR.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pandas as pd
import time
import sys
#See
#https://github.com/deepmind/open_spiel/blob/master/open_spiel/python/algorithms/mccfr.py
#For documentation and implementation details
low_quality = 100
med_quality = 1000
high_quality = 10000
higher_quality = 100000
import EFR
from open_spiel.python.algorithms.external_sampling_mccfr import ExternalSamplingSolver
import StoreTabularPolicy
import pyspiel
FL_game = 'leduc_poker'
FL_iterations = med_quality
FL_players = 2
FL_Runname = "med3"
try:
FL_Runname = sys.argv[1]
except:
pass
try:
FL_iterations = int(sys.argv[2])
except:
pass
game = pyspiel.load_game(FL_game, {"players": FL_players})
mccfr_solution = ExternalSamplingSolver(game)
for i in range(FL_iterations):
mccfr_solution.iteration()
print("Iteration" + str(i))
StoreTabularPolicy.save_tabular_policy("Policy/MCCFR_"+FL_Runname+".csv", mccfr_solution.average_policy().to_tabular())