pathfinding3d.finder.theta_star module
- class pathfinding3d.finder.theta_star.ThetaStarFinder(heuristic=None, weight=1, diagonal_movement=DiagonalMovement.always, time_limit=TIME_LIMIT, max_runs=MAX_RUNS)[source]
- Bases: - AStarFinder- Parameters:
 - __init__(heuristic=None, weight=1, diagonal_movement=DiagonalMovement.always, time_limit=TIME_LIMIT, max_runs=MAX_RUNS)[source]
- Find shortest path using Theta* algorithm Diagonal movement is forced to always. Not weighted. - Parameters:
- heuristic (Callable) – heuristic used to calculate distance of 2 points 
- weight (int) – weight for the edges 
- diagonal_movement (int) – if diagonal movement is allowed (see enum in diagonal_movement) 
- time_limit (float) – max. runtime in seconds 
- max_runs (int) – max. amount of tries until we abort the search (optional, only if we enter huge grids and have time constrains) <=0 means there are no constrains and the code might run on any large map. 
 
 
 - process_node(grid, node, parent, end, open_list, open_value=1)[source]
- Check if we can reach the grandparent node directly from the current node and if so, skip the parent. - Parameters:
- grid (Grid) – grid that stores all possible steps/tiles as 3D-list 
- node (GridNode) – the node we like to test 
- parent (GridNode) – the parent node (of the current node we like to test) 
- end (GridNode) – the end point to calculate the cost of the path 
- open_list (List) – the list that keeps track of our current path 
- open_value (bool) – needed if we like to set the open list to something else than True (used for bi-directional algorithms) 
 
 
 - apply_heuristic(node_a, node_b, heuristic=None)
- Helper function to apply heuristic 
 - check_neighbors(start, end, grid, open_list, open_value=1, backtrace_by=None)
- Find next path segment based on given node (or return path if we found the end) 
 - find_neighbors(grid, node, diagonal_movement=None)
- Find neighbor, same for Djikstra, A*, Bi-A*, IDA* 
 - find_path(start, end, grid)
- Find a path from start to end node on grid using the A* algorithm 
 - keep_running()
- Check, if we run into time or iteration constrains. - Raises:
- ExecutionTimeException – if we run into a time constrain 
- ExecutionRunsException – if we run into a iteration constrain