Skip to content

Commit fdbc60a

Browse files
guilyxactions-user
authored andcommitted
Apply formatting changes
1 parent 69250b6 commit fdbc60a

5 files changed

Lines changed: 62 additions & 20 deletions

File tree

jupyddl/data_analyst.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ def __get_all_pddl_from_data(self):
2727
if "DISPLAY" in os.environ:
2828
for root, _, files in os.walk("pddl-examples/", topdown=False):
2929
for name in files:
30-
#if ".gitkeep" in name:
30+
# if ".gitkeep" in name:
3131
# continue
3232
tested_files.append(os.getcwd() + "/" + os.path.join(root, name))
3333
if i % 2 != 0:
3434
domains_problems.append((tested_files[i - 1], tested_files[i]))
3535
i += 1
3636
return domains_problems
37-
return [("pddl-examples/flip/problem.pddl", "pddl-examples/flip/domain.pddl"),
38-
("pddl-examples/dinner/problem.pddl", "pddl-examples/dinner/domain.pddl")]
37+
return [
38+
("pddl-examples/flip/problem.pddl", "pddl-examples/flip/domain.pddl"),
39+
("pddl-examples/dinner/problem.pddl", "pddl-examples/dinner/domain.pddl"),
40+
]
3941

4042
def __plot_data(self, times, total_nodes, plot_title):
4143
data = dict()

tests/test_astar.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@
99

1010

1111
def test_astar_init():
12-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
12+
apla = AutomatedPlanner(
13+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
14+
)
1315
astar = AStarBestFirstSearch(apla, apla.available_heuristics["goal_count"])
1416
assert astar.init.h_cost == apla.available_heuristics["goal_count"](
1517
apla.initial_state, apla
1618
)
1719

1820

1921
def test_astar_goal():
20-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
22+
apla = AutomatedPlanner(
23+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
24+
)
2125
path, _, _ = apla.astar_best_first_search()
2226
assert apla.available_heuristics["goal_count"](path[-1].state, apla) == 0
2327

2428

2529
def test_astar_path_length():
26-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
30+
apla = AutomatedPlanner(
31+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
32+
)
2733
path, _, _ = apla.astar_best_first_search()
2834
assert len(path) > 0

tests/test_automated_planner.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,39 @@
88

99

1010
def test_parsing():
11-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
11+
apla = AutomatedPlanner(
12+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
13+
)
1214
assert str(apla.problem) != "" and str(apla.domain) != ""
1315

1416

1517
def test_available_actions():
16-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
18+
apla = AutomatedPlanner(
19+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
20+
)
1721
actions = apla.available_actions(apla.initial_state)
1822
assert len(actions) > 0
1923

2024

2125
def test_execute_action():
22-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
26+
apla = AutomatedPlanner(
27+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
28+
)
2329
actions = apla.available_actions(apla.initial_state)
2430
new_state = apla.transition(apla.initial_state, actions[0])
2531
assert str(new_state) != str(apla.initial_state)
2632

2733

2834
def test_state_has_term():
29-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
35+
apla = AutomatedPlanner(
36+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
37+
)
3038
is_goal = apla.state_has_term(apla.initial_state, apla.goals[0])
3139
assert not is_goal
3240

3341

3442
def test_state_assertion():
35-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
43+
apla = AutomatedPlanner(
44+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
45+
)
3646
assert not apla.satisfies(apla.problem.goal, apla.initial_state)

tests/test_data_analyst.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,40 @@ def test_data_analyst_constructor():
1111
_ = DataAnalyst()
1212
assert True
1313

14+
1415
def test_data_analyst_plot_dfs_one_pddl():
1516
da = DataAnalyst()
16-
da.plot_dfs(domain="pddl-examples/flip/domain.pddl", problem="pddl-examples/flip/problem.pddl")
17+
da.plot_dfs(
18+
domain="pddl-examples/flip/domain.pddl",
19+
problem="pddl-examples/flip/problem.pddl",
20+
)
1721
assert True
1822

1923

2024
def test_data_analyst_plot_bfs_one_pddl():
2125
da = DataAnalyst()
22-
da.plot_bfs(domain="pddl-examples/flip/domain.pddl", problem="pddl-examples/flip/problem.pddl")
26+
da.plot_bfs(
27+
domain="pddl-examples/flip/domain.pddl",
28+
problem="pddl-examples/flip/problem.pddl",
29+
)
2330
assert True
2431

2532

2633
def test_data_analyst_plot_dijkstra_one_pddl():
2734
da = DataAnalyst()
28-
da.plot_dijkstra(domain="pddl-examples/flip/domain.pddl", problem="pddl-examples/flip/problem.pddl")
35+
da.plot_dijkstra(
36+
domain="pddl-examples/flip/domain.pddl",
37+
problem="pddl-examples/flip/problem.pddl",
38+
)
2939
assert True
3040

3141

3242
def test_data_analyst_plot_astar_h_goal_count_one_pddl():
3343
da = DataAnalyst()
34-
da.plot_astar_data(domain="pddl-examples/flip/domain.pddl", problem="pddl-examples/flip/problem.pddl")
44+
da.plot_astar_data(
45+
domain="pddl-examples/flip/domain.pddl",
46+
problem="pddl-examples/flip/problem.pddl",
47+
)
3548
assert True
3649

3750

@@ -98,22 +111,29 @@ def test_comparative_no_dfs():
98111
def test_comparative_one_pddl():
99112
da = DataAnalyst()
100113
da.comparative_data_plot(
101-
dfs=False, bfs=False, domain="pddl-examples/flip/domain.pddl", problem="pddl-examples/flip/problem.pddl"
114+
dfs=False,
115+
bfs=False,
116+
domain="pddl-examples/flip/domain.pddl",
117+
problem="pddl-examples/flip/problem.pddl",
102118
)
103119
assert True
104120

105121

106122
def test_comparative_use_data_json():
107123
da = DataAnalyst()
108124
da.comparative_data_plot(
109-
domain="pddl-examples/flip/domain.pddl", problem="pddl-examples/flip/problem.pddl", collect_new_data=False
125+
domain="pddl-examples/flip/domain.pddl",
126+
problem="pddl-examples/flip/problem.pddl",
127+
collect_new_data=False,
110128
)
111129
assert True
112130

113131

114132
def test_comparative_zero_h():
115133
da = DataAnalyst()
116134
da.comparative_data_plot(
117-
domain="pddl-examples/flip/domain.pddl", problem="pddl-examples/flip/problem.pddl", heuristic_key="zero"
135+
domain="pddl-examples/flip/domain.pddl",
136+
problem="pddl-examples/flip/problem.pddl",
137+
heuristic_key="zero",
118138
)
119139
assert True

tests/test_heuristics.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515

1616

1717
def test_zero_heuristic():
18-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
18+
apla = AutomatedPlanner(
19+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
20+
)
1921
heuristic = hs.zero_heuristic(apla.initial_state, apla)
2022
assert heuristic == 0
2123

2224

2325
def test_goal_count_heuristic():
24-
apla = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl")
26+
apla = AutomatedPlanner(
27+
"pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl"
28+
)
2529
heuristic = hs.goal_count_heuristic(apla.initial_state, apla)
2630
assert heuristic == 1

0 commit comments

Comments
 (0)