-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.py
43 lines (37 loc) · 1.31 KB
/
util.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
def print_psne(psne_lst):
"""
This function will pretty print the list of PSNE.
:param psne_lst: A list of PSNE.
:return: /
"""
print('There are a total of ' + repr(len(psne_lst)) + ' pure strategy Nash equilibria')
for psne in psne_lst:
print(repr(psne))
def print_ne(ne, joint_strategy):
"""
This function will pretty print a Nash equilibrium
:param ne: A boolean if the joint strategy is actually a Nash equilibrium.
:param joint_strategy: The final joint strategy that was generated by the algorithm.
:return: /
"""
if ne:
print('The Nash equilibrium that was found is the joint strategy ' + repr(joint_strategy))
else:
print(f'No Nash equilibrium was found.')
def print_all_ne(ne_lst):
"""
This function will pretty print the list of Nash equilibria.
:param ne_lst: A list of Nash equilibria.
:return: /
"""
print('There are a total of ' + repr(len(ne_lst)) + ' Nash equilibria')
for ne in ne_lst:
print(repr(ne))
def print_start(algorithm):
"""
This function will pretty print the introduction to an algorithm.
:param algorithm: The name of the algorithm.
:return: /
"""
print(f'Executing the {algorithm} algorithm')
print(f'-----------------------------------------------------')