Merge branch 'master' of gou.cool:~/swdata
This commit is contained in:
commit
02c1a67c59
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,4 +5,5 @@ wos-data*
|
||||
user*
|
||||
*.svg
|
||||
__pycache__
|
||||
.vscode
|
||||
.vscode
|
||||
.idea
|
||||
@ -1,9 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3b8f67a0-ea53-4209-a86f-9effd70f9663" name="Default" comment="">
|
||||
<change beforePath="" afterPath="$PROJECT_DIR$/draw_network.py" />
|
||||
</list>
|
||||
<list default="true" id="3b8f67a0-ea53-4209-a86f-9effd70f9663" name="Default" comment="" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -66,7 +64,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<component name="ProjectFrameBounds" extendedState="7">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="2560" />
|
||||
@ -96,11 +94,6 @@
|
||||
<item name="swdata" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="swdata" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="swdata" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="swdata" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="wos-data-compete" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
@ -174,14 +167,13 @@
|
||||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="2576" height="1416" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<frame x="-8" y="-8" width="2576" height="1416" extended-state="7" />
|
||||
<layout>
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.13831478" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.13831478" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="TODO" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3298887" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="true" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3298887" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3298887" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3298887" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Python Console" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39228934" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
|
||||
@ -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