|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | + |
| 3 | +import sys |
| 4 | +from os import path |
| 5 | + |
| 6 | +sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) |
| 7 | +from jupyddl.automated_planner import AutomatedPlanner |
| 8 | +from jupyddl.a_star import AStarBestFirstSearch |
| 9 | +from jupyddl.heuristics import DeleteRelaxationHeuristic |
| 10 | + |
| 11 | +# def test_astar_hmax(): |
| 12 | +# apla = AutomatedPlanner( |
| 13 | +# "pddl-examples/dinner/domain.pddl", "pddl-examples/dinner/problem.pddl" |
| 14 | +# ) |
| 15 | +# heuristic = DeleteRelaxationHeuristic(apla, "delete_relaxation/h_max") |
| 16 | +# astar = AStarBestFirstSearch(apla, heuristic.compute) |
| 17 | +# assert astar.init.h_cost == heuristic.compute(apla.initial_state) |
| 18 | + |
| 19 | + |
| 20 | +# def test_astar_hadd(): |
| 21 | +# apla = AutomatedPlanner( |
| 22 | +# "pddl-examples/dinner/domain.pddl", "pddl-examples/dinner/problem.pddl" |
| 23 | +# ) |
| 24 | +# heuristic = DeleteRelaxationHeuristic(apla, "delete_relaxation/h_max") |
| 25 | +# astar = AStarBestFirstSearch(apla, heuristic.compute) |
| 26 | +# assert astar.init.h_cost == heuristic.compute(apla.initial_state) |
| 27 | + |
| 28 | +def test_astar_hmax_sensible_domain(): |
| 29 | + apla = AutomatedPlanner( |
| 30 | + "pddl-examples/grid/domain.pddl", "pddl-examples/grid/problem.pddl" |
| 31 | + ) |
| 32 | + heuristic = DeleteRelaxationHeuristic(apla, "delete_relaxation/h_max") |
| 33 | + astar = AStarBestFirstSearch(apla, heuristic.compute) |
| 34 | + assert astar.init.h_cost == heuristic.compute(apla.initial_state) |
| 35 | + |
| 36 | + |
| 37 | +def test_astar_hadd_sensible_domain(): |
| 38 | + apla = AutomatedPlanner( |
| 39 | + "pddl-examples/grid/domain.pddl", "pddl-examples/grid/problem.pddl" |
| 40 | + ) |
| 41 | + heuristic = DeleteRelaxationHeuristic(apla, "delete_relaxation/h_max") |
| 42 | + astar = AStarBestFirstSearch(apla, heuristic.compute) |
| 43 | + assert astar.init.h_cost == heuristic.compute(apla.initial_state) |
0 commit comments