mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-06 07:48:50 -06:00
Implement basic reports; fix boat example
This commit is contained in:
@@ -7,6 +7,7 @@ using JuliaFormatter
|
||||
include("instance/parse_test.jl")
|
||||
include("model/build_test.jl")
|
||||
include("model/dist_test.jl")
|
||||
include("reports_test.jl")
|
||||
|
||||
basedir = dirname(@__FILE__)
|
||||
|
||||
@@ -18,9 +19,9 @@ function runtests()
|
||||
@testset "RELOG" begin
|
||||
instance_parse_test_1()
|
||||
instance_parse_test_2()
|
||||
model_build_test_1()
|
||||
model_build_test_2()
|
||||
model_build_test()
|
||||
model_dist_test()
|
||||
report_tests()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using Test
|
||||
using HiGHS
|
||||
using JuMP
|
||||
|
||||
function model_build_test_1()
|
||||
function model_build_test()
|
||||
instance = RELOG.parsefile(fixture("simple.json"))
|
||||
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
|
||||
y = model[:y]
|
||||
@@ -110,10 +110,3 @@ function model_build_test_1()
|
||||
"eq_disposal_limit[C1,P2,1] : z_disp[C1,P2,1] ≤ 0"
|
||||
@test ("C1", "P3", 1) ∉ keys(model[:eq_disposal_limit])
|
||||
end
|
||||
|
||||
|
||||
function model_build_test_2()
|
||||
instance = RELOG.parsefile(fixture("boat_example.json"))
|
||||
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer)
|
||||
optimize!(model)
|
||||
end
|
||||
|
||||
12
test/src/reports_test.jl
Normal file
12
test/src/reports_test.jl
Normal file
@@ -0,0 +1,12 @@
|
||||
function report_tests()
|
||||
# Load and solve the boat example
|
||||
instance = RELOG.parsefile(fixture("boat_example.json"))
|
||||
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
|
||||
optimize!(model)
|
||||
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")
|
||||
RELOG.write_centers_report(model, "tmp/centers.csv")
|
||||
RELOG.write_center_outputs_report(model, "tmp/center_outputs.csv")
|
||||
RELOG.write_transportation_report(model, "tmp/transportation.csv")
|
||||
end
|
||||
Reference in New Issue
Block a user