mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Allow user to specify product acquisition costs
This commit is contained in:
@@ -51,6 +51,7 @@ function parse(json)::Instance
|
||||
emissions = Dict()
|
||||
disposal_limit = zeros(T)
|
||||
disposal_cost = zeros(T)
|
||||
acquisition_cost = zeros(T)
|
||||
|
||||
if "transportation energy (J/km/tonne)" in keys(product_dict)
|
||||
energy = product_dict["transportation energy (J/km/tonne)"]
|
||||
@@ -68,6 +69,10 @@ function parse(json)::Instance
|
||||
disposal_cost = product_dict["disposal cost (\$/tonne)"]
|
||||
end
|
||||
|
||||
if "acquisition cost (\$/tonne)" in keys(product_dict)
|
||||
acquisition_cost = product_dict["acquisition cost (\$/tonne)"]
|
||||
end
|
||||
|
||||
prod_centers = []
|
||||
|
||||
product = Product(
|
||||
@@ -77,6 +82,7 @@ function parse(json)::Instance
|
||||
emissions,
|
||||
disposal_limit,
|
||||
disposal_cost,
|
||||
acquisition_cost,
|
||||
prod_centers,
|
||||
)
|
||||
push!(products, product)
|
||||
|
||||
@@ -15,6 +15,7 @@ mutable struct Product
|
||||
transportation_emissions::Dict{String,Vector{Float64}}
|
||||
disposal_limit::Vector{Float64}
|
||||
disposal_cost::Vector{Float64}
|
||||
acquisition_cost::Vector{Float64}
|
||||
collection_centers::Vector
|
||||
end
|
||||
|
||||
|
||||
@@ -149,10 +149,16 @@ function create_objective_function!(model::JuMP.Model)
|
||||
# Collection shipping node costs
|
||||
for n in values(graph.collection_shipping_nodes), t = 1:T
|
||||
|
||||
# Disposal costs
|
||||
# Acquisition costs
|
||||
add_to_expression!(
|
||||
obj,
|
||||
n.location.product.disposal_cost[t],
|
||||
n.location.product.acquisition_cost[t] * n.location.amount[t]
|
||||
)
|
||||
|
||||
# Disposal costs -- in this case, we recover the acquisition cost.
|
||||
add_to_expression!(
|
||||
obj,
|
||||
(n.location.product.disposal_cost[t] - n.location.product.acquisition_cost[t]),
|
||||
model[:collection_dispose][n, t],
|
||||
)
|
||||
end
|
||||
|
||||
@@ -46,6 +46,22 @@ function get_solution(model::JuMP.Model; marginal_costs = true)
|
||||
"Amount (tonne)" => n.location.amount,
|
||||
"Dispose (tonne)" =>
|
||||
[JuMP.value(model[:collection_dispose][n, t]) for t = 1:T],
|
||||
"Acquisition cost (\$)" =>
|
||||
[
|
||||
(
|
||||
n.location.amount[t] -
|
||||
JuMP.value(model[:collection_dispose][n, t])
|
||||
) * n.location.product.acquisition_cost[t]
|
||||
for t = 1:T
|
||||
],
|
||||
"Disposal cost (\$)" =>
|
||||
[
|
||||
(
|
||||
JuMP.value(model[:collection_dispose][n, t])
|
||||
* n.location.product.disposal_cost[t]
|
||||
)
|
||||
for t = 1:T
|
||||
]
|
||||
)
|
||||
if marginal_costs
|
||||
location_dict["Marginal cost (\$/tonne)"] = [
|
||||
|
||||
@@ -15,6 +15,8 @@ function products_report(solution; marginal_costs = true)::DataFrame
|
||||
df."amount (tonne)" = Float64[]
|
||||
df."amount disposed (tonne)" = Float64[]
|
||||
df."marginal cost (\$/tonne)" = Float64[]
|
||||
df."acquisition cost (\$)" = Float64[]
|
||||
df."disposal cost (\$)" = Float64[]
|
||||
T = length(solution["Energy"]["Plants (GJ)"])
|
||||
for (prod_name, prod_dict) in solution["Products"]
|
||||
for (location_name, location_dict) in prod_dict
|
||||
@@ -24,6 +26,8 @@ function products_report(solution; marginal_costs = true)::DataFrame
|
||||
longitude = round(location_dict["Longitude (deg)"], digits = 6)
|
||||
amount = location_dict["Amount (tonne)"][year]
|
||||
amount_disposed = location_dict["Dispose (tonne)"][year]
|
||||
acquisition_cost = location_dict["Acquisition cost (\$)"][year]
|
||||
disposal_cost = location_dict["Disposal cost (\$)"][year]
|
||||
push!(
|
||||
df,
|
||||
[
|
||||
@@ -35,6 +39,8 @@ function products_report(solution; marginal_costs = true)::DataFrame
|
||||
amount,
|
||||
marginal_cost,
|
||||
amount_disposed,
|
||||
acquisition_cost,
|
||||
disposal_cost,
|
||||
],
|
||||
)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user