Skip to content

felipewhitaker/decision_and_risk_analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facility Location Problem on Chicago Crimes Dataset

This repository was created to store the final project developed for Decision and Risk Analysis discipline at PUC-Rio. The objective is to choose a problem that has intrinsic uncertainty and use Julia to model and optimize a decision.

Optimization Background

The literature TODO

Maximum Coverage

TODO

FLEET ICT

TODO add model explanation

With this in mind, below is the maximum coverage formulation, as developed by Oliveira, 2020 (PT):

$$ \begin{aligned} \text{MAX} \quad \Sigma_{i \in I, ; u \in U, ; t \in T} \quad d_{i, u}^t \cdot y_{i, u}^t \\ s.a.\quad \Sigma_{j\in N_{i, j}} \quad x_{j, u}^{t} &\ge y_{i, u}^t \quad \forall i ; \forall u ; \forall t \\ \Sigma_{j\in J} \quad x_{j, u}^{t} &\le P_{u} \quad \forall u ; \forall t \\ \Sigma_{u \in U} \quad x_{j, u}^{t} &\le C_{j} \cdot z_{j} \quad \forall j ; \forall t \\ x_{j, u}^{t} &\le z_j \quad \forall j ; \forall u ; \forall t \end{aligned} $$

Crimes in Chicago

For this project, crimes have three main components:

  • type (e.g. NARCOTICS);
  • location (e.g. (41.827, -87.632));
  • and time (e.g. 01/29/2013 03:33:00 PM).

Given the objective to minimize cost given that it is possible to cover at least a certain percentage of reported crimes to the correct place and within a maximum distance. Therefore:

$$ \begin{gathered} \text{MIN} \quad \Sigma_{j \in J} \quad c_j \cdot z_j \\ s.a. \quad \frac{\Sigma_{i \in I, ; u \in U, ; t \in T} \quad d_{i, u}^t \cdot y_{i, u}^t}{\Sigma_{i \in I, ; u \in U, ; t \in T} \quad d_{i, u}^{t}} &\ge \text{cov} \\ ... \end{gathered} $$

Running

Data

The data used in this project is available at Kaggle and can be downloaded directly using Kaggle's API using kaggle datasets download -d currie32/crimes-in-chicago -p raw/ --unzip, which will download and unzip directly inside raw/ folder.

Visualization and Selection

Both visualization and selection are done using python, and an environment with the needed packages can be created by running poetry install.

Visualization is done in data.ipynb

Data is then selected and filered to reduce the computational power needed for the optimization model.

TODO cooked folder

Location definitions

TODO how will possible facility locations be defined?

Optimization

julia --project=coverenv/ cover.jl

GeoStats.jl

Important Mentions

Troubleshooting

  • If scipy's (and plotly, plotly-express, folium) installation fails by not finding BLAS or Lapack libraries, follow these steps, and make sure the python version that is being used has an available wheel for scipy.

Releases

No releases published

Packages

No packages published