How kei18/lacam0 works
Project Type and Purpose
• Type: Native C++ command-line application and library for Multi-Agent Path Finding (MAPF).
• Purpose: Provide an extendable implementation of the LaCAM algorithm family, driven by a single main executable, with a reusable library core and test harnesses.
File Structure
• Top-level files:
• CMakeLists.txt – orchestrates build of library, executable, and tests
• main.cpp – CLI front-end
• assets/ – sample maps & scenarios
• tests/ – unit tests for each module
• third_party/argparse – CLI parsing submodule
• Library submodule lacam/:
• / – public headers (planner.hpp, graph.hpp, instance.hpp, etc.)
• src/ – implementation of each module
• Build scripts & CI:
• .github/workflows/ci.yml – continuous-integration pipeline
• .pre-commit-config.yaml – formatting hooks
README for Insights
• Core stack: CMake + C++17
• CLI usage: loads a .map and .scen, runs planner, writes result.txt
• Integrations: External visualizer reads map + result
• Extension points: planner modules, post_processing, metrics
Main Components & Their Relationships
a. Components
1) Build System (CMake)
2) CLI Executable (main)
3) Library Modules:
– Graph & Distance Table
– Instance loader (map + scenario)
– Planner & sub-techniques (tree rewiring, PIBT, etc.)
– Post-processing & Metrics
– Utility functions
4) Third-party CLI parser (argparse)
5) Assets (input maps & scenarios)
6) Test Harness (unit tests)
7) External Visualizer (optional runtime integration)
b. Data Flows & Interactions
– User invokes main → argparse parses flags
– main loads assets → builds Graph and Instance
– Planner module orchestrates search, calls dist_table, PIBT, metrics, post_processing
– On completion, main writes result.txt
– Results can be fed to external Visualizer
– Tests link against the library, load test assets, validate each module’s output
– CMake ties everything together: builds library, executable, and test binaries
Architectural Patterns & Design Principles
• Modular design: clear separation of concerns (loader, graph, planner, metrics, post-processing)
• Layered CLI → Library core → Data models → Algorithms → Output
• Dependency injection via headers & CMake targets
• Reusability: library core used by both main and tests
• Extensibility: new planner techniques drop in under lacam/src & include
Putting It All Together
• LaCAM Library
• CLI Executable
• Test Suite
• In the center, a large “LaCAM Library” block subdivided into:
• Data Layer (Graph, DistTable, Instance)
• Algorithm Layer (Planner, PIBT, Random-restart, Tree-rewiring)
• Post-processing & Metrics
• Utils
• On the left, the “CLI Executable” uses the library and the third-party argparse component
• On the right, “Assets” feed into the Data Layer; “result.txt” and “Visualizer” consume output
• At the bottom, “Test Suite” nodes connect to individual library sub-modules, loading test assets