12 from __future__
import print_function
33 print(
'TurnDataReader.readData() called with infile == None!')
50 matchlb = re.compile(
r'^([0-9]+) (\S+) (\S+)$')
53 matchalg = re.compile(
r'^(\S+)$')
58 for line
in f.readlines():
62 m = matchlb.search(line)
64 if self.
verbose:
print(
'Found data record match:', m.group(1), m.group(2), m.group(3))
69 if m.group(2) ==
'nan':
72 counts =
float(m.group(2))
74 if m.group(3) ==
'nan':
77 turns =
float(m.group(3))
81 print(
'TurnDataReader.readData() found data record with no algorithm defined in', self.
infile)
86 if lb
not in self.
data:
87 self.
data[lb] = dict()
89 self.
data[lb][algId] = (turns, counts)
92 print(
'Alg:', algId,
'LB:', lb,
'Turns:', turns,
'Counts:', counts)
95 m = matchalg.search(line)
97 if self.
verbose:
print(
'Found new algorithm:', m.group(1))
102 print(
'TurnDataReader.readData() found unrecognized algorithm name in', self.
infile)
110 if __name__ ==
'__main__':