search_builder


Building a Search Graph

About

This notebook helps to construct a search graph visually. You can export this graph and run various search algorithms on it afterwards. You can set the cost of edges, change the names of nodes, and set start and goal nodes.

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.


In [ ]:
# Run this to import pre-defined problems
from aipython.searchProblem import search_empty, search_simple1, search_simple2, search_edgeless, search_cyclic_delivery, search_acyclic_delivery, search_tree, search_extended_tree, search_cyclic, search_vancouver_neighbour, search_misleading_heuristic, search_multiple_path_pruning, search_module_4_graph, search_module_5_graph, search_bicycle_courier_acyclic, search_bicycle_courier_cyclic

In [ ]:
from aispace2.jupyter.search import SearchBuilder

builder = SearchBuilder(search_problem=search_simple2)

# Visualization options
# For more explanation please visit: https://aispace2.github.io/AISpace2/tutorial.html#tutorial-common-visualization-options
builder.text_size = 13 # The fontsize of the text
builder.line_width = 2.0 # The thickness of edges
builder.show_edge_costs = True
builder.show_node_heuristics = True
builder

Obtaining the Search Problem

The following method enerates the Python code that, once run, constructs a search problem, i.e., an instance of Search_problem_from_explicit_graph.


In [ ]:
builder.py_code(need_positions=True)

In [ ]: