Commit 091f2966 authored by Vikram Waradpande's avatar Vikram Waradpande
Browse files

Add other dim results

parents a49967ee 94189629
......@@ -65,7 +65,7 @@ START = 0.5
START_STATE = 1
MAX_EPISODES = 60
EMBTOGGLE = 1
DIMENSION = 30
DIMENSION = 20
TARGET_LOC = 399
EMBEDPATH = "./Embeddings/"
RESULTPATH = "./Results/LargerMazes/"
......@@ -107,9 +107,9 @@ BATCH_SIZE = 50
#Save params
state_index = -1
rew_arr = []
rewardAxis = np.zeros((10,60))
stepsAxis = np.zeros((10,60))
partRew = [[] for i in range(10)]
rewardAxis = np.zeros((20,60))
stepsAxis = np.zeros((20,60))
partRew = [[] for i in range(20)]
globalTotSteps = 0
......@@ -614,11 +614,11 @@ 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_dir[i][j],end=' ')
# print()
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 j in range(len(env.adj_list[i])):
......@@ -666,7 +666,7 @@ def trainDQN(args):
state_index = -1
for _ in range(int(args.iterations)):
state = 18
state = 5
if state in obstacles_loc or state == TARGET_LOC:
continue
......@@ -713,7 +713,10 @@ if __name__ == "__main__":
parser.add_argument("-iter", "--iterations", help="Number of iterations")
parser.add_argument("-target", "--target", help="Location of target")
parser.add_argument("-el", "--edgelist", help="edgelist of the maze")
parser.add_argument("-dim","--dimension",help="Dimension")
args = parser.parse_args()
DIMENSION = int(args.dimension)
if (args.maze == "1"):
obstacles_loc = obstacles_loc_1
......
......@@ -35,11 +35,16 @@ obstacles_loc_2 = [20, 21, 22, 23, 24, 25, 49,
obstacles_loc_4 = [12,29,30,31,32,33,37,38,39,44,51,57,65,70,71,72,73,79]
obstacles_loc = [22, 25, 26, 27, 47, 67, 60, 82, 83, 84, 85, 107, 108, 121, 128, 141, 142, 146, 164, 165, 168, 181,
obstacles_loc_6 = [22, 25, 26, 27, 47, 67, 60, 82, 83, 84, 85, 107, 108, 121, 128, 141, 142, 146, 164, 165, 168, 181,
32, 35, 36, 37, 57, 77, 70, 92, 93, 94, 95, 117, 118, 131, 138, 151, 152, 156, 174, 175, 178, 191,
222, 225,226,227,247,267,260,282,283,285,307,308,321,328,341,342,346,365,368,381,
232,235,236,237,257,277,270,292,293,294,295,317,318,331,338,351,352,356,374,375,378,391]
obstacles_loc = [22, 25, 26, 31, 41, 70, 71, 85, 90, 131, 132, 142, 167, 170, 177,
32, 35, 36, 37, 57, 77, 70, 92, 93, 94, 95, 117, 118, 131, 138, 151, 152, 156, 174, 179, 190,
211, 230, 247,267,260,310,311,312,326,329,340,343,356,357,378,371,
212,215,226,224,248,261,271,282,286,298,301,308,311,316,351,332,366,369,384,385,318,391]
GRID = 20
row_num = GRID
col_num = GRID
......@@ -58,7 +63,7 @@ START_STATE = 1
MAX_EPISODES = 60
EMBTOGGLE = 1
DIMENSION = 30
TARGET_LOC = 399
TARGET_LOC = 390
LOAD_TRAINED_MODEL_PATH = ""
......@@ -92,8 +97,8 @@ BATCH_SIZE = 50
#Save params
state_index = -1
rew_arr = []
rewardAxis = np.zeros((20,60))
stepsAxis = np.zeros((20,60))
rewardAxis = np.zeros((10,60))
stepsAxis = np.zeros((10,60))
partRew = [[] for i in range(20)]
......@@ -466,6 +471,7 @@ def deepQLearning(model, env, state, randomMode=False, **opt):
# Apply action, get reward and new envstate
next_state, reward, game_status = env.act(action)
totRew += reward
ns = (env.generate_embedding()).reshape((1, -1))
......@@ -579,7 +585,7 @@ def create_environment(start_row, start_col):
env.adj_list.append([])
env.adj_dir.append([])
with open('maze6.edgelist') as f:
with open('maze7.edgelist') as f:
for line in f:
line = line.rstrip().split(' ')
env.adj_list[int(line[0])].append(int(line[1]))
......@@ -641,7 +647,7 @@ def trainDQN():
state_index = -1
for _ in range(20):
for _ in range(10):
state = 5
if state in obstacles_loc or state == TARGET_LOC:
......@@ -668,9 +674,9 @@ def trainDQN():
pass
partRew = np.array(partRew)
np.save('./Results/LargerMazes/maze6_30APP_1.npy',rewardAxis)
np.save('./Results/Steps/maze6_30APP_1.npy',stepsAxis)
np.save('./Results/Rews/maze6_30APP_1.npy',partRew)
np.save('./Results/LargerMazes/maze6_30APP_5.npy',rewardAxis)
np.save('./Results/Steps/maze6_30APP_5.npy',stepsAxis)
np.save('./Results/Rews/maze6_30APP_5.npy',partRew)
if __name__ == "__main__":
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment