Skip to main content

Spatial Optimization in PySAL

Project description

spopt: Spatial Optimization

Regionalization, facility location, and transportation-oriented modeling

tag unittests codecov Documentation License Code style: black

Spopt is an open-source Python library for solving optimization problem with spatial data. Originating from the region module in PySAL (Python Spatial Analysis Library), it is under active development for the inclusion of newly proposed models and methods for regionalization, facility location, and transportation-oriented solutions.

Regionalization

import spopt, libpysal, geopandas, numpy
mexico = geopandas.read_file(libpysal.examples.get_path("mexicojoin.shp"))
mexico["count"] = 1
attrs = [f"PCGDP{year}" for year in range(1950, 2010, 10)]
w = libpysal.weights.Queen.from_dataframe(mexico)
mexico["count"], threshold_name, threshold, top_n  = 1, "count", 4, 2
numpy.random.seed(123456)
model = spopt.MaxPHeuristic(mexico, w, attrs, threshold_name, threshold, top_n)
model.solve()
mexico["maxp_new"] = model.labels_
mexico.plot(column="maxp_new", categorical=True, figsize=(12,8), ec="w");

Facility Location

Coming Soon.

Transportation & Routing

Coming Soon.

Examples

More examples can be found in the Tutorials section of the documentation.

All examples can be run interactively by launching this repository as a Binder.

Requirements

Installation

spopt is available on the Python Package Index. Therefore, you can either install directly with pip from the command line:

$ pip install -U spopt

or download the source distribution (.tar.gz) and decompress it to your selected destination. Open a command shell and navigate to the decompressed folder. Type:

$ pip install .

You may also install the latest stable spopt via conda-forge channel by running:

$ conda install --channel conda-forge spopt

Contribute

PySAL-spopt is under active development and contributors are welcome.

If you have any suggestions, feature requests, or bug reports, please open new issues on GitHub. To submit patches, please review PySAL: Getting Started, the PySAL development guidelines, the spopt contributing guidelines before opening a pull request. Once your changes get merged, you’ll automatically be added to the Contributors List.

Support

If you are having trouble, please create an issue, start a discussion, or talk to us in the gitter room.

Code of Conduct

As a PySAL-federated project, spopt follows the Code of Conduct under the PySAL governance model.

License

The project is licensed under the BSD 3-Clause license.

Funding

This project is/was partially funded through:

National Science Foundation Award #1831615: RIDIR: Scalable Geospatial Analytics for Social Science Research

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

spopt-0.0.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

spopt-0.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file spopt-0.0.1.tar.gz.

File metadata

  • Download URL: spopt-0.0.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for spopt-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8392ae5608452780a4a4ad84cba6f9134c8700df74777b3bc600e59f0dd02085
MD5 7713a884ca9fa7c03aac329fc6adf4c5
BLAKE2b-256 32b0ed599b9febc008c5bd0b5423a94cf6879920d2b0e36e480a02a23b80a52d

See more details on using hashes here.

Provenance

File details

Details for the file spopt-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: spopt-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for spopt-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5482774fd85d938d5fab86abc3ef0ddf5b709a333c018155053fe6b44c090349
MD5 3e32aa27d076d1542bf4100dc833ca1d
BLAKE2b-256 db790986d7167041626a4c16baef7ba32c5c3b1092ff46fb09428a08f4f7cd9a

See more details on using hashes here.

Provenance

Supported by

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