Commit 0a4843a6 authored by Vikram Waradpande's avatar Vikram Waradpande
Browse files

Fix embeddings for maze7 and code for DQS

parent 091f2966
......@@ -68,10 +68,10 @@ EMBTOGGLE = 1
DIMENSION = 20
TARGET_LOC = 399
EMBEDPATH = "./Embeddings/"
RESULTPATH = "./Results/LargerMazes/"
RESULTPATH = "./Results/LM2/"
VALSPATH = "./Results/Vals/"
STPSPATH = "./Results/Steps/"
REWPATH = "./Results/Rews/"
STPSPATH = "./Results/STP2/"
REWPATH = "./Results/RW2/"
GRID = 20
row_num = GRID
......@@ -405,7 +405,7 @@ class Environment:
def deepQLearning(model, env, state, args, randomMode=False, **opt):
global state_index, rewardAxis, state_index,globalTotSteps
episodes = opt.get('n_epoch', MAX_EPISODES)
print(obstacles_loc)
#print(obstacles_loc)
print(args)
batch_size = opt.get('batch_size', BATCH_SIZE)
......@@ -436,7 +436,7 @@ def deepQLearning(model, env, state, args, randomMode=False, **opt):
#while end state is not reached or cumulative reward doesn't reach minimum
while not game_over:
#print(env.current_state)
#print(env.cs,end=' ')
valid_actions = env.valid_actions()
if not valid_actions:
game_over = True
......@@ -590,15 +590,15 @@ def create_environment(start_row, start_col, args):
# if(state+GRID<=GRID*GRID):
# env.adj_list[state].append(state+GRID)
print(env.adj_list[0])
#print(env.adj_list[0])
with open(args.edgelist) as f:
for line in f:
line = line.rstrip().split(' ')
if(int(line[1]) not in env.adj_list[int(line[0])]):
env.adj_list[int(line[0])].append(int(line[1]))
if(int(line[1]) not in env.adj_list[int(line[0])]):
env.adj_list[int(line[1])].append(int(line[0]))
# if(int(line[0]) not in env.adj_list[int(line[1])]):
# env.adj_list[int(line[1])].append(int(line[0]))
#print(env.adj_list[0])
......@@ -614,16 +614,16 @@ def create_environment(start_row, start_col, args):
else:
env.adj_dir[state].append(3)
for i in range(400):
print(i,end=' ')
for j in range(len(env.adj_list[i])):
print(env.adj_list[i][j],end=' ')
print()
# for i in range(200,400):
# for i in range(400):
# print(i,end=' ')
# for j in range(len(env.adj_list[i])):
# print(i,end=' ')
# print(env.adj_list[i][j])
# print(env.adj_dir[i][j],end=' ')
# print()
for i in range(200,400):
for j in range(len(env.adj_list[i])):
print(i,end=' ')
print(env.adj_list[i][j])
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,7 +11,7 @@ def transformData(arr):
a = []
print(len(arr))
for i in range(len(arr)):
for j in range(15):
for j in range(60):
a.append([i, j, arr[i][j]])
return a
......@@ -23,10 +23,10 @@ def transformData2(arr):
a.append([i,j])
return a
rews1 = np.load('./Results/Rews/maze8_30glae_1.npy')
rews2 = np.load('./Results/Rews/maze8_30DW_1.npy')
rews3 = np.load('./Results/Rews/maze8_30GS_1.npy')
rews4 = np.load('./Results/Rews/maze7_30APP_1.npy')
# rews1 = np.load('./Results/Rews/maze8_30glae_1.npy')
# rews2 = np.load('./Results/Rews/maze8_30DW_1.npy')
# rews3 = np.load('./Results/Rews/maze8_30GS_1.npy')
# rews4 = np.load('./Results/Rews/maze7_30APP_1.npy')
# print(rews[7])
# plt.plot(rews1[2],color='green')
......@@ -49,19 +49,20 @@ rews4 = np.load('./Results/Rews/maze7_30APP_1.npy')
#ax = sns.lineplot(x='run',y='reward', color='blue', data=r10,ci=80)
m10 = np.load('./Results/60/maze6_emb_30DW_1.npy')
m101 = np.load('./Results/60/maze6_emb_30DW_2.npy')
#m102 = np.load('./Results/60/maze22_emb_30DW_3.npy')
# m10 = np.load('./Results/LargerMazes/maze6_30DW_1.npy')
# m101 = np.load('./Results/LargerMazes/maze6_emb_30DW_2.npy')
# m102 = np.load('./Results/60/maze22_emb_30DW_3.npy')
m10 = np.concatenate((m10, m101))
m20 = np.load('./Results/60/maze6_emb_30glae_1.npy')
m30 = np.load('./Results/LargerMazes/maze6_emb_30glae_2.npy')
#m10 = np.concatenate((m10, m101))
m20 = np.load('./Results/LargerMazes/maze6_20DW_1.npy')
m30 = np.load('./Results/LargerMazes/maze6_30DW_1.npy')
# m31 = np.load('./Results/60/maze6_emb_30APP_2.npy')
# m30 = np.concatenate((m30,m31))
#m40 = np.load('./Results/LargerMazes/maze7_30APP_1.npy')
#m50 = np.load('./Results/60/maze6_30APP_1.npy')
m40 = np.load('./Results/LargerMazes/maze6_40DW_1.npy')
m50 = np.load('./Results/LargerMazes/maze6_50DW_1.npy')
# m60 = np.load('./Results/LargerMazes/maze2_mat_1.npy')
print(m20)
# for i in range(10):
......@@ -89,21 +90,21 @@ m30 = np.load('./Results/LargerMazes/maze6_emb_30glae_2.npy')
#m50 = np.cumsum(m50, axis=1)
#m60 = np.cumsum(m60, axis=1)
df10 = pd.DataFrame(transformData(m10), columns=['run', 'episode', 'reward'])
#df10 = pd.DataFrame(transformData(m10), columns=['run', 'episode', 'reward'])
df20 = pd.DataFrame(transformData(m20), columns=['run', 'episode', 'reward'])
df30 = pd.DataFrame(transformData(m30), columns=['run', 'episode', 'reward'])
df40 = pd.DataFrame(transformData(m40), columns=['run', 'episode', 'reward'])
#df50 = pd.DataFrame(transformData(m50), columns=['run', 'episode', 'reward'])
df50 = pd.DataFrame(transformData(m50), columns=['run', 'episode', 'reward'])
# df60 = pd.DataFrame(transformData(m60), columns=['run', 'episode', 'reward'])
ax = sns.lineplot(x='episode',y='reward', color='blue', data=df10,ci=80)
#ax = sns.lineplot(x='episode',y='reward', color='blue', data=df10,ci=80)
ax = sns.lineplot(x='episode', y='reward',color='red', data=df20, ci=80)
ax = sns.lineplot(x='episode', y='reward', color='green', data=df30, ci=80)
ax = sns.lineplot(x='episode', y='reward', color='purple', data=df40, ci=80)
#ax = sns.lineplot(x='episode',y='reward', color='orange',data=df50,ci=80)
ax = sns.lineplot(x='episode',y='reward', color='orange',data=df50,ci=80)
# ax = sns.lineplot(x='episode',y='reward', color='brown',data=df60,ci=80)
#plt.ylim(-200,10)
plt.legend(['DW', 'GLAE','APP', 'GS'], loc='lower right', fontsize='x-small')
plt.legend(['DW20', 'DW30','DW40', 'DW50'], loc='lower right', fontsize='x-small')
plt.title('Maze 6')
plt.xlabel('Time Steps')
plt.ylabel('Reward')
......
......@@ -57,16 +57,11 @@
19 18
19 39
20 21
20 0
20 40
21 20
21 22
21 1
21 41
22 21
22 23
22 2
22 42
23 22
23 24
23 3
......@@ -75,18 +70,6 @@
24 25
24 4
24 44
25 24
25 26
25 5
25 45
26 25
26 27
26 6
26 46
27 26
27 28
27 7
27 47
28 27
28 29
28 8
......@@ -103,10 +86,6 @@
31 32
31 11
31 51
32 31
32 33
32 12
32 52
33 32
33 34
33 13
......@@ -115,18 +94,6 @@
34 35
34 14
34 54
35 34
35 36
35 15
35 55
36 35
36 37
36 16
36 56
37 36
37 38
37 17
37 57
38 37
38 39
38 18
......@@ -161,10 +128,6 @@
46 47
46 26
46 66
47 46
47 48
47 27
47 67
48 47
48 49
48 28
......@@ -201,10 +164,6 @@
56 57
56 36
56 76
57 56
57 58
57 37
57 77
58 57
58 59
58 38
......@@ -212,9 +171,6 @@
59 58
59 39
59 79
60 61
60 40
60 80
61 60
61 62
61 41
......@@ -239,10 +195,6 @@
66 67
66 46
66 86
67 66
67 68
67 47
67 87
68 67
68 69
68 48
......@@ -251,10 +203,6 @@
69 70
69 49
69 89
70 69
70 71
70 50
70 90
71 70
71 72
71 51
......@@ -279,10 +227,6 @@
76 77
76 56
76 96
77 76
77 78
77 57
77 97
78 77
78 79
78 58
......@@ -297,22 +241,6 @@
81 82
81 61
81 101
82 81
82 83
82 62
82 102
83 82
83 84
83 63
83 103
84 83
84 85
84 64
84 104
85 84
85 86
85 65
85 105
86 85
86 87
86 66
......@@ -337,22 +265,6 @@
91 92
91 71
91 111
92 91
92 93
92 72
92 112
93 92
93 94
93 73
93 113
94 93
94 95
94 74
94 114
95 94
95 96
95 75
95 115
96 95
96 97
96 76
......@@ -395,14 +307,6 @@
106 107
106 86
106 126
107 106
107 108
107 87
107 127
108 107
108 109
108 88
108 128
109 108
109 110
109 89
......@@ -435,24 +339,12 @@
116 117
116 96
116 136
117 116
117 118
117 97
117 137
118 117
118 119
118 98
118 138
119 118
119 99
119 139
120 121
120 100
120 140
121 120
121 122
121 101
121 141
122 121
122 123
122 102
......@@ -477,10 +369,6 @@
127 128
127 107
127 147
128 127
128 129
128 108
128 148
129 128
129 130
129 109
......@@ -489,10 +377,6 @@
130 131
130 110
130 150
131 130
131 132
131 111
131 151
132 131
132 133
132 112
......@@ -517,24 +401,12 @@
137 138
137 117
137 157
138 137
138 139
138 118
138 158
139 138
139 119
139 159
140 141
140 120
140 160
141 140
141 142
141 121
141 161
142 141
142 143
142 122
142 162
143 142
143 144
143 123
......@@ -547,10 +419,6 @@
145 146
145 125
145 165
146 145
146 147
146 126
146 166
147 146
147 148
147 127
......@@ -567,14 +435,6 @@
150 151
150 130
150 170
151 150
151 152
151 131
151 171
152 151
152 153
152 132
152 172
153 152
153 154
153 133
......@@ -587,10 +447,6 @@
155 156
155 135
155 175
156 155
156 157
156 136
156 176
157 156
157 158
157 137
......@@ -617,14 +473,6 @@
163 164
163 143
163 183
164 163
164 165
164 144
164 184
165 164
165 166
165 145
165 185
166 165
166 167
166 146
......@@ -633,10 +481,6 @@
167 168
167 147
167 187
168 167
168 169
168 148
168 188
169 168
169 170
169 149
......@@ -657,14 +501,6 @@
173 174
173 153
173 193
174 173
174 175
174 154
174 194
175 174
175 176
175 155
175 195
176 175
176 177
176 156
......@@ -673,20 +509,12 @@
177 178
177 157
177 197
178 177
178 179
178 158
178 198
179 178
179 159
179 199
180 181
180 160
180 200
181 180
181 182
181 161
181 201
182 181
182 183
182 162
......@@ -723,10 +551,6 @@
190 191
190 170
190 210
191 190
191 192
191 171
191 211
192 191
192 193
192 172
......@@ -843,10 +667,6 @@
221 222
221 201
221 241
222 221
222 223
222 202
222 242
223 222
223 224
223 203
......@@ -855,18 +675,6 @@
224 225
224 204
224 244
225 224
225 226
225 205
225 245
226 225
226 227
226 206
226 246
227 226
227 228
227 207
227 247
228 227
228 229
228 208
......@@ -883,10 +691,6 @@
231 232
231 211
231 251
232 231
232 233
232 212
232 252
233 232
233 234
233 213
......@@ -895,18 +699,6 @@
234 235
234 214
234 254
235 234
235 236
235 215
235 255
236 235
236 237
236 216
236 256
237 236
237 238
237 217
237 257
238 237
238 239
238 218
......@@ -941,10 +733,6 @@
246 247
246 226
246 266
247 246
247 248
247 227
247 267
248 247
248 249
248 228
......@@ -981,10 +769,6 @@
256 257
256 236
256 276
257 256
257 258
257 237
257 277
258 257
258 259
258 238
......@@ -992,9 +776,6 @@
259 258
259 239
259 279
260 261
260 240
260 280
261 260
261 262
261 241
......@@ -1019,10 +800,6 @@
266 267
266 246
266 286
267 266
267 268
267 247
267 287
268 267
268 269
268 248
......@@ -1031,10 +808,6 @@
269 270
269 249
269 289
270 269
270 271
270 250
270 290
271 270
271 272
271 251
......@@ -1059,10 +832,6 @@
276 277
276 256
276 296
277 276
277 278
277 257
277 297
278 277
278 279
278 258
......@@ -1077,22 +846,10 @@
281 282
281 261
281 301
282 281
282 283
282 262
282 302
283 282
283 284
283 263
283 303
284 283
284 285
284 264
284 304
285 284
285 286
285 265
285 305
286 285
286 287
286 266
......@@ -1117,22 +874,6 @@
291 292
291 271
291 311
292 291
292 293
292 272
292 312
293 292
293 294
293 273
293 313
294 293