Skip to content

Commit

Permalink
clear modules
Browse files Browse the repository at this point in the history
  • Loading branch information
kdomino committed Oct 3, 2023
1 parent de7efb3 commit aa1b7bd
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 122 deletions.
27 changes: 13 additions & 14 deletions examples/example_large.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# 12 AGVs 7 zones d_max = 40


from src import utils
from src.linear_solver import print_ILP_size, LinearAGV
from src.quadratic_solver import QuadraticAGV
from src.qubo_solver import annealing, constrained_solver, hybrid_anneal
import pickle
import time
import os

from src.LinearProg import LinearProg
from src.process_results import print_results
from src import create_stations_list, create_agv_list, create_graph, create_same_way_dict, agv_routes_as_edges
from src import print_ILP_size, LinearAGV
from src import QuadraticAGV
from src import annealing, constrained_solver, hybrid_anneal




cwd = os.getcwd()

Expand Down Expand Up @@ -47,15 +46,15 @@
#14: ("s5", "s6")
}

stations = utils.create_stations_list(tracks)
J = utils.create_agv_list(agv_routes)
agv_routes_as_edges = utils.agv_routes_as_edges(agv_routes)
all_same_way = utils.create_same_way_dict(agv_routes)
stations = create_stations_list(tracks)
J = create_agv_list(agv_routes)
agv_routes_as_e = agv_routes_as_edges(agv_routes)
all_same_way = create_same_way_dict(agv_routes)

graph = utils.create_graph(tracks, agv_routes)
graph = create_graph(tracks, agv_routes)

d_max = {i: 40 for i in J}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_edges[j]}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_e[j]}
tau_headway = {(j, jp, s, sp): 2 if (s, sp) != ("s2", "s3") and (s, sp) != ("s3", "s2") else 0
for (j, jp) in all_same_way.keys() for (s, sp) in all_same_way[(j, jp)]}

Expand Down
26 changes: 13 additions & 13 deletions examples/example_largest.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# 15 AGVs 7 zones d_max = 40

from src import utils
from src.linear_solver import print_ILP_size, LinearAGV
from src.quadratic_solver import QuadraticAGV
from src.qubo_solver import annealing, constrained_solver, hybrid_anneal
import pickle
import time
import os

from src import create_stations_list, create_agv_list, create_graph, create_same_way_dict, agv_routes_as_edges
from src import print_ILP_size, LinearAGV
from src import QuadraticAGV
from src import annealing, constrained_solver, hybrid_anneal

from src.LinearProg import LinearProg
from src.process_results import print_results


cwd = os.getcwd()

Expand Down Expand Up @@ -45,15 +46,14 @@
14: ("s5", "s6")
}

stations = utils.create_stations_list(tracks)
J = utils.create_agv_list(agv_routes)
agv_routes_as_edges = utils.agv_routes_as_edges(agv_routes)
all_same_way = utils.create_same_way_dict(agv_routes)

graph = utils.create_graph(tracks, agv_routes)
stations = create_stations_list(tracks)
J = create_agv_list(agv_routes)
agv_routes_as_e = agv_routes_as_edges(agv_routes)
all_same_way = create_same_way_dict(agv_routes)
graph = create_graph(tracks, agv_routes)

d_max = {i: 40 for i in J}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_edges[j]}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_e[j]}
tau_headway = {(j, jp, s, sp): 2 if (s, sp) != ("s2", "s3") and (s, sp) != ("s3", "s2") else 0
for (j, jp) in all_same_way.keys() for (s, sp) in all_same_way[(j, jp)]}

Expand Down
31 changes: 14 additions & 17 deletions examples/example_medium.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# 7 AGVs 7 zones d_max = 40

from src import utils
from src import train_diagram
from src.qubo_solver import annealing, constrained_solver, hybrid_anneal
from src.linear_solver import print_ILP_size, LinearAGV
from src.quadratic_solver import QuadraticAGV
import numpy as np
import pickle
import time
import os
from pathlib import Path

from src.LinearProg import LinearProg
from src.process_results import print_results
from src import create_stations_list, create_agv_list, create_graph, create_same_way_dict, agv_routes_as_edges
from src import plot_train_diagram
from src import annealing, constrained_solver, hybrid_anneal
from src import print_ILP_size, LinearAGV
from src import QuadraticAGV



cwd = os.getcwd()

Expand Down Expand Up @@ -40,15 +37,15 @@
5: ("s6", "s5", "s4", "s3"),
6: ("s5", "s6")}

stations = utils.create_stations_list(tracks)
J = utils.create_agv_list(agv_routes)
agv_routes_as_edges = utils.agv_routes_as_edges(agv_routes)
all_same_way = utils.create_same_way_dict(agv_routes)
stations = create_stations_list(tracks)
J = create_agv_list(agv_routes)
agv_routes_as_e = agv_routes_as_edges(agv_routes)
all_same_way = create_same_way_dict(agv_routes)

graph = utils.create_graph(tracks, agv_routes)
graph = create_graph(tracks, agv_routes)

d_max = {i: 40 for i in J}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_edges[j]}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_e[j]}
tau_headway = {(j, jp, s, sp): 2 if (s, sp) != ("s2", "s3") and (s, sp) != ("s3", "s2") else 0
for (j, jp) in all_same_way.keys() for (s, sp) in all_same_way[(j, jp)]}

Expand Down Expand Up @@ -106,7 +103,7 @@
model.print_solution(print_zeros=True)
# AGV.nice_print(model, sol) <- WIP
if args.train_diagram:
train_diagram.plot_train_diagram(sol, agv_routes, tracks_len, 7)
plot_train_diagram(sol, agv_routes, tracks_len, 7)

if solve_quadratic:
hybrid = "bqm" # select hybrid solver bqm or cqm
Expand Down
27 changes: 12 additions & 15 deletions examples/example_medium_small.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# 6 AGVs 7 zones d_max = 40

from src import utils
from src import train_diagram
from src.qubo_solver import annealing, constrained_solver, hybrid_anneal
from src.linear_solver import print_ILP_size, LinearAGV
from src.quadratic_solver import QuadraticAGV
import pickle
import time
import os

from src import create_stations_list, create_agv_list, create_graph, create_same_way_dict, agv_routes_as_edges
from src import plot_train_diagram
from src import annealing, constrained_solver, hybrid_anneal
from src import print_ILP_size, LinearAGV
from src import QuadraticAGV

from src.LinearProg import LinearProg
from src.process_results import print_results


M = 50
Expand All @@ -37,15 +34,15 @@
4: ("s6", "s5", "s4", "s3"),
5: ("s5", "s6")}

stations = utils.create_stations_list(tracks)
J = utils.create_agv_list(agv_routes)
agv_routes_as_edges = utils.agv_routes_as_edges(agv_routes)
all_same_way = utils.create_same_way_dict(agv_routes)
stations = create_stations_list(tracks)
J = create_agv_list(agv_routes)
agv_routes_as_e = agv_routes_as_edges(agv_routes)
all_same_way = create_same_way_dict(agv_routes)

graph = utils.create_graph(tracks, agv_routes)
graph = create_graph(tracks, agv_routes)

d_max = {i: 40 for i in J}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_edges[j]}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_e[j]}
tau_headway = {(j, jp, s, sp): 2 if (s, sp) != ("s2", "s3") and (s, sp) != ("s3", "s2") else 0
for (j, jp) in all_same_way.keys() for (s, sp) in all_same_way[(j, jp)]}

Expand Down Expand Up @@ -98,7 +95,7 @@
model.print_solution(print_zeros=True)
# AGV.nice_print(model, sol) <- WIP
if args.train_diagram:
train_diagram.plot_train_diagram(sol, agv_routes, tracks_len, 7)
plot_train_diagram(sol, agv_routes, tracks_len, 7)

if solve_quadratic:
hybrid = "bqm" # select hybrid solver bqm or cqm
Expand Down
30 changes: 12 additions & 18 deletions examples/example_small.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# 4 AGV 5 zoneas d_max = 10 example

from src import utils
from src import train_diagram
from src.linear_solver import print_ILP_size, LinearAGV
from src.quadratic_solver import QuadraticAGV
from src.qubo_solver import annealing, constrained_solver, hybrid_anneal
import numpy as np
import pickle
import time
import os

from src import create_stations_list, create_agv_list, create_graph, create_same_way_dict, agv_routes_as_edges
from src import plot_train_diagram
from src import print_ILP_size, LinearAGV
from src import QuadraticAGV
from src import annealing, constrained_solver, hybrid_anneal

from scipy.optimize import linprog
from src.LinearProg import LinearProg
from src.process_results import get_results, load_results, print_results, store_result
from math import sqrt

cwd = os.getcwd()

Expand All @@ -37,15 +31,15 @@
4: ("s2", "s3")
}

stations = utils.create_stations_list(tracks)
J = utils.create_agv_list(agv_routes)
agv_routes_as_edges = utils.agv_routes_as_edges(agv_routes)
all_same_way = utils.create_same_way_dict(agv_routes)
stations = create_stations_list(tracks)
J = create_agv_list(agv_routes)
agv_routes_as_e = agv_routes_as_edges(agv_routes)
all_same_way = create_same_way_dict(agv_routes)

graph = utils.create_graph(tracks, agv_routes)
graph = create_graph(tracks, agv_routes)

d_max = {i: 10 for i in J}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_edges[j]}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_e[j]}
tau_headway = {(j, jp, s, sp): 2 if (s, sp) != ("s2", "s3") and (s, sp) != ("s3", "s2") else 0
for (j, jp) in all_same_way.keys() for (s, sp) in all_same_way[(j, jp)]}

Expand Down Expand Up @@ -97,7 +91,7 @@
model.print_solution(print_zeros=True)
# AGV.nice_print(model, sol) <- WIP
if args.train_diagram:
train_diagram.plot_train_diagram(sol, agv_routes, tracks_len, 5)
plot_train_diagram(sol, agv_routes, tracks_len, 5)

if solve_quadratic:
hybrid = "bqm" # select hybrid solver bqm or cqm
Expand Down
31 changes: 12 additions & 19 deletions examples/example_smallest.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# 2 AGV and 4 zones d_max = 10
import dimod

from src import utils
from src import train_diagram
from src.linear_solver import print_ILP_size, LinearAGV
from src.quadratic_solver import QuadraticAGV
from src.qubo_solver import annealing, constrained_solver, hybrid_anneal
from pathlib import Path
import numpy as np
import pickle
import csv
import time
import os

from src import create_stations_list, create_agv_list, create_graph, create_same_way_dict, agv_routes_as_edges
from src import plot_train_diagram
from src import print_ILP_size, LinearAGV
from src import QuadraticAGV
from src import annealing, constrained_solver, hybrid_anneal

from src.LinearProg import LinearProg
from src.process_results import print_results
from math import sqrt, log10

M = 20
tracks = [("s0", "s1"), ("s1", "s0"),
Expand All @@ -34,15 +27,15 @@
1: ("s0", "s1", "s2")
}

stations = utils.create_stations_list(tracks)
J = utils.create_agv_list(agv_routes)
agv_routes_as_edges = utils.agv_routes_as_edges(agv_routes)
all_same_way = utils.create_same_way_dict(agv_routes)
stations = create_stations_list(tracks)
J = create_agv_list(agv_routes)
agv_routes_as_e = agv_routes_as_edges(agv_routes)
all_same_way = create_same_way_dict(agv_routes)

graph = utils.create_graph(tracks, agv_routes)
graph = create_graph(tracks, agv_routes)

d_max = {i: 10 for i in J}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_edges[j]}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_e[j]}
tau_headway = {(j, jp, s, sp): 2 if (s, sp) != ("s2", "s3") and (s, sp) != ("s3", "s2") else 0
for (j, jp) in all_same_way.keys() for (s, sp) in all_same_way[(j, jp)]}

Expand Down Expand Up @@ -95,7 +88,7 @@
model.print_solution(print_zeros=True)
# AGV.nice_print(model, sol) <- WIP
if args.train_diagram:
train_diagram.plot_train_diagram(sol, agv_routes, tracks_len, 4)
plot_train_diagram(sol, agv_routes, tracks_len, 4)

if solve_quadratic:
hybrid = "bqm" # select hybrid solver bqm or cqm
Expand Down
35 changes: 12 additions & 23 deletions examples/example_tiny.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,14 @@
import dimod
import minorminer
from dwave.system import DWaveSampler
from src import utils
from src.linear_solver import print_ILP_size, LinearAGV
from src.quadratic_solver import QuadraticAGV
from src.qubo_solver import annealing
import numpy as np
import pickle
import csv
import time
import os
import json


from math import sqrt
from src.LinearProg import LinearProg
from src.process_results import print_results
from src.quadratic_solver_CPLEX import quadratic_solve_qubo, check_solution, save_results
from src.utils import check_solution_list
from src import train_diagram
from src import create_stations_list, create_agv_list, create_graph, create_same_way_dict
from src import print_ILP_size, LinearAGV
from src import QuadraticAGV
from src import agv_routes_as_edges
from src import plot_train_diagram

cwd = os.getcwd()

Expand All @@ -37,15 +27,14 @@
agv_routes = {0: ("s0", "s1"),
1: ("s1", "s2")}

stations = utils.create_stations_list(tracks)
J = utils.create_agv_list(agv_routes)
agv_routes_as_edges = utils.agv_routes_as_edges(agv_routes)
all_same_way = utils.create_same_way_dict(agv_routes)

graph = utils.create_graph(tracks, agv_routes)
stations = create_stations_list(tracks)
J = create_agv_list(agv_routes)
agv_routes_as_e = agv_routes_as_edges(agv_routes)
all_same_way = create_same_way_dict(agv_routes)
graph = create_graph(tracks, agv_routes)

d_max = {i: 1 for i in J}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_edges[j]}
tau_pass = {(j, s, sp): tracks_len[(s, sp)] for j in J for s, sp in agv_routes_as_e[j]}
tau_headway = {(j, jp, s, sp): 2 for (j, jp) in all_same_way.keys() for (s, sp) in all_same_way[(j, jp)]}

tau_operation = {(agv, station): 2 for agv in J for station in stations}
Expand Down Expand Up @@ -97,7 +86,7 @@
model.print_solution(print_zeros=True)
# AGV.nice_print(model, sol) <- WIP
if args.train_diagram:
train_diagram.plot_train_diagram(sol, agv_routes, tracks_len, 3)
plot_train_diagram(sol, agv_routes, tracks_len, 3)


if solve_quadratic:
Expand Down
Loading

0 comments on commit aa1b7bd

Please sign in to comment.