Documentation
¶
Overview ¶
Package navigation holds pure routing algorithms (BFS shortest-hops and Held-Karp / nearest-neighbor waypoint ordering) over a jump graph. It has no game-client or output dependency so it can be reused by worker autopilot, play_as plan_route, and the overmind tactical planner.
Index ¶
- Constants
- func BFSJumps(graph JumpGraph, src string, targets []string) map[string]int
- func NearestNeighborOrder(start string, waypoints []string, dist map[string]map[string]int, ...) ([]string, int, bool)
- func OptimalOrder(start string, waypoints []string, dist map[string]map[string]int, ...) ([]string, int, bool)
- type JumpGraph
Constants ¶
const RouteInf = 1 << 30
RouteInf is the "unreachable" sentinel for jump distances. It is large enough that summing a handful of them never overflows an int.
Variables ¶
This section is empty.
Functions ¶
func BFSJumps ¶
BFSJumps returns the jump distance from src to each system in targets. Unreachable targets map to RouteInf.
func NearestNeighborOrder ¶
func NearestNeighborOrder(start string, waypoints []string, dist map[string]map[string]int, returnToStart bool) ([]string, int, bool)
NearestNeighborOrder is the heuristic fallback for large waypoint sets.
func OptimalOrder ¶
func OptimalOrder(start string, waypoints []string, dist map[string]map[string]int, returnToStart bool) ([]string, int, bool)
OptimalOrder returns the waypoint visiting order that minimizes total jumps from start, optionally returning to start. It uses an exact Held-Karp DP for small inputs and a nearest-neighbor heuristic beyond that.
Types ¶
type JumpGraph ¶
JumpGraph is an undirected adjacency list where each edge is one jump.
func JumpGraphFromConnections ¶
func JumpGraphFromConnections(conns []knowledge.Connection) JumpGraph
JumpGraphFromConnections builds an undirected jump graph from KB connections. Each edge counts as a single jump; connections with an empty endpoint are skipped, and duplicate edges are collapsed.