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,
|
"initial capacity (tonne)" => 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
lat_lon_dict(city_location) = dict(
|
lat_lon_dict(city_location) =
|
||||||
"latitude (deg)" => city_location[1],
|
dict("latitude (deg)" => city_location[1], "longitude (deg)" => city_location[2])
|
||||||
"longitude (deg)" => city_location[2],
|
|
||||||
)
|
|
||||||
|
|
||||||
data = dict(
|
data = dict(
|
||||||
"parameters" => parameters,
|
"parameters" => parameters,
|
||||||
@@ -132,36 +130,29 @@ function run_boat_example()
|
|||||||
dict("Nail" => prod, "Wood" => prod, "NewBoat" => prod, "UsedBoat" => prod),
|
dict("Nail" => prod, "Wood" => prod, "NewBoat" => prod, "UsedBoat" => prod),
|
||||||
"centers" => merge(
|
"centers" => merge(
|
||||||
dict(
|
dict(
|
||||||
"NailFactory ($city_name)" => merge(
|
"NailFactory ($city_name)" =>
|
||||||
nail_factory,
|
merge(nail_factory, lat_lon_dict(city_location)) for
|
||||||
lat_lon_dict(city_location)
|
(city_name, city_location) in cities_b
|
||||||
) for (city_name, city_location) in cities_b
|
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
"Forest ($city_name)" => merge(
|
"Forest ($city_name)" => merge(forest, lat_lon_dict(city_location))
|
||||||
forest,
|
for (city_name, city_location) in cities_b
|
||||||
lat_lon_dict(city_location)
|
|
||||||
) for (city_name, city_location) in cities_b
|
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
"Retail ($city_name)" => merge(
|
"Retail ($city_name)" => merge(retail, lat_lon_dict(city_location))
|
||||||
retail,
|
for (city_name, city_location) in cities_a
|
||||||
lat_lon_dict(city_location)
|
|
||||||
) for (city_name, city_location) in cities_a
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
"plants" => merge(
|
"plants" => merge(
|
||||||
dict(
|
dict(
|
||||||
"BoatFactory ($city_name)" => merge(
|
"BoatFactory ($city_name)" =>
|
||||||
boat_factory,
|
merge(boat_factory, lat_lon_dict(city_location)) for
|
||||||
lat_lon_dict(city_location)
|
(city_name, city_location) in cities_a
|
||||||
) for (city_name, city_location) in cities_a
|
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
"RecyclingPlant ($city_name)" => merge(
|
"RecyclingPlant ($city_name)" =>
|
||||||
recycling_plant,
|
merge(recycling_plant, lat_lon_dict(city_location)) for
|
||||||
lat_lon_dict(city_location)
|
(city_name, city_location) in cities_a
|
||||||
) for (city_name, city_location) in cities_a
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ function runtests()
|
|||||||
model_dist_test()
|
model_dist_test()
|
||||||
report_tests()
|
report_tests()
|
||||||
end
|
end
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
function format()
|
function format()
|
||||||
|
|||||||
@@ -6,8 +6,20 @@ using RELOG
|
|||||||
|
|
||||||
function model_dist_test()
|
function model_dist_test()
|
||||||
# Euclidean distance between Chicago and Indianapolis
|
# 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
|
# 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
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user