sync
This commit is contained in:
parent
570c4d0c01
commit
8dfe5335a8
@ -38,7 +38,7 @@ rects2 = ax.bar(index + bar_width, bt_c, bar_width,
|
||||
label='Classic')
|
||||
|
||||
|
||||
ax.set_ylabel('Frequency of Breaking Ties')
|
||||
ax.set_ylabel('Probability of Breaking Ties(%)')
|
||||
# ax.set_title('Behavior after Moves')
|
||||
ax.set_xticks(index + bar_width / 2)
|
||||
ax.set_xticklabels(('C', 'D'))
|
||||
|
||||
40
cluster_stat.py
Normal file
40
cluster_stat.py
Normal file
@ -0,0 +1,40 @@
|
||||
"""
|
||||
统计所有的连通子图规模
|
||||
"""
|
||||
import csv
|
||||
import numpy as np
|
||||
from collections import Counter
|
||||
from island.matches import Matches
|
||||
from island.match import Match
|
||||
|
||||
class ClusterStat:
|
||||
def __init__(self):
|
||||
self.detail = {}
|
||||
# self.matches = Matches.from_profile_expr(lambda r: True)
|
||||
self.matches = Matches.from_profile('SURVIVE')
|
||||
|
||||
|
||||
def stat(self):
|
||||
for m in self.matches.data:
|
||||
cluster = {}
|
||||
no = 0
|
||||
for r in m.query('player','join').raw_data:
|
||||
cluster[r['pid']] = no
|
||||
no += 1
|
||||
for r in m.query('action', 'done').raw_data:
|
||||
if cluster[r['a']] != cluster[r['b']]:
|
||||
if cluster[r['a']] < cluster[r['b']]:
|
||||
cmax, cmin = cluster[r['b']], cluster[r['a']]
|
||||
else:
|
||||
cmax, cmin = cluster[r['a']], cluster[r['b']]
|
||||
lmax = [k for (k,v) in cluster.items() if v == cmax]
|
||||
for k in lmax:
|
||||
cluster[k] = cmin
|
||||
res = [v for v in Counter(cluster.values()).values()]
|
||||
print(m.name, list(sorted(res, reverse=True)))
|
||||
self.detail[m.name] = res
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
c = ClusterStat()
|
||||
c.stat()
|
||||
@ -16,7 +16,7 @@ def p1(x, coopr, e, postfix, show=True):
|
||||
ax.set_ylim(0, 1)
|
||||
ax.set_yticks(sp.linspace(0, 1, 5))
|
||||
ax2 = ax.twinx()
|
||||
ax2.plot(x[:-1], e[:-1], color=red, linewidth=2, label=r"$E_{i,D}$")
|
||||
ax2.plot(x[:-1], e[:-1], color=red, linewidth=2, label=r"$\theta$")
|
||||
ax2.set_ylim(-1500, 200)
|
||||
ax2.set_yticks(sp.linspace(-1500, 200, 5))
|
||||
ax2.tick_params(labelsize=14)
|
||||
@ -25,7 +25,7 @@ def p1(x, coopr, e, postfix, show=True):
|
||||
ax.set_xlabel("Rounds", size=22)
|
||||
ax.set_ylabel(r"$f_c$", family='sans-serif', color=blue, size=22)
|
||||
ax.tick_params(axis='y', labelcolor=blue)
|
||||
ax2.set_ylabel(r"$TtD$", family='sans-serif', color=red, size=22)
|
||||
ax2.set_ylabel(r"$\theta$", family='sans-serif', color=red, size=22)
|
||||
ax2.tick_params(axis='y', labelcolor=red)
|
||||
|
||||
plt.tight_layout()
|
||||
@ -49,7 +49,7 @@ def p2(e, coopr, postfix, show=True, showline=True):
|
||||
plt.plot(fx,f1(fx),linewidth=2,color=red, ls='--', zorder=0)
|
||||
|
||||
plt.scatter(e, coopr, color='white', edgecolors=blue, linewidths=2, zorder=101)
|
||||
ax.set_xlabel(r'$TtD$', family='sans-serif', size=20)
|
||||
ax.set_xlabel(r'$\theta$', family='sans-serif', size=20)
|
||||
ax.set_ylabel(r'$f_{c}$', family='sans-serif', size=20)
|
||||
# ax.set_xlim(0, 1440)
|
||||
# ax.set_xticks(sp.linspace(int(min(e)*0.9), int(max(e)*1.1), 4))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user