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

Slight re-formatting of utilities.jl.

parent 2485590c
No related branches found
No related tags found
No related merge requests found
......@@ -39,16 +39,19 @@ function mypickle(filename, obj)
# Description: function computing the D matrix used for the renewable power plant siting application
#
# Inputs: A - matrix with entries between 0 and 1; rows correspond to time periods, columns correspond to locations; entries represent capacity factors
# Inputs: A - matrix with entries between 0 and 1 representing capacity factors; rows correspond to time periods
# and columns correspond to locations
# demand - vector storing the electricity demand at each time period
# potential - vector storing the technical potential of each location (i.e., the maximum amount of capacity that may be deployed there)
# potential - vector storing the technical potential of each location (i.e., the maximum amount of capacity
# that may be deployed there)
# k - number of locations to select
# varsigma - share of the electricity demand that each location must supply in order to cover a time period
#
# Outputs: D - binary matrix indicating whether locations cover time periods (i.e., D_tl = 1 if location l covers time period t and 0 otherwise)
# Outputs: D - binary matrix indicating which sets (columns) cover which elements (rows), that is, D_mn = 1 if set n covers element m
# and D_mn = 0 otherwise
#
function compute_D(A::Array{Float64, 2}, demand::Vector{Float64}, potential::Vector{Float64}, k::Int64, varsigma::Float64)::Array{Float64, 2}
function compute_D(A::Array{Float64, 2}, demand::Vector{Float64}, potential::Vector{Float64}, k::Int64, varsigma::Float64)
T::Int64, L::Int64 = size(A)
D::Array{Float64, 2} = zeros(Float64, T, L)
......@@ -68,7 +71,7 @@ function compute_D(A::Array{Float64, 2}, demand::Vector{Float64}, potential::Vec
return D
end
function compute_D(A::Array{Float64, 2}, demand::Vector{Float64}, potential::Vector{Float64}, k::Float64, varsigma::Float64)::Array{Float64, 2}
function compute_D(A::Array{Float64, 2}, demand::Vector{Float64}, potential::Vector{Float64}, k::Float64, varsigma::Float64)
T::Int64, L::Int64 = size(A)
D::Array{Float64, 2} = zeros(Float64, T, L)
......@@ -92,7 +95,8 @@ end
# Description: function computing the objective associated with a set of locations and coverage parameter
#
# 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 D_mn = 0 otherwise
# ind_incumbent - locations in the incumbent solution
# c - coverage parameter
#
......@@ -137,7 +141,8 @@ end
# Description: function computing the objective gain achieved by selecting a (candidate) set
#
# 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 D_mn = 0 otherwise
# d - vector storing the contribution of all sets that were selected previously
# threshold - substitute for coverage parameter
# ind - index of candidate set
......
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