# lacam3-java **Repository Path**: YLyuliang/lacam3-java ## Basic Information - **Project Name**: lacam3-java - **Description**: 根据开源lacam3的Java实现 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: JGraphTMap - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-11-06 - **Last Updated**: 2026-11-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # lacam3-java Java port of the C++ `lacam3` MAPF solver. The map graph is built from JSON landmark points and road connections using Jackson. ## Build and run ```powershell mvn clean package java -jar target/lacam3-java-1.0.0.jar -m assets/map/test1.json -N 20 -v 3 ``` The program creates a seeded random instance (`-s`, default `0`), computes the solution, writes results to `build/result.txt`, then opens a graphical playback window when a desktop is available. Use the timeline to inspect steps, play/pause or step through configurations, and adjust the interval from 0.1 to 2.0 seconds. Run with `-h` to see CLI options. ## Port coverage Java modules cover JSON landmark/road graph loading, shortest-path distance tables, LaCAM* high-level configuration search, low-level constraint enumeration, PIBT-style priority inheritance/backtracking, Monte-Carlo candidate selection, SUO-style scatter initialization, collision tables, SIPP, path/configuration translation, background SIPP refinement, feasibility checks, metrics, and result logging. The Java port includes PIBT push-and-swap, recursive LaCAM refinement, parallel distance-table and PIBT-candidate computation, and time-based search checkpoints. Its `CppRandom` implementation is intended to reproduce the C++ `std::mt19937`-based random stream for the supported operations; deterministic parity still depends on using the same options and execution mode. Recursive LaCAM follows the C++ refiner design: a root-level refiner may select an intermediate configuration, solve the remaining subproblem with a bounded child planner, and splice the improved suffix back onto the original prefix. Child planners do not recursively spawn more LaCAM children; they use iterative SIPP refinement instead. The sample JSON map `assets/map/test1.json` contains 306 landmarks and 335 roads. Runtime varies by JVM, hardware, seed, and search options. ## Algorithm flow See [docs/ALGORITHM_FLOW.md](docs/ALGORITHM_FLOW.md) for the detailed search workflow, data structures, refinement stages, metrics, and Java module map. To choose tasks on the map and calculate interactively: ```powershell java -jar target/lacam3-java-1.0.0.jar -m assets/map/test1.json -N 4 ``` Click a `startPointId` or `goalPointId` cell in the task table, then click the corresponding landmark on the map. Click **Calculate**; once a solution is found, **Play solution** becomes available. Vehicles default to a 1 m × 1 m body; edit the size columns to change each vehicle. The playback interval is adjustable from 0.1 to 2.0 seconds. ## Vehicle interference The planner checks axis-aligned rectangular vehicle sensors using dyn4j, including simultaneous motion between successive configurations. Optional scenario columns load per-agent types, dimensions and safety margins; existing three-column files remain supported. See [docs/INTERFERENCE.md](docs/INTERFERENCE.md) for field definitions, input examples, the method-by-method call sequence, and current limitations. An optional `-i` file preloads tasks using a header and three whitespace-separated columns (`agentId startPointId goalPointId`): ```text id 1 landmark_195 landmark_523 ``` When `-i` is supplied, `-N` is optional and defaults to the number of task rows. In headless mode, provide `-i` because map clicking requires a desktop. Map JSON loading is handled by `lacam3.map.MapData`; `Graph` accepts parsed `MapData` and does not read files. Each `landmark` becomes a vertex, each `road` becomes a traversable undirected edge, and `rack` objects are ignored. MovingAI `.map` and `.scen` inputs are not supported.