Skip to content

Commit d26378f

Browse files
guilyxactions-user
authored andcommitted
Apply formatting changes
1 parent ba6fbbf commit d26378f

3 files changed

Lines changed: 33 additions & 21 deletions

File tree

jupyddl/data_analyst.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,10 @@ def comparative_astar_heuristic_plot(
509509
times_y.append(data[node_opened])
510510

511511
ax.plot(
512-
nodes_sorted, times_y, "-o", label=h,
512+
nodes_sorted,
513+
times_y,
514+
"-o",
515+
label=h,
513516
)
514517

515518
plt.title("A* heuristics complexity comparison")
@@ -541,7 +544,10 @@ def comparative_greedy_bfs_heuristic_plot(
541544
times_y.append(data[node_opened])
542545

543546
ax.plot(
544-
nodes_sorted, times_y, "-o", label=h,
547+
nodes_sorted,
548+
times_y,
549+
"-o",
550+
label=h,
545551
)
546552

547553
plt.title("Greedy Best First heuristics complexity comparison")
@@ -616,7 +622,10 @@ def comparative_data_plot(
616622
for node_opened in nodes_sorted:
617623
times_y.append(data[node_opened])
618624
ax.plot(
619-
nodes_sorted, times_y, "-o", label=planner,
625+
nodes_sorted,
626+
times_y,
627+
"-o",
628+
label=planner,
620629
)
621630
plt.title("Planners complexity comparison")
622631
plt.legend(loc="upper left")
@@ -744,7 +753,9 @@ def compute_planners_efficiency(self):
744753
plt.ylabel("Cost to goal")
745754
for key, val in costs.items():
746755
ax.plot(
747-
val, "-o", label=key,
756+
val,
757+
"-o",
758+
label=key,
748759
)
749760
costs[key] = [i for i in costs[key] if i != 0]
750761
plt.title("Planners efficiency (costs)")

jupyddl/heuristics.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ def compute(self, state):
7878
return self.heuristic_keys[self.current_h](costs)
7979

8080
for ax in self.cache.axioms:
81-
fact_costs = self.automated_planner.pddl.compute_costs_one_step_derivation(
82-
facts, fact_costs, ax, self.current_h
81+
fact_costs = (
82+
self.automated_planner.pddl.compute_costs_one_step_derivation(
83+
facts, fact_costs, ax, self.current_h
84+
)
8385
)
8486

8587
actions = self.automated_planner.available_actions(state)
@@ -208,8 +210,10 @@ def compute(self, state):
208210
return max(costs)
209211

210212
for ax in self.cache.axioms:
211-
fact_costs = self.automated_planner.pddl.compute_costs_one_step_derivation(
212-
facts, fact_costs, ax, "max"
213+
fact_costs = (
214+
self.automated_planner.pddl.compute_costs_one_step_derivation(
215+
facts, fact_costs, ax, "max"
216+
)
213217
)
214218

215219
actions = self.automated_planner.available_actions(state)

jupyddl/metrics.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@ def __str__(self):
2222
else:
2323
av = 0
2424
w = 0
25-
return (
26-
"Expanded %d state(s).\nOpened %d state(s).\nReopened %d state(s).\nEvaluated %d state(s).\nGenerated %d state(s).\nDead ends: %d state(s).\nRuntime: %.2fs.\nTotal heuristic runtime: %.2fs\nComputational weight of heuristic in the search: %.2f%%"
27-
% (
28-
self.n_expended,
29-
self.n_opened,
30-
self.n_reopened,
31-
self.n_evaluated,
32-
self.n_generated,
33-
self.deadend_states,
34-
self.runtime,
35-
av,
36-
w,
37-
)
25+
return "Expanded %d state(s).\nOpened %d state(s).\nReopened %d state(s).\nEvaluated %d state(s).\nGenerated %d state(s).\nDead ends: %d state(s).\nRuntime: %.2fs.\nTotal heuristic runtime: %.2fs\nComputational weight of heuristic in the search: %.2f%%" % (
26+
self.n_expended,
27+
self.n_opened,
28+
self.n_reopened,
29+
self.n_evaluated,
30+
self.n_generated,
31+
self.deadend_states,
32+
self.runtime,
33+
av,
34+
w,
3835
)

0 commit comments

Comments
 (0)