mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Reformat source code
This commit is contained in:
39
test/fixtures/boat_example.jl
vendored
39
test/fixtures/boat_example.jl
vendored
@@ -121,10 +121,8 @@ function run_boat_example()
|
||||
"initial capacity (tonne)" => 0,
|
||||
)
|
||||
|
||||
lat_lon_dict(city_location) = dict(
|
||||
"latitude (deg)" => city_location[1],
|
||||
"longitude (deg)" => city_location[2],
|
||||
)
|
||||
lat_lon_dict(city_location) =
|
||||
dict("latitude (deg)" => city_location[1], "longitude (deg)" => city_location[2])
|
||||
|
||||
data = dict(
|
||||
"parameters" => parameters,
|
||||
@@ -132,36 +130,29 @@ function run_boat_example()
|
||||
dict("Nail" => prod, "Wood" => prod, "NewBoat" => prod, "UsedBoat" => prod),
|
||||
"centers" => merge(
|
||||
dict(
|
||||
"NailFactory ($city_name)" => merge(
|
||||
nail_factory,
|
||||
lat_lon_dict(city_location)
|
||||
) for (city_name, city_location) in cities_b
|
||||
"NailFactory ($city_name)" =>
|
||||
merge(nail_factory, lat_lon_dict(city_location)) for
|
||||
(city_name, city_location) in cities_b
|
||||
),
|
||||
dict(
|
||||
"Forest ($city_name)" => merge(
|
||||
forest,
|
||||
lat_lon_dict(city_location)
|
||||
) for (city_name, city_location) in cities_b
|
||||
"Forest ($city_name)" => merge(forest, lat_lon_dict(city_location))
|
||||
for (city_name, city_location) in cities_b
|
||||
),
|
||||
dict(
|
||||
"Retail ($city_name)" => merge(
|
||||
retail,
|
||||
lat_lon_dict(city_location)
|
||||
) for (city_name, city_location) in cities_a
|
||||
"Retail ($city_name)" => merge(retail, lat_lon_dict(city_location))
|
||||
for (city_name, city_location) in cities_a
|
||||
),
|
||||
),
|
||||
"plants" => merge(
|
||||
dict(
|
||||
"BoatFactory ($city_name)" => merge(
|
||||
boat_factory,
|
||||
lat_lon_dict(city_location)
|
||||
) for (city_name, city_location) in cities_a
|
||||
"BoatFactory ($city_name)" =>
|
||||
merge(boat_factory, lat_lon_dict(city_location)) for
|
||||
(city_name, city_location) in cities_a
|
||||
),
|
||||
dict(
|
||||
"RecyclingPlant ($city_name)" => merge(
|
||||
recycling_plant,
|
||||
lat_lon_dict(city_location)
|
||||
) for (city_name, city_location) in cities_a
|
||||
"RecyclingPlant ($city_name)" =>
|
||||
merge(recycling_plant, lat_lon_dict(city_location)) for
|
||||
(city_name, city_location) in cities_a
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -24,6 +24,7 @@ function runtests()
|
||||
model_dist_test()
|
||||
report_tests()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
function format()
|
||||
|
||||
@@ -6,8 +6,20 @@ using RELOG
|
||||
|
||||
function model_dist_test()
|
||||
# Euclidean distance between Chicago and Indianapolis
|
||||
@test RELOG._calculate_distance(41.866, -87.656, 39.764, -86.148, RELOG.EuclideanDistance()) == 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
|
||||
@test RELOG._calculate_distance(
|
||||
41.866,
|
||||
-87.656,
|
||||
39.764,
|
||||
-86.148,
|
||||
RELOG.KnnDrivingDistance(),
|
||||
) == 316.43
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user