From c30bb2da5a47d62b093208b390d61bcab0b139e6 Mon Sep 17 00:00:00 2001 From: Charu Date: Sat, 24 Mar 2018 11:53:34 +0530 Subject: [PATCH] Added Iterative deepening search in search.ipynb --- search.ipynb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/search.ipynb b/search.ipynb index d16253be4..8effcd7f2 100644 --- a/search.ipynb +++ b/search.ipynb @@ -1639,6 +1639,41 @@ " problem=romania_problem)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 8. Iterative deepening search\n", + "\n", + "Let's change all the 'node_colors' to starting position and define a different problem statement. " + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "def iterative_deepening_search_for_vis(problem):\n", + " for depth in range(sys.maxsize):\n", + " iterations, all_node_colors, node=depth_limited_search_for_vis(problem)\n", + " if iterations:\n", + " return (iterations, all_node_colors, node)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "all_node_colors = []\n", + "romania_problem = GraphProblem('Arad', 'Bucharest', romania_map)\n", + "display_visual(romania_graph_data, user_input=False, \n", + " algorithm=iterative_deepening_search_for_vis, \n", + " problem=romania_problem)" + ] + }, { "cell_type": "markdown", "metadata": {},