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

Skip to content

Commit de3175d

Browse files
CharuChhimpanorvig
authored andcommitted
Added Iterative deepening search in search.ipynb (#879)
1 parent bc81463 commit de3175d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

search.ipynb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,41 @@
16391639
" problem=romania_problem)"
16401640
]
16411641
},
1642+
{
1643+
"cell_type": "markdown",
1644+
"metadata": {},
1645+
"source": [
1646+
"## 8. Iterative deepening search\n",
1647+
"\n",
1648+
"Let's change all the 'node_colors' to starting position and define a different problem statement. "
1649+
]
1650+
},
1651+
{
1652+
"cell_type": "code",
1653+
"execution_count": 9,
1654+
"metadata": {},
1655+
"outputs": [],
1656+
"source": [
1657+
"def iterative_deepening_search_for_vis(problem):\n",
1658+
" for depth in range(sys.maxsize):\n",
1659+
" iterations, all_node_colors, node=depth_limited_search_for_vis(problem)\n",
1660+
" if iterations:\n",
1661+
" return (iterations, all_node_colors, node)"
1662+
]
1663+
},
1664+
{
1665+
"cell_type": "code",
1666+
"execution_count": null,
1667+
"metadata": {},
1668+
"outputs": [],
1669+
"source": [
1670+
"all_node_colors = []\n",
1671+
"romania_problem = GraphProblem('Arad', 'Bucharest', romania_map)\n",
1672+
"display_visual(romania_graph_data, user_input=False, \n",
1673+
" algorithm=iterative_deepening_search_for_vis, \n",
1674+
" problem=romania_problem)"
1675+
]
1676+
},
16421677
{
16431678
"cell_type": "markdown",
16441679
"metadata": {},

0 commit comments

Comments
 (0)