forked from 2jungeuni/multi-objective-astar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (27 loc) · 1.12 KB
/
main.py
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
import pickle
import argparse
import pandas as pd
from planner import *
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Write the ids of the starting point and ending point.")
parser.add_argument("-f" , "--frm", required=True, help="start node")
parser.add_argument("-t", "--to", required=True, help="end node")
parser.add_argument("-w", "--weight", required=True, nargs="+", help="alpha, beta, gamma")
parser.add_argument("-s", "--save", required=True, help="save or not")
args = parser.parse_args()
frm = int(args.frm)
to = int(args.to)
alpha, beta, gamma = args.weight
alpha, beta, gamma = int(alpha), int(beta), int(gamma)
save = args.save
save = int(save)
planner = RoutingPlanner(alpha, beta, gamma)
if save:
planner.astar_path(frm, to)
print("save in ./result/optimal_path.csv")
table = pd.read_csv("./result/optimal_path.csv")
print(table)
print("Total distance (m): ", sum(table['distance (m)']))
print("Total travel time (m): ", sum(table['time (sec)']))
else:
print(planner.astar(frm, to))