https://github.com/rafaelmartinelli/facilitylocationproblems.jl
Julia Package for reading location problems data files
https://github.com/rafaelmartinelli/facilitylocationproblems.jl
cflp facility-location julia location maximum-coverage maximum-covering-problems optimization p-median
Last synced: 8 months ago
JSON representation
Julia Package for reading location problems data files
- Host: GitHub
- URL: https://github.com/rafaelmartinelli/facilitylocationproblems.jl
- Owner: rafaelmartinelli
- License: mit
- Created: 2021-05-14T14:54:13.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-17T16:04:51.000Z (almost 3 years ago)
- Last Synced: 2025-06-22T20:09:26.227Z (10 months ago)
- Topics: cflp, facility-location, julia, location, maximum-coverage, maximum-covering-problems, optimization, p-median
- Language: Julia
- Homepage:
- Size: 1.92 MB
- Stars: 14
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FacilityLocationProblems.jl
[](https://rafaelmartinelli.github.io/FacilityLocationProblems.jl/stable)
[](https://rafaelmartinelli.github.io/FacilityLocationProblems.jl/dev)
[](https://github.com/rafaelmartinelli/FacilityLocationProblems.jl/actions)
[](https://codecov.io/gh/rafaelmartinelli/FacilityLocationProblems.jl)
[](https://www.repostatus.org/#active)
This package reads data files for different location problems instances:
- (Capacitated) Facility Location Problems
- ~~(~~Capacitated~~)~~ P-Median Problems
- Maximum Coverage Problems
## Usage
### Capacitated Facility Location Problems
The type used by (Capacitated) Facility Location Problems is `FacilityLocationProblem`, defined as follows:
```julia
struct FacilityLocationProblem
name::String # Instance name
capacities::Vector{Int64} # Facilities capacities
demands::Vector{Int64} # Customers demands
fixed_costs::Vector{Float64} # Fixed costs to open facilities
costs::Matrix{Float64} # Costs to assign facilities to customers
lb::Float64 # Lower bound (-Inf if not known)
ub::Float64 # Upper bound ( Inf if not known)
end
```
Some classical instances from the literature can be downloaded on demand from [ORLib page](http://people.brunel.ac.uk/~mastjjb/jeb/info.html). For example, to download and load instance `cap41`:
```julia
data = loadFacilityLocationProblem(:cap41)
```
See the full list on [ORLib UFLP page](http://people.brunel.ac.uk/~mastjjb/jeb/orlib/uncapinfo.html), [ORLib CFLP page](http://people.brunel.ac.uk/~mastjjb/jeb/orlib/capinfo.html) or call the function `getFacilityLocationInstances`.
Optionally, it is possible to set the facilities' capacity (mandatory for instances `capa`, `capb`, and `capc`):
```julia
data = loadFacilityLocationProblem(:capa, 8000)
```
### ~~(~~Capacitated~~)~~ P-Median Problems
The type used by ~~(~~Capacitated~~)~~ P-Median Problems is `PMedianProblem`, defined as follows:
```julia
struct PMedianProblem
name::String # Instance name
medians::Int64 # Number of medians (p)
capacity::Int64 # Medians capacities
demands::Vector{Int64} # Customers demands
costs::Matrix{Float64} # Costs matrix (distances)
x::Vector{Int64} # Customers x coordinates
y::Vector{Int64} # Customers y coordinates
lb::Float64 # Lower bound (-Inf if not known)
ub::Float64 # Upper bound ( Inf if not known)
end
```
Some classical (Capacitated) P-Median instances from the literature are preloaded. For example, to load instance `pmedcap01`:
```julia
data = loadPMedianProblem(:pmedcap01)
```
See the [full list](https://github.com/rafaelmartinelli/FacilityLocationProblems.jl/tree/main/data) or call the function `getPMedianInstances`.
### Maximum Coverage Problems
The type used by Maximum Coverage Problems is `MaximumCoverageProblem`, defined as follows:
```julia
struct MaximumCoverageProblem
name::String # Instance name
medians::Int64 # Number of medians (p)
distance::Int64 # Coverage distance
demands::Vector{Int64} # Customers demands
coverage::Vector{Vector{Int64}} # Coverage sets
x::Vector{Int64} # Customers x coordinates
y::Vector{Int64} # Customers y coordinates
lb::Float64 # Lower bound (-Inf if not known)
ub::Float64 # Upper bound ( Inf if not known)
end
```
The package loads Capacitated P-Median instances as Maximum Coverage Problems, and the user must input the maximum coverage distance. For example, to load instance `pmedcap01` with maximum coverage distance of 10:
```julia
data = loadMaximumCoverageProblem(:pmedcap01, 10)
```
The medians capacities are ignored, and the coverage sets are built using calculated costs and given coverage distance.
### Other Features
This package also loads custom instances (following [ORLib format](http://people.brunel.ac.uk/~mastjjb/jeb/info.html)):
```julia
data = loadTypeOfProblem("/path/to/your/instance.txt", optional_arguments)
```
## Installation
FacilityLocationProblems is a registered Julia Package (yay!).
You can install FacilityLocationProblems through the Julia package manager.
Open Julia's interactive session (REPL) and type:
```julia
] add FacilityLocationProblems
```
## Related links
- [ORLib's Uncapacitated Facility Location page](http://people.brunel.ac.uk/~mastjjb/jeb/orlib/uncapinfo.html)
- [ORLib's Capacitated Facility Location page](http://people.brunel.ac.uk/~mastjjb/jeb/orlib/capinfo.html)
- [ORLib's Uncapacitated P-Median page](http://people.brunel.ac.uk/~mastjjb/jeb/orlib/pmedinfo.html) (this package does not read those instances)
- [ORLib's Capacitated P-Median page](http://people.brunel.ac.uk/~mastjjb/jeb/orlib/pmedcapinfo.html)
- [Sobolev Institute of Mathematics' CFLP Page](http://www.math.nsc.ru/AP/benchmarks/CFLP/cflp_tabl-eng.html) (this package does not read those instances)
- [Instituto Nacional de Pesquisas Espaciais' P-Median and Max Cover Page](http://www.lac.inpe.br/~lorena/instancias.html) (this package does not read those instances)
## Other packages
- [KnapsackLib.jl](https://github.com/rafaelmartinelli/Knapsacks.jl): Knapsack algorithms in Julia
- [LotSizingProblems.jl](https://github.com/rafaelmartinelli/LotSizingProblems.jl): Lot Sizing Problems Lib
- [AssignmentProblems.jl](https://github.com/rafaelmartinelli/AssignmentProblems.jl): Assignment Problems Lib
- [InventoryRoutingProblems.jl](https://github.com/rafaelmartinelli/InventoryRoutingProblems.jl): Inventory Routing Problems Lib
- [BPPLib.jl](https://github.com/rafaelmartinelli/BPPLib.jl): Bin Packing and Cutting Stock Problems Lib
- [CARPData.jl](https://github.com/rafaelmartinelli/CARPData.jl): Capacitated Arc Routing Problem Lib
- [MDVSP.jl](https://github.com/rafaelmartinelli/MDVSP.jl): Multiple-Depot Vehicle Scheduling Problem Lib
- [CVRPLIB.jl](https://github.com/chkwon/CVRPLIB.jl): Capacitated Vehicle Routing Problem Lib
- [TSPLIB.jl](https://github.com/matago/TSPLIB.jl): Traveling Salesman Problem Lib