6.3 Regression Planning

About

In a regression planner, a node is a subgoal that need to be achieved. This is different than in a forward planner, where a node is instead state. The regression planner can also use a heuristic function, just as with the forward planner. However, a heuristic useful for a forward planner does not necessarily mean it is useful for a regression planner, and vice versa.

You can run each cell by selecting it and pressing Ctrl+Enter in Windows or Shift+Return in MacOS. Alternatively, you can click the Play button in the toolbar, to the left of the stop button. For more information, check out our AISpace2 Tutorial.

Feel free to modify our codes either in this notebook or somewhere outside (e.g. python files in /aipython/). If you want to modify our codes outside, you might find this helpful for how your changes can take effect.

You need to run the following command to import our pre-defined problems. You can also define your own problems (how?).


In [ ]:
# Run this to import pre-defined problems
from aipython.stripsProblem import strips_delivery1, strips_delivery2, strips_delivery3, strips_blocks1, strips_blocks2, strips_blocks3, strips_elevator

In [ ]:
from aipython.searchMPP import SearcherMPP
from aipython.stripsRegressionPlanner import Regression_STRIPS
from aipython.stripsHeuristic import heuristic_fun

search_regression = Regression_STRIPS(planning_problem=strips_delivery2)
# If you want a heuristic, use this instead:
# search_regression = Regression_STRIPS(planning_problem=strips_delivery2, heur=heuristic_fun)
s_mpp = SearcherMPP(problem=search_regression)

# Visualization options
# For more explanation please visit: https://aispace2.github.io/AISpace2/tutorial.html#tutorial-common-visualization-options
s_mpp.sleep_time = 0.2 # The time, in seconds, between each step in auto solving
s_mpp.line_width = 2.0 # The thickness of edges
s_mpp.text_size = 13 # The fontsize of the text
s_mpp.detail_level = 2 # 0=no text, 1=truncated text, 2=full text
s_mpp.show_edge_costs = False
s_mpp.show_node_heuristics = False

# Display the widget
display(s_mpp)
s_mpp.search()

In [ ]: