Skip to content
Snippets Groups Projects
Commit 16e59b0e authored by Mathias Berger's avatar Mathias Berger
Browse files

Added README.

parent 4ba4a6ed
No related branches found
No related tags found
No related merge requests found
This repository contains Julia scripts implementing the algorithms proposed to solve the max k-multicover problem introduced in the following publication: "Siting Renewable Power Generation Assets with Combinatorial Optimisation", Mathias Berger et al., Optimization Letters, 2021. DOI: https://doi.org/10.1007/s11590-021-01795-0
The following algorithms are available in this repository:
1) Direct solution of integer programming (IP) formulation of max k-multicover via branch-and-bound/cut (via JuMP and Gurobi 9.1)
2) Direct solution of mixed-integer programming relaxation of IP via branch-and-bound/cut (via JuMP and Gurobi 9.1)
3) Greedy algorithm with randomised tie-breaking
4) Greedy algorithm with randomised partial enumeration and tie-breaking
5) Simulated annealing local search algorithm
6) Algorithm combining 2) and 5)
7) Algorithm combining 4) and 5)
The src/ directory includes three scripts, namely:
- algorithms.jl, which implements algorithms 1) - 7)
- utilities.jl, which includes useful auxiliary functions
- main.jl, from which algorithms can be run
The data/ directory includes some toy data on which the algorithms can be tested. The data come from a renewable power plant siting problem, where a user-specified number of onshore wind sites (k) must be selected out of 3609 candidate sites in Europe so as to minimise the occurrence of simultaneous low electricity production events relative to a user-specified threshold (e.g., such that at least c sites produce simultaneously). Hourly-sampled meteorological data from the ERA5 database was transformed into so-called capacity factor data (reflecting the amount of electricity that each candidate site may produce during each hour, based on the type of power generation technology that may be deployed there). In total, capacity factor data are available for 744 hours (one month) and each candidate site. These data are stored in capacity_factors_matrix.p, which is a pickled file. Electricity demand data are stored in demand_vector.p, while technical potential (i.e., the maximum amount of capacity that may be deployed at a given site) data are stored in potential.p. The capacity factor, electricity demand and technical potential data are used to construct the D matrix.
Please feel free to email any requests or comments to mathias.berger@alumni.duke.edu.
......@@ -8,7 +8,7 @@ using BenchmarkTools
# Description: function implementing the max k-multicover problem as a 0-1 integer program with JuMP and Gurobi
#
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), i.e., D_mn = 1 if set n covers element m and 0 otherwise
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m and 0 otherwise
# c - coverage parameter
# k - number of sets to select
#
......@@ -43,7 +43,7 @@ end
# Description: function implementing a mixed-integer linear relaxation of the integer progrmaming formulation of the max k-multicover problem with JuMP and Gurobi
#
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), i.e., D_mn = 1 if set n covers element m and 0 otherwise
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m and 0 otherwise
# c - coverage parameter
# k - number of sets to select
#
......@@ -79,7 +79,7 @@ end
# Description: function implementing a randomised greedy algorithm; in each iteration, ties between locations are broken arbitrarily at random
#
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), i.e., D_mn = 1 if set n covers element m and 0 otherwise
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m and 0 otherwise
# c - coverage parameter
# k - number of sets to select
#
......@@ -139,7 +139,7 @@ end
# Description: function implementing a randomised greedy algorithm with partial enumeration
#
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), i.e., D_mn = 1 if set n covers element m and 0 otherwise
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m and 0 otherwise
# c - coverage parameter
# k - number of sets to select
# p - percentage of sets to sample in each iteration
......@@ -201,7 +201,7 @@ end
# Description: function implementing a simulated annealing-inspired local search for unpartitioned geographical regions
#
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), i.e., D_mn = 1 if set n covers element m and 0 otherwise
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m and 0 otherwise
# c - coverage parameter
# k - number of sets to select
# x_init - initial solution, vector with entries in {0., 1.}, with cardinality k and whose dimension is compatible with D
......@@ -315,7 +315,7 @@ end
# Description: function implementing an algorithm solving a mixed-integer relaxation of the problem, followed by a simulated annealing-inspired local search
#
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), i.e., D_mn = 1 if set n covers element m and 0 otherwise
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m and 0 otherwise
# c - coverage parameter
# k - number of sets to select
# I - number of iterations (outer loop)
......@@ -441,7 +441,7 @@ end
# Description: function implementing an algorithm whereby multiple RGP runs are performed, the best solution is retrieved and used to initialise a simulated annealing local search algorithm
#
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), i.e., D_mn = 1 if set n covers element m and 0 otherwise
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m and 0 otherwise
# c - coverage parameter
# k - number of sets to select
# p - percentage of sets to sample in each iteration of RGP algorithm
......@@ -603,7 +603,7 @@ end
# Description: function implementing a random search algorithm
#
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), i.e., D_mn = 1 if set n covers element m and 0 otherwise
# Inputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m and 0 otherwise
# c - coverage parameter
# k - number of sets to select
# S - number of sets to sample
......
using JuMP
using Gurobi
function solve_MILP(D::Array{Float64, 2}, c::Float64, n::Float64, solver::String)
W = size(D)[1]
L = size(D)[2]
if solver == "Gurobi"
MILP_model = Model(optimizer_with_attributes(Gurobi.Optimizer, "TimeLimit" => 7200., "MIPGap" => 0.01, "LogToConsole" => 0))
else
println("Please use Cbc or Gurobi")
throw(ArgumentError)
end
@variable(MILP_model, x[1:L], Bin)
@variable(MILP_model, 0 <= y[1:W] <= 1)
@constraint(MILP_model, cardinality, sum(x) == n)
@constraint(MILP_model, covering, D * x .>= c * y)
@objective(MILP_model, Max, sum(y))
optimize!(MILP_model)
x_sol = round.(value.(x))
return x_sol
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment