Skip to content

Commit

Permalink
analysis of AGV plotter
Browse files Browse the repository at this point in the history
  • Loading branch information
kdomino committed Apr 3, 2024
1 parent a10a9c6 commit cbb44e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions AGV_quantum/train_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def plot_train_diagram(sol, agv_routes, track_len):
s_ofset = 1.75 # the size of the station
marks, zone_borders = zones_location(track_len, n_zones, s_ofset)
times, spaces = AGVS_coordinates(sol, agv_routes, marks, s_ofset)
colors = {0: "black", 1: "red", 2: "green", 3: "blue", 4: "orange", 5: "brown", 6: "gray"}
colors = {0: "black", 1: "gray", 2: "silver", 3: "firebrick", 4: "red", 5: "orange", 6: "gold", 7: "navy", 8: "blue", 9: "violet", 10: "green", 11: "lime", 12: "cyan", 13: "teal", 14: "indygo"}

for agv in agv_routes:
if n_zones < 8:
plt.plot(times[agv], spaces[agv], "o-", label=f"$AGV_{agv}$ ", color=colors[agv], linewidth=0.85, markersize=2)
else:
plt.plot(times[agv], spaces[agv], "o-", label=f"$AGV_{agv}$ ", linewidth=0.85, markersize=2)
plt.legend(loc='center right', bbox_to_anchor=(1.4, 0.5), ncol = 1)
plt.legend(loc='center right', bbox_to_anchor=(1.4, 0.5), ncol = 1, fontsize = 8)

for el in zone_borders:
plt.axhline(y = el, color="gray", linewidth=0.5, linestyle=":")
Expand Down
8 changes: 7 additions & 1 deletion check_sol.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
elif hybrid == "cqm":
print(sampleset.info)
solutions = get_results(sampleset, lp)
k = 0
for sol in solutions:
if sol["feasible"]:
print(sol)
k = k+1
#print(sol['objective'])
if k == 1:
print(sol)
print("no solutions", len(solutions))
print("feasibility percentage", k/len(solutions))
1 change: 1 addition & 0 deletions run_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
model.print_solution(print_zeros=True)
#AGV.nice_print(model, sol) <- WIP
if args.train_diagram:
print(agv_routes)
plot_train_diagram(sol, agv_routes, tracks_len)

else:
Expand Down

0 comments on commit cbb44e1

Please sign in to comment.