JamesSaxon / access-old

Python module to calculate spatial access scores.
http://access.readthedocs.io
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Create RAAM Python Function #8

Open JamesSaxon opened 5 years ago

JamesSaxon commented 5 years ago

Create the "nominal" version of the RAAM optimization.

The basic idea here is to iteratively move patients from the maximum cost location to the minimum cost location.

This should be fairly straightforward in python.

  1. Start with a df with columns for origin, destination, travel_cost (which may have undergone a transformation -- perhaps just τ, perhaps also a function), the congestion_cost, and the current (integer) assignment level
  2. Assign all patients to the nearest location (lowest travel cost)
  3. Index on origins and destination. For each origin, find the lowest and highest cost physician locations. Transfer some over.
  4. Reaggregate the congestion costs and merge that back on. Repeat 2-4.

You should do all this without:

  1. Moving more than are needed to equalize costs.
  2. Moving more than are actually there
  3. Moving them too fast, generally

Unit tests:

JamesSaxon commented 5 years ago