-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
47 lines (37 loc) · 1.08 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from argparse import ArgumentParser
from pathlib import Path
from pfm import PotentialFieldMethod, Space
DIR = Path(__file__).parent
def main() -> None:
parser = ArgumentParser(
prog="python main.py",
description="Potential field method runner"
)
parser.add_argument(
"--space",
dest="space",
help=(
"Path to the JSON file describing the configuration space, "
"default: %(default)r"
),
default=DIR / "data" / "normally.json",
)
parser.add_argument(
"--solution",
dest="solution",
help=(
"The path to the file where the solution will be written, "
"default: %(default)r"
),
default=DIR / "solution.json",
)
args = parser.parse_args()
input_path = Path(args.space).resolve()
output_path = Path(args.solution).resolve()
space = Space.form_file(input_path)
algorithm = PotentialFieldMethod()
plan = algorithm.solve(space)
plan.dump(output_path)
parser.exit()
if __name__ == "__main__":
main()