# Traveling salesperson

> A deterministic evolutionary solver for symmetric Euclidean traveling-salesperson instances. It combines farthest insertion with the public selection, permutation, sampling, and evolution contracts from `knotkit`.

A deterministic evolutionary solver for symmetric Euclidean traveling-salesperson instances. It combines farthest insertion with the public selection, permutation, sampling, and evolution contracts from `knotkit`.

## Result

> Bounded complete runs: sim-grid-B-010 in 2.784 ms and sim-grid-B-050 in 6.947 ms; policy rows are too noisy to rank

## Modules

* [`knotkit/evolution`](/modules/evolution/): Runs deterministic population evolution with index-based parent selection and immutable permutation operators
* [`knotkit/sampling`](/modules/sampling/): Draws unbiased subsets, pairs, shuffles, and weighted samples over injected randomness
* [`knotkit/distance`](/modules/distance/): Compares vectors, probability distributions, and sets and exposes each rule’s mathematical guarantees
* [`knotkit/prng`](/modules/prng/): Generates seeded pseudorandom numbers and unbiased integers for reproducible simulations and tests

## Figures

* Over 40 generations, mean tour cost fell from 32,366 to 6,563.
* The best tour fell from 6,670 to 6,563. The run uses 50 cities and seed 42.

Hover or focus a chart for exact values. Drawn by [`demo.ts`](https://github.com/jkomyno/knotkit/blob/main/problems/tsp/demo.ts) at build time, from the fixtures the benchmark uses; it reproduces the README figure.

## Reproduce

```bash
git clone https://github.com/jkomyno/knotkit.git && cd knotkit && bun install
bun run demo:problem:tsp
```

[`problems/tsp/README.md`](https://github.com/jkomyno/knotkit/blob/main/problems/tsp/README.md) states the fixture, the seed, and the result table.
