Make distance metric configurable; fix building period bug

This commit is contained in:
2022-12-15 10:21:21 -06:00
parent 48bd3c403f
commit 841fbf16fb
9 changed files with 55 additions and 27 deletions

View File

@@ -40,7 +40,6 @@ function build_graph(instance::Instance)::Graph
end
# Build arcs from collection centers to plants, and from one plant to another
metric = _KnnDrivingDistance()
for source in [collection_shipping_nodes; plant_shipping_nodes]
for dest in process_nodes_by_input_product[source.product]
distance = _calculate_distance(
@@ -48,7 +47,7 @@ function build_graph(instance::Instance)::Graph
source.location.longitude,
dest.location.latitude,
dest.location.longitude,
metric,
instance.distance_metric,
)
values = Dict("distance" => distance)
arc = Arc(source, dest, values)