Skip to main content

Modern Python package for geographic task allocation, clustering, and routing optimization

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

allocator-1.2.0.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

allocator-1.2.0-py3-none-any.whl (48.7 kB view details)

Uploaded Python 3

File details

Details for the file allocator-1.2.0.tar.gz.

File metadata

  • Download URL: allocator-1.2.0.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for allocator-1.2.0.tar.gz
Algorithm Hash digest
SHA256 5768fa50595c4d327a6d1b7c61377104ab6902e29175387b1954b33b4615dfd5
MD5 5aee497aadaa0dd4077b8661e1fc0c72
BLAKE2b-256 1a27ed4db49f0c360b475627a70dd0564c3d928c89688c9c34c279a4e90d2b29

See more details on using hashes here.

Provenance

The following attestation bundles were made for allocator-1.2.0.tar.gz:

Publisher: python-publish.yml on geosensing/allocator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file allocator-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: allocator-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 48.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for allocator-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d744b21d0d79d393373c7779e25de07bcff0e603bd17f4befa86cc8aef0f99fb
MD5 5eb7d2c1a8f46f9ec47770d27e527214
BLAKE2b-256 83d63f0daabf9f6a7b2cbbf505005c6011fe223b82c184b70416ff1c83e77b9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for allocator-1.2.0-py3-none-any.whl:

Publisher: python-publish.yml on geosensing/allocator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page