@ -76,14 +76,14 @@ function parse(json)::Instance
prod_centers = [ ]
prod_centers = [ ]
product = Product (
product = Product (
product_name ,
acquisition_cost = acquisition_cost ,
co st,
co llection_center s = prod_cen ters ,
energy ,
disposal_cost = disposal_cost ,
emissions ,
disposal_limit = disposal_limit ,
disposal_limit ,
name = product_name ,
disposal_ cost,
transportation_cost = cost,
acquisition_cost ,
transportation_emissions = emissions ,
prod_centers ,
transportation_energy = energy ,
)
)
push! ( products , product )
push! ( products , product )
prod_name_to_product [ product_name ] = product
prod_name_to_product [ product_name ] = product
@ -97,12 +97,12 @@ function parse(json)::Instance
center_dict [ " longitude (deg) " ] = region . centroid . lon
center_dict [ " longitude (deg) " ] = region . centroid . lon
end
end
center = CollectionCenter (
center = CollectionCenter (
length( collection_centers ) + 1 ,
amount = center_dict [ " amount (tonne) " ] ,
center_name ,
index = length ( collection_centers ) + 1 ,
center_dict[ " latitude (deg) " ] ,
latitude = center_dict[ " latitude (deg) " ] ,
center_dict[ " longitude (deg) " ] ,
longitude = center_dict[ " longitude (deg) " ] ,
product ,
name = center_name ,
center_dict[ " amount (tonne) " ] ,
product = product ,
)
)
push! ( prod_centers , center )
push! ( prod_centers , center )
push! ( collection_centers , center )
push! ( collection_centers , center )
@ -164,16 +164,22 @@ function parse(json)::Instance
push! (
push! (
sizes ,
sizes ,
PlantSize (
PlantSize (
Base. parse ( Float64 , capacity_name ) ,
capacity = Base. parse ( Float64 , capacity_name ) ,
capacity_dict[ " variable operating cost (\$ /tonne )" ] ,
fixed_operating_cost = capacity_dict[ " fixed operating cost (\$ )" ] ,
capacity_dict[ " fixed operat ing cost (\$ ) " ] ,
opening_cost = capacity_dict[ " open ing cost (\$ ) " ] ,
capacity_dict[ " opening cost (\$ )" ] ,
variable_operating_cost = capacity_dict[ " variable operating cost (\$ /tonne )" ] ,
) ,
) ,
)
)
end
end
length ( sizes ) > 1 || push! ( sizes , sizes [ 1 ] )
length ( sizes ) > 1 || push! ( sizes , sizes [ 1 ] )
sort! ( sizes , by = x -> x . capacity )
sort! ( sizes , by = x -> x . capacity )
# Initial capacity
initial_capacity = 0
if " initial capacity (tonne) " in keys ( location_dict )
initial_capacity = location_dict [ " initial capacity (tonne) " ]
end
# Storage
# Storage
storage_limit = 0
storage_limit = 0
storage_cost = zeros ( T )
storage_cost = zeros ( T )
@ -192,20 +198,21 @@ function parse(json)::Instance
end
end
plant = Plant (
plant = Plant (
length ( plants ) + 1 ,
disposal_cost = disposal_cost ,
plant_name ,
disposal_limit = disposal_limit ,
location_name ,
emissions = emissions ,
input ,
energy = energy ,
output ,
index = length ( plants ) + 1 ,
location_dict [ " latitude (deg) " ] ,
initial_capacity = initial_capacity ,
location_dict [ " longitude (deg) " ] ,
input = input ,
disposal_limit ,
latitude = location_dict [ " latitude (deg) " ] ,
disposal_cost ,
location_name = location_name ,
sizes ,
longitude = location_dict [ " longitude (deg) " ] ,
energy ,
output = output ,
emissions ,
plant_name = plant_name ,
storage_limit ,
sizes = sizes ,
storage_cost ,
storage_cost = storage_cost ,
storage_limit = storage_limit ,
)
)
push! ( plants , plant )
push! ( plants , plant )
@ -216,11 +223,11 @@ function parse(json)::Instance
@info @sprintf ( " %12d candidate plant locations " , length ( plants ) )
@info @sprintf ( " %12d candidate plant locations " , length ( plants ) )
return Instance (
return Instance (
T,
time = T,
products ,
products = products ,
collection_centers ,
collection_centers = collection_centers ,
plants ,
plants = plants ,
building_period ,
building_period = building_period ,
distance_metric ,
distance_metric = distance_metric ,
)
)
end
end