{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# [6.3 Regression Planning](http://artint.info/2e/html/ArtInt2e.Ch6.S3.html)\n", "- [Implementation Details](http://artint.info/AIPython/aipython.pdf#page=89) (page 89)\n", "\n", "## About\n", "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.\n", "\n", "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](https://aispace2.github.io/AISpace2/tutorial.html).\n", "\n", "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](https://aispace2.github.io/AISpace2/tutorial.html#tutorial-faq-why-update-aipython-not-reflect) helpful for how your changes can take effect.\n", "\n", "You need to run the following command to import our pre-defined problems. You can also define your own problems ([how?](https://aispace2.github.io/AISpace2/tutorial.html#tutorial-planning-construct-yourself)). " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Run this to import pre-defined problems\n", "from aipython.stripsProblem import strips_delivery1, strips_delivery2, strips_delivery3, strips_blocks1, strips_blocks2, strips_blocks3, strips_elevator" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from aipython.searchMPP import SearcherMPP\n", "from aipython.stripsRegressionPlanner import Regression_STRIPS\n", "from aipython.stripsHeuristic import heuristic_fun\n", "\n", "search_regression = Regression_STRIPS(planning_problem=strips_delivery2)\n", "# If you want a heuristic, use this instead:\n", "# search_regression = Regression_STRIPS(planning_problem=strips_delivery2, heur=heuristic_fun)\n", "s_mpp = SearcherMPP(problem=search_regression)\n", "\n", "# Visualization options\n", "# For more explanation please visit: https://aispace2.github.io/AISpace2/tutorial.html#tutorial-common-visualization-options\n", "s_mpp.sleep_time = 0.2 # The time, in seconds, between each step in auto solving\n", "s_mpp.line_width = 2.0 # The thickness of edges\n", "s_mpp.text_size = 13 # The fontsize of the text\n", "s_mpp.detail_level = 2 # 0=no text, 1=truncated text, 2=full text\n", "s_mpp.show_edge_costs = False\n", "s_mpp.show_node_heuristics = False\n", "\n", "# Display the widget\n", "display(s_mpp)\n", "s_mpp.search()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 4 }