navigation

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func BFSJumps(graph JumpGraph, src string, targets []string) map[string]int

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

type JumpGraph map[string][]string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL