Skip to main content

condor_grid/
lib.rs

1//! Grid-domain owner crate for discrete pathfinding substrate.
2//!
3//! This domain crate owns the map model ([`Grid`]), discrete and any-angle search
4//! contracts ([`Pathfinder`], [`AnyAnglePathfinder`]), prepared / preprocessed
5//! multi-query maps, flow fields, hierarchical abstracts, MAPF starter surface,
6//! and incremental replanning traits. Algorithm implementations live under
7//! [`algorithms`]; root re-exports form the curated consumer surface that the
8//! public facade (`condor-for-games` / lib `condor`) mirrors for compatibility.
9//!
10//! **Not** polygonal / navmesh routing — those live in sibling domain crates.
11//! This owner crate depends on neutral core contracts, never on the public
12//! facade; corpus conformance and capture evidence live in private developer
13//! packages.
14//!
15//! # Choose a grid surface
16//!
17//! | Need | Start with |
18//! | --- | --- |
19//! | One static 4-connected query | [`AStar`] via [`Pathfinder`] |
20//! | Straight-line paths through a grid | [`AnyAnglePathfinder`] implementations |
21//! | Many queries over one static grid | [`PreprocessedGridBuilder`] or a domain-specific prepared builder |
22//! | Changing costs or blocked cells | [`GridReplanner`] / [`InterpolatedGridReplanner`] |
23//! | Multiple agents | [`MapfStarterPlanner`] |
24//!
25//! # Example
26//!
27//! ```
28//! use condor_grid::{AStar, Cell, Grid, Pathfinder, Point, SearchRequest};
29//!
30//! let mut grid = Grid::new(3, 3).expect("grid dimensions are valid");
31//! grid.set_cell(Point::new(1, 1), Cell::Blocked)
32//!     .expect("point is in bounds");
33//! let result = AStar.search(
34//!     &grid,
35//!     SearchRequest::new(Point::new(0, 0), Point::new(2, 2)),
36//! ).expect("request is valid");
37//! assert!(result.is_found());
38//! ```
39
40#![forbid(unsafe_code)]
41
42/// Grid algorithm implementations (static, prepared, any-angle, replanning families).
43pub mod algorithms;
44/// Any-angle pathfinder trait and continuous-on-grid request/result contracts.
45pub mod any_angle;
46/// Same-goal multi-agent flow-field build and query amortization.
47pub mod flow_field;
48/// Discrete grid storage, cell model, and edit/build errors.
49pub mod grid;
50/// Hierarchical abstract-grid layers for multi-level search.
51pub mod hierarchical;
52/// Multi-agent pathfinding starter planner and conflict vocabulary.
53pub mod mapf;
54/// Discrete path reconstruction and path cost types.
55pub mod path;
56/// Integer cell coordinates for the discrete grid lane.
57pub mod point;
58/// Prepared any-angle visibility graphs over static grids.
59pub mod prepared_any_angle;
60/// Preprocessed static multi-query grid search substrates.
61pub mod preprocessed_grid;
62/// Incremental grid replanning and interpolated continuous-on-grid routes.
63pub mod replanning;
64/// Online [`Pathfinder`] trait, search request, budget, and outcome contracts.
65pub mod search;
66
67// Private, not-ready MAPF-family candidates beside their mature family.
68#[allow(
69    dead_code,
70    reason = "private candidate retained for normal-family evaluation"
71)]
72mod mapf_flow_bounds;
73#[allow(
74    dead_code,
75    reason = "private candidate retained for normal-family evaluation"
76)]
77mod mapf_target_assignment;
78
79pub use algorithms::anya::{Anya, AnyaDiagnostics, AnyaInspection};
80pub use algorithms::astar::{AStar, AStarDiagnostics, AStarInspection};
81pub use algorithms::bfs::Bfs;
82pub use algorithms::bidirectional_bfs::BidirectionalBfs;
83pub use algorithms::dijkstra::Dijkstra;
84pub use algorithms::hpa_star::{HPAStarBuilder, PreparedHPAStar};
85pub use algorithms::jps_plus::{JpsPlusBuilder, PreparedJpsPlus};
86pub use algorithms::jump_point_search::{
87    JumpPointSearch, JumpPointSearchDiagnostics, JumpPointSearchInspection,
88};
89pub use algorithms::lazy_theta_star::LazyThetaStar;
90pub use algorithms::rectangular_symmetry_reduction::RectangularSymmetryReduction;
91pub use algorithms::subgoal_graph::{PreparedSubgoalGraph, SubgoalGraphBuilder};
92pub use algorithms::theta_star::ThetaStar;
93pub use any_angle::{
94    AnyAnglePath, AnyAnglePathBuildError, AnyAnglePathfinder, AnyAngleSearchError,
95    AnyAngleSearchRequest, AnyAngleSearchResult, AnyAngleSearchStats, has_line_of_sight,
96};
97pub use condor_core::Point2;
98pub use flow_field::{FlowDirection, FlowFieldBuildError, FlowFieldBuilder, PreparedFlowField};
99pub use grid::{Cell, Grid, GridBuildError, GridBuilder, GridEditError, GridStorage};
100pub use hierarchical::{
101    HierarchicalGridBuildError, HierarchicalGridBuilder, PreparedHierarchicalGrid,
102};
103pub use mapf::{
104    MapfAgent, MapfAgentPath, MapfConflict, MapfObjective, MapfPlan, MapfPlanMetrics, MapfProblem,
105    MapfStarterPlanner, MapfStarterPlannerFailure, MapfStarterPlannerOutcome,
106    MapfStarterPlannerResult, MapfValidationReport,
107};
108pub use path::{Path, PathBuildError};
109pub use point::Point;
110pub use prepared_any_angle::{
111    PREPARED_ANY_ANGLE_CSR_U32_INDEX_LIMIT, PREPARED_ANY_ANGLE_DEFAULT_BENCHMARK_NODE_BUDGET,
112    PREPARED_ANY_ANGLE_DIRECTED_EDGE_BUDGET, PREPARED_ANY_ANGLE_NODE_BUDGET,
113    PREPARED_ANY_ANGLE_RETAINED_BYTES_BUDGET, PreparedAnyAngleBenchmarkAdmission,
114    PreparedAnyAngleBuildDiagnostics, PreparedAnyAngleGrid, PreparedAnyAngleGridBuildError,
115    PreparedAnyAngleGridBuilder, PreparedAnyAngleQueryDiagnostics,
116};
117pub use preprocessed_grid::{
118    PreparedGridSearch, PreprocessedGridBuildError, PreprocessedGridBuilder,
119    PreprocessedGridMetadata, StaticPreparedGrid, StaticPreparedGridBuilder,
120};
121pub use replanning::{
122    GridReplanner, InterpolatedExpectedKind, InterpolatedGridReplanner,
123    InterpolatedMovingGoalReplanner, InterpolatedPath, InterpolatedPathBuildError,
124    InterpolatedPathOutcome, InterpolatedPathOutcomeKind, InterpolatedPathOutcomeRef,
125    InterpolatedQueryResult, InterpolatedSearchError, InterpolatedSearchOutcome,
126    InterpolatedSearchRequest, InterpolatedSearchResult, InterpolatedSearchStats,
127    InterpolatedTraversalCostModel, best_fallback_interpolated_path,
128    best_partial_interpolated_path, interpolated_path_cost, interpolated_segment_cost,
129    query_interpolated_grid,
130};
131pub use search::{
132    BudgetExhausted, BudgetWatch, GridSearchError, Pathfinder, SearchBudget, SearchOutcome,
133    SearchPathCost, SearchRequest, SearchResult, SearchStats, SearchVisitStats,
134};