Hybridization Graph Solvers (HGraph)¶
The HGraph (Hybridization Graph) module provides meta-solver capabilities that combine candidate solution paths from multiple runs or distinct base solvers into an optimal hybrid path. HGraph decomposes candidate paths into valid segments, constructs a hybridization graph of intersecting subpaths, and solves for the shortest bottleneck or total length path across all candidate combinations.
Architectural Design & Meta-Factory Pattern¶
Meta-Class Pattern: Uses
MetaHGraphSolver.make_hgraph_solver_class(BaseSolver)to dynamically generate a hybrid solver class wrapping an underlying planner.Component Interactions: 1. Executes the underlying base solver (e.g.,
PRMorRRT) to generate initial candidate paths. 2. Extracts path segments and computes segment-to-segment intersections usingdiscopygal.geometry_utils.collision_detection. 3. Constructs an
-graph where vertices represent path intersection points and edges represent valid path sub-segments.
4. Runs graph search to extract an optimal composite path superior to any individual candidate solution.
Hybridization Graph (HGraph) Pipeline¶
Concrete HGraph Solvers¶
HGraph for PRM:
discopygal.solvers.hgraphs.HGraph_PRMCombines candidate paths generated by repeated PRM roadmap queries.HGraph for RRT:
discopygal.solvers.hgraphs.HGraph_RRTCombines candidate paths generated by repeated RRT tree expansions.
API Reference¶
- class discopygal.solvers.hgraphs.HGraph(solver_class: <module 'discopygal.solvers_infra.Solver' from 'C:\\Users\\ofeqor\\dev\\discopygal\\src\\discopygal\\solvers_infra\\Solver.py'>, num_paths, neighborhood_distance, **kwargs)¶
Bases:
SamplingSolverA generic HGraph Solver. Receives a solver class which is the specific solver that is used to construct each path and for the local connector.
- Parameters:
- build_roadmap()¶
Constructs the roadmap of points in the configuration space which a path will be searched on to find a solution. Every sampling solver should implement how to build the roadmap.
- Returns:
The built roadmap. Each node represents a point in configuration space (dimension = 2*robots_num)
- Return type:
- classmethod get_arguments()¶
Return a list of arguments and their description, defaults and types. Can be used by a GUI to generate fields dynamically. Should be overridded by solvers.
- Returns:
arguments dict
- Return type:
dict
- get_potential_bridges(path1, path2)¶
Return all pairs of points between two paths that are close enough to connect a bridge between them.
- class discopygal.solvers.hgraphs.HGraph_PRM(**kwargs)¶
Bases:
MetaHGraphSolver
- class discopygal.solvers.hgraphs.HGraph_RRT(**kwargs)¶
Bases:
MetaHGraphSolver
- class discopygal.solvers.hgraphs.MetaHGraphSolver(**kwargs)¶
Bases:
HGraphA meta class to create specific HGraph solvers (HGraph solver based on specific solver class)
- classmethod get_arguments()¶
Return a list of arguments and their description, defaults and types. Can be used by a GUI to generate fields dynamically. Should be overridded by solvers.
- Returns:
arguments dict
- Return type:
dict
- static make_hgraph_solver_class(solver_class)¶
- Create a specific HGraph solver class from given solver_class.Name of the class will be: HGraph_<solver_class_name>
- Parameters:
solver_class – The solver class to make a HGraph solver based on it
- Returns:
The new created solver class
- Return type: