-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_result.py
More file actions
171 lines (159 loc) · 5.22 KB
/
plot_result.py
File metadata and controls
171 lines (159 loc) · 5.22 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import numpy as np
import matplotlib.pyplot as plt
SGD_Folder = 'nice_start/SGD_1e-5_2e-4/'
CMD_folder = 'nice_start/CMD_2e-3/'
NGD_folder = 'nice_start/NGD_1e-5_2e-3/'
SGD_Folder = 'SGD_1e-5_1e-3/'
CMD_folder = 'CMD_1e-3, 1e-3/'#'CMD_2e-4_2e-3/'
NGD_folder = 'NGD_1e-5_1e-3_outer/'
K_list = np.load(CMD_folder+'K_list.npy')
L_list = np.load(CMD_folder+'L_list.npy')
# constraint_list = np.load(CMD_folder+'constraint_list.npy')
K_SGD_list = np.load(SGD_Folder+'K_SGD_list.npy')
L_SGD_list = np.load(SGD_Folder+'L_SGD_list.npy')
# constraint_SGD_list = np.load(SGD_Folder+'constraint_SGD_list.npy')
K_NGD_list = np.load(NGD_folder+'K_NGD_list.npy')
L_NGD_list = np.load(NGD_folder+'L_NGD_list.npy')
# constraint_NGD_list = np.load(NGD_folder+'constraint_NGD_list.npy')
cutoff = 7000
p1 = plt.figure(1)
plt.subplot(121)
plt.plot(K_SGD_list[0,1:cutoff],label = 'PGDA: 1e-5, 1e-3')
plt.plot(K_list[0,1:cutoff],label = 'Proposed Method: 1e-3, 1e-3')
plt.plot(K_NGD_list[0,1:cutoff],alpha = 0.8,linestyle = 'dashed',label = 'PNGD: 1e-5, 1e-3')
# plt.plot(-0.4913*np.ones((20000,)),label = 'Nash Equilibrium')
plt.title('K(1)')
plt.xlabel('Iteration')
plt.legend(fontsize = 12)
p1.tight_layout()
plt.subplot(122)
plt.plot(K_SGD_list[1,1:cutoff],label = 'PGDA: 1e-5, 1e-3')
plt.plot(K_list[1,1:cutoff],label = 'Proposed Method: 1e-3, 1e-3')
plt.plot(K_NGD_list[1,1:cutoff],alpha = 0.8,linestyle = 'dashed',label = 'PNGD: 1e-5, 1e-3')
# plt.plot(-1.3599*np.ones((20000,)),label = 'Nash Equilibrium')
plt.title('K(2)')
plt.legend(fontsize = 12)
plt.xlabel('Iteration')
p1.tight_layout()
# p2 = plt.figure(2)
# plt.subplot(121)
# plt.plot(L_list[0,:], label = 'Proposed Method')
# plt.plot(L_SGD_list[0,:],label = 'SGD')
# plt.plot(L_NGD_list[0,:],alpha = 0.6,linestyle = 'dashed',label = 'NGD')
# # plt.plot(0.0757*np.ones((20000,)),label = 'Nash Equilibrium')
# plt.title('L(1)')
# plt.legend()
plt.show()
#
plt.subplot(122)
# plt.plot(L_list[1,:],label = 'Proposed Method')
# plt.plot(L_NGD_list[1,:],label = 'NGD')
# plt.plot(L_SGD_list[1,:],alpha = 0.6,linestyle = 'dashed', label = 'SGD')
# # plt.plot(0.1314*np.ones((20000,)),label = 'Nash Equilibrium')
# plt.title('L(2)')
# plt.legend()
# plt.suptitle('Adversary Policy: L')
#
#
# # p5 = plt.figure(5)
# # plt.plot(constraint_list,label = 'Proposed Method')
# # plt.plot(constraint_SGD_list[:,1],label = 'SGD')
# # plt.plot(constraint_NGD_list[:,1],alpha = 0.6,linestyle = 'dashed',label = 'NGD')
# # plt.plot(0.5401*np.ones((20000,)),label = 'Nash Equilibrium')
# # plt.legend()
#
# plt.show()
#
#
#
# l = 29000
# line_labels = ["Proposed Method", "True Nash Equilibrium"]
# fig1, (ax1, ax2) = plt.subplots(1, 2, figsize=(10,4))
# # fig1.suptitle('Protagonist Policy: K')
#
# ax1.title.set_text('K(1)')
# ax1.set_xlabel('Iterations')
# l1 = ax1.plot(K_list[0,10:], color="green",alpha = 0.6)[0]
# l2 = ax1.plot(-0.4913*np.ones((l,)), color="blue",alpha = 1)[0]
#
# ax2.title.set_text('K(2)')
# ax2.set_xlabel('Iterations')
# l1 = ax2.plot(K_list[0,10:], color="green",alpha = 0.6)[0]
# l2 = ax2.plot(-1.3599*np.ones((l,)), color="blue",alpha = 1)[0]
#
# fig1.legend([l1, l2], # The line objects
# labels=line_labels, # The labels for each line
# loc="center right", # Position of legend
# borderaxespad=0.1, # Small spacing around legend box
# # title="Legend Title" # Title for the legend
# )
# plt.subplots_adjust(right=0.8)
#
# plt.show()
#
#
# l = 29000
# line_labels = ["Proposed Method", "True Nash Equilibrium"]
# fig1, (ax1, ax2) = plt.subplots(1, 2, figsize=(10,4))
# # fig1.suptitle('Adversary Policy: L')
#
# ax1.title.set_text('L(1)')
# ax1.set_xlabel('Iterations')
# l1 = ax1.plot(L_list[0,10:], color="green",alpha = 0.6)[0]
# l2 = ax1.plot(0.0757*np.ones((l,)), color="blue",alpha = 1)[0]
#
# ax2.title.set_text('L(2)')
# ax2.set_xlabel('Iterations')
# l1 = ax2.plot(L_list[1,10:], color="green",alpha = 0.6)[0]
# l2 = ax2.plot(0.1314*np.ones((l,)), color="blue",alpha = 1)[0]
#
# fig1.legend([l1, l2], # The line objects
# labels=line_labels, # The labels for each line
# loc="center right", # Position of legend
# borderaxespad=0.1, # Small spacing around legend box
# # title="Legend Title" # Title for the legend
# )
# plt.subplots_adjust(right=0.8)
#
# plt.show()
#
#
# p1 = plt.figure(1)
# plt.subplot(121)
# plt.plot(K_list[0,10:],label = 'Proposed Method')
# plt.plot(-0.4913*np.ones((l,)),label = 'Nash Equilibrium')
# plt.title('K(1)')
# plt.legend()
#
# plt.subplot(122)
# plt.plot(K_list[1,:],label = 'Proposed Method')
# plt.plot(-1.3599*np.ones((l,)),label = 'Nash Equilibrium')
# plt.title('K(2)')
# plt.legend()
# plt.suptitle('Protagonist Policy: K')
#
# p2 = plt.figure(2)
# plt.subplot(121)
# plt.plot(L_list[0,:], label = 'Proposed Method')
# plt.plot(0.0757*np.ones((l,)),label = 'Nash Equilibrium')
# plt.title('L(1)')
# plt.legend()
#
# plt.subplot(122)
# plt.plot(L_list[1,:],label = 'Proposed Method')
# plt.plot(0.1314*np.ones((l,)),label = 'Nash Equilibrium')
# plt.title('L(2)')
# plt.legend()
# plt.suptitle('Adversary Policy: L')
#
#
# p5 = plt.figure(5)
# # plt.plot(constraint_list,label = 'Proposed Method')
# plt.plot(0.5401*np.ones((l,)),label = 'Nash Equilibrium')
# plt.legend()
#
# plt.show()
#
#
#
#