mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Circular: Implement driving distances
This commit is contained in:
2
test/fixtures/simple.json
vendored
2
test/fixtures/simple.json
vendored
@@ -2,7 +2,7 @@
|
||||
"parameters": {
|
||||
"time horizon (years)": 4,
|
||||
"building period (years)": [1],
|
||||
"distance metric": "driving"
|
||||
"distance metric": "euclidean"
|
||||
},
|
||||
"products": {
|
||||
"P1": {
|
||||
|
||||
@@ -8,7 +8,7 @@ function instance_parse_test_1()
|
||||
# Parameters
|
||||
@test instance.time_horizon == 4
|
||||
@test instance.building_period == [1]
|
||||
@test instance.distance_metric == "driving"
|
||||
@test instance.distance_metric isa RELOG.EuclideanDistance
|
||||
|
||||
# Products
|
||||
@test length(instance.products) == 4
|
||||
|
||||
@@ -6,5 +6,8 @@ using RELOG
|
||||
|
||||
function model_dist_test()
|
||||
# Euclidean distance between Chicago and Indianapolis
|
||||
@test RELOG._calculate_distance(41.866, -87.656, 39.764, -86.148) == 265.818
|
||||
@test RELOG._calculate_distance(41.866, -87.656, 39.764, -86.148, RELOG.EuclideanDistance()) == 265.818
|
||||
|
||||
# Driving distance between Chicago and Indianapolis
|
||||
@test RELOG._calculate_distance(41.866, -87.656, 39.764, -86.148, RELOG.KnnDrivingDistance()) == 316.43
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ function report_tests()
|
||||
instance = RELOG.parsefile(fixture("boat_example.json"))
|
||||
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
|
||||
optimize!(model)
|
||||
mkpath("tmp")
|
||||
write_to_file(model, "tmp/model.lp")
|
||||
RELOG.write_plants_report(model, "tmp/plants.csv")
|
||||
RELOG.write_plant_outputs_report(model, "tmp/plant_outputs.csv")
|
||||
|
||||
Reference in New Issue
Block a user