Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4139e5

Browse files
committed
renamed forward planner
1 parent aa61869 commit c4139e5

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

planning.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,10 @@ def double_tennis_problem():
487487
effect='At(actor, to) & ~At(actor, loc)')])
488488

489489

490-
class ForwardPlanner(search.Problem):
490+
class ForwardPlan(search.Problem):
491+
"""
492+
Forward state-space search [Section 10.2.1]
493+
"""
491494

492495
def __init__(self, planning_problem):
493496
super().__init__(associate('&', planning_problem.initial), associate('&', planning_problem.goals))

tests/test_planning.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,18 @@ def test_graphPlan():
202202

203203

204204
def test_forwardPlanner():
205-
spare_tire_solution = astar_search(ForwardPlanner(spare_tire())).solution()
205+
spare_tire_solution = astar_search(ForwardPlan(spare_tire())).solution()
206206
spare_tire_solution = list(map(lambda action: Expr(action.name, *action.args), spare_tire_solution))
207207
assert expr('Remove(Flat, Axle)') in spare_tire_solution
208208
assert expr('Remove(Spare, Trunk)') in spare_tire_solution
209209
assert expr('PutOn(Spare, Axle)') in spare_tire_solution
210210

211-
cake_solution = astar_search(ForwardPlanner(have_cake_and_eat_cake_too())).solution()
211+
cake_solution = astar_search(ForwardPlan(have_cake_and_eat_cake_too())).solution()
212212
cake_solution = list(map(lambda action: Expr(action.name, *action.args), cake_solution))
213213
assert expr('Eat(Cake)') in cake_solution
214214
assert expr('Bake(Cake)') in cake_solution
215215

216-
air_cargo_solution = astar_search(ForwardPlanner(air_cargo())).solution()
216+
air_cargo_solution = astar_search(ForwardPlan(air_cargo())).solution()
217217
air_cargo_solution = list(map(lambda action: Expr(action.name, *action.args), air_cargo_solution))
218218
assert expr('Load(C2, P2, JFK)') in air_cargo_solution
219219
assert expr('Fly(P2, JFK, SFO)') in air_cargo_solution
@@ -222,19 +222,19 @@ def test_forwardPlanner():
222222
assert expr('Fly(P2, SFO, JFK)') in air_cargo_solution
223223
assert expr('Unload(C1, P2, JFK)') in air_cargo_solution
224224

225-
sussman_anomaly_solution = astar_search(ForwardPlanner(three_block_tower())).solution()
225+
sussman_anomaly_solution = astar_search(ForwardPlan(three_block_tower())).solution()
226226
sussman_anomaly_solution = list(map(lambda action: Expr(action.name, *action.args), sussman_anomaly_solution))
227227
assert expr('MoveToTable(C, A)') in sussman_anomaly_solution
228228
assert expr('Move(B, Table, C)') in sussman_anomaly_solution
229229
assert expr('Move(A, Table, B)') in sussman_anomaly_solution
230230

231-
blocks_world_solution = astar_search(ForwardPlanner(simple_blocks_world())).solution()
231+
blocks_world_solution = astar_search(ForwardPlan(simple_blocks_world())).solution()
232232
blocks_world_solution = list(map(lambda action: Expr(action.name, *action.args), blocks_world_solution))
233233
assert expr('ToTable(A, B)') in blocks_world_solution
234234
assert expr('FromTable(B, A)') in blocks_world_solution
235235
assert expr('FromTable(C, B)') in blocks_world_solution
236236

237-
shopping_problem_solution = astar_search(ForwardPlanner(shopping_problem())).solution()
237+
shopping_problem_solution = astar_search(ForwardPlan(shopping_problem())).solution()
238238
shopping_problem_solution = list(map(lambda action: Expr(action.name, *action.args), shopping_problem_solution))
239239
assert expr('Go(Home, SM)') in shopping_problem_solution
240240
assert expr('Buy(Banana, SM)') in shopping_problem_solution

0 commit comments

Comments
 (0)