-
Notifications
You must be signed in to change notification settings - Fork 0
/
RH_PS.py
52 lines (42 loc) · 969 Bytes
/
RH_PS.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
45
46
47
48
49
50
51
52
import numpy as np
import matplotlib.pyplot as plt
import settings
import players
import update_decide
import PGG
import Measure
import time
[adj_mat, player_arr]=settings.initialize(1000)
<<<<<<< HEAD
n=5000
=======
n=20000
>>>>>>> 7bb108783e2256362ad1ff8e19552e8007ca021e
#Arrays for plots
coop_frac_arr=[]
sat_arr=[]
avgdeg_arr=[]
ttime=[]
tti=time.time()
for i in range(n):
PGG.pgg(adj_mat, player_arr)
update_decide.update_and_decide(adj_mat, player_arr)
[coop,sat,avgdeg]=(Measure.measure(adj_mat, player_arr))
coop_frac_arr.append(coop)
sat_arr.append(sat)
avgdeg_arr.append(avgdeg)
ttime.append(i)
<<<<<<< HEAD
#if i%2490==0:
print('round :',i)
=======
if i%2490==0:
print('round :',i)
>>>>>>> 7bb108783e2256362ad1ff8e19552e8007ca021e
print(time.time()-tti)
plt.plot(ttime, coop_frac_arr)
plt.show()
plt.plot(ttime, sat_arr)
plt.show()
plt.plot(ttime, avgdeg_arr)
plt.show()