Skip to main content

allocator

PyPI version Downloads CI Documentation

Field teams, delivery services, and survey organizations waste time and money on inefficient routes. When you have 100+ locations to visit, manual planning fails. Allocator solves this.

What It Does

  • Cluster: Divide locations into balanced work zones
  • Route: Find the shortest path through locations (TSP)
  • Assign: Match locations to nearest workers or depots
  • Random Walk: Generate survey itineraries on road networks

Install

pip install allocator

Python API

Cluster locations into zones

import allocator
import pandas as pd

locations = pd.DataFrame({
    'longitude': [100.501, 100.506, 100.510, 100.515, 100.520],
    'latitude': [13.756, 13.759, 13.763, 13.768, 13.772]
})

result = allocator.cluster(locations, n_clusters=2)
print(result.labels)  # [0 0 0 1 1]

Find shortest route

route = allocator.shortest_path(locations, method='ortools')
print(route.route)  # [0, 1, 2, 4, 3, 0]

Assign to nearest depot

depots = pd.DataFrame({
    'longitude': [100.50, 100.52],
    'latitude': [13.75, 13.77]
})

assignments = allocator.assign_to_closest(locations, depots)
print(assignments.data['assigned_worker'].tolist())  # [0, 0, 1, 1, 1]

Generate random walk itineraries

import networkx as nx

# Load road network graph (from OSMnx or similar)
G = nx.read_graphml("road_network.graphml")

result = allocator.random_walk(G, n_walks=10, walk_length_m=5000)
print(result.data)  # DataFrame with waypoints

CLI

allocator cluster kmeans locations.csv -n 5 -o zones.csv
allocator route tsp locations.csv --method ortools -o route.csv
allocator sort locations.csv --workers depots.csv -o assignments.csv
allocator random-walk road_network.graphml -n 10 -l 5000 -o waypoints.csv

Documentation

License

MIT

Metadata

Release files for allocator 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for allocator 1.2.0
File Size Uploaded
allocator-1.2.0.tar.gz 35.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for allocator 1.2.0
File Interpreter ABI Platform
allocator-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 84.2 kB

Release files / allocator-1.2.0.tar.gz

Download URL allocator-1.2.0.tar.gz
Size 35.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5768fa50595c4d327a6d1b7c61377104ab6902e29175387b1954b33b4615dfd5
BLAKE2b-256 checksum
How to use checksums
1a27ed4db49f0c360b475627a70dd0564c3d928c89688c9c34c279a4e90d2b29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.

Transparency log

Release files / allocator-1.2.0-py3-none-any.whl

Download URL allocator-1.2.0-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d744b21d0d79d393373c7779e25de07bcff0e603bd17f4befa86cc8aef0f99fb
BLAKE2b-256 checksum
How to use checksums
83d63f0daabf9f6a7b2cbbf505005c6011fe223b82c184b70416ff1c83e77b9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

0.1.7

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page