Implements spatial optimization algorithms across several problem families including contiguity-constrained regionalization, discrete facility location, market share analysis, and least-cost corridor and route optimization over raster cost surfaces. Facility location problems also accept user-supplied network travel-time matrices. Uses a 'Rust' backend via 'extendr' for graph and routing algorithms, and the 'HiGHS' solver via the 'highs' package for facility location mixed-integer programs. Method-level references are provided in the documentation of the individual functions.

The spopt R package provides R-native implementations of spatial optimization algorithms for regionalization, facility location, route optimization, and corridor routing. Inspired by Python's PySAL spopt, the package brings these algorithms to R users with an sf-first API, a Rust backend for graph and routing algorithms, and the HiGHS solver for facility location.
Install from r-universe:
install.packages('spopt', repos = c('https://walkerke.r-universe.dev', 'https://cloud.r-project.org'))
For developers who need to build from source (requires Rust), see CONTRIBUTING.md.
Read through these vignettes to learn how to use the package:
If you find this project useful in your work and would like to ensure continued development of the package, you can provide support in the following ways:
To stay on top of package updates / new features and to get information about trainings, be sure to sign up for the Walker Data mailing list here.