mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Implement global disposal limits
This commit is contained in:
1
test/fixtures/boat_example.jl
vendored
1
test/fixtures/boat_example.jl
vendored
@@ -69,6 +69,7 @@ function run_boat_example()
|
||||
"transportation cost (\$/km/tonne)" => 0.30,
|
||||
"transportation energy (J/km/tonne)" => 7_500,
|
||||
"transportation emissions (tonne/km/tonne)" => dict("CO2" => 2.68),
|
||||
"disposal limit (tonne)" => nothing,
|
||||
)
|
||||
|
||||
boat_factory = dict(
|
||||
|
||||
12
test/fixtures/boat_example.json
vendored
12
test/fixtures/boat_example.json
vendored
@@ -12,28 +12,32 @@
|
||||
"transportation energy (J/km/tonne)": 7500,
|
||||
"transportation emissions (tonne/km/tonne)": {
|
||||
"CO2": 2.68
|
||||
}
|
||||
},
|
||||
"disposal limit (tonne)": null
|
||||
},
|
||||
"Wood": {
|
||||
"transportation cost ($/km/tonne)": 0.3,
|
||||
"transportation energy (J/km/tonne)": 7500,
|
||||
"transportation emissions (tonne/km/tonne)": {
|
||||
"CO2": 2.68
|
||||
}
|
||||
},
|
||||
"disposal limit (tonne)": null
|
||||
},
|
||||
"NewBoat": {
|
||||
"transportation cost ($/km/tonne)": 0.3,
|
||||
"transportation energy (J/km/tonne)": 7500,
|
||||
"transportation emissions (tonne/km/tonne)": {
|
||||
"CO2": 2.68
|
||||
}
|
||||
},
|
||||
"disposal limit (tonne)": null
|
||||
},
|
||||
"UsedBoat": {
|
||||
"transportation cost ($/km/tonne)": 0.3,
|
||||
"transportation energy (J/km/tonne)": 7500,
|
||||
"transportation emissions (tonne/km/tonne)": {
|
||||
"CO2": 2.68
|
||||
}
|
||||
},
|
||||
"disposal limit (tonne)": null
|
||||
}
|
||||
},
|
||||
"centers": {
|
||||
|
||||
18
test/fixtures/boat_example/center_outputs.csv
vendored
18
test/fixtures/boat_example/center_outputs.csv
vendored
@@ -1,7 +1,7 @@
|
||||
center,output product,year,amount collected (tonne),amount disposed (tonne),collection cost ($),disposal cost ($)
|
||||
NailFactory (Chicago),Nail,1,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Chicago),Nail,2,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Chicago),Nail,3,1.0,-0.0,1000.0,-0.0
|
||||
NailFactory (Chicago),Nail,3,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Chicago),Nail,4,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Chicago),Nail,5,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Phoenix),Nail,1,1.0,0.0,1000.0,0.0
|
||||
@@ -9,11 +9,11 @@ NailFactory (Phoenix),Nail,2,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Phoenix),Nail,3,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Phoenix),Nail,4,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Phoenix),Nail,5,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Dallas),Nail,1,1.0,-0.0,1000.0,-0.0
|
||||
NailFactory (Dallas),Nail,1,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Dallas),Nail,2,1.0,-0.0,1000.0,-0.0
|
||||
NailFactory (Dallas),Nail,3,1.0,-0.0,1000.0,-0.0
|
||||
NailFactory (Dallas),Nail,4,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Dallas),Nail,5,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Dallas),Nail,3,1.0,0.0,1000.0,0.0
|
||||
NailFactory (Dallas),Nail,4,1.0,-0.0,1000.0,-0.0
|
||||
NailFactory (Dallas),Nail,5,1.0,-0.0,1000.0,-0.0
|
||||
Forest (Chicago),Wood,1,100.0,100.0,0.0,0.0
|
||||
Forest (Chicago),Wood,2,100.0,100.0,0.0,0.0
|
||||
Forest (Chicago),Wood,3,100.0,100.0,0.0,0.0
|
||||
@@ -43,17 +43,17 @@ Retail (Los Angeles),UsedBoat,1,0.0,0.0,0.0,0.0
|
||||
Retail (Los Angeles),UsedBoat,2,0.0,0.0,0.0,0.0
|
||||
Retail (Los Angeles),UsedBoat,3,0.0,0.0,0.0,0.0
|
||||
Retail (Los Angeles),UsedBoat,4,0.0,0.0,0.0,0.0
|
||||
Retail (Los Angeles),UsedBoat,5,0.0,0.0,0.0,0.0
|
||||
Retail (Los Angeles),UsedBoat,5,-0.0,0.0,-0.0,0.0
|
||||
Retail (Houston),UsedBoat,1,0.0,0.0,0.0,0.0
|
||||
Retail (Houston),UsedBoat,2,0.0,0.0,0.0,0.0
|
||||
Retail (Houston),UsedBoat,3,0.0,0.0,0.0,0.0
|
||||
Retail (Houston),UsedBoat,4,0.0,0.0,0.0,0.0
|
||||
Retail (Houston),UsedBoat,5,0.0,0.0,0.0,0.0
|
||||
Retail (Houston),UsedBoat,5,-0.0,0.0,-0.0,0.0
|
||||
Retail (Phoenix),UsedBoat,1,0.0,0.0,0.0,0.0
|
||||
Retail (Phoenix),UsedBoat,2,0.0,0.0,0.0,0.0
|
||||
Retail (Phoenix),UsedBoat,3,0.0,0.0,0.0,0.0
|
||||
Retail (Phoenix),UsedBoat,4,0.0,0.0,0.0,0.0
|
||||
Retail (Phoenix),UsedBoat,5,0.0,0.0,0.0,0.0
|
||||
Retail (Phoenix),UsedBoat,4,-0.0,0.0,-0.0,0.0
|
||||
Retail (Phoenix),UsedBoat,5,-0.0,0.0,-0.0,0.0
|
||||
Retail (Philadelphia),UsedBoat,1,0.0,0.0,0.0,0.0
|
||||
Retail (Philadelphia),UsedBoat,2,0.0,0.0,0.0,0.0
|
||||
Retail (Philadelphia),UsedBoat,3,0.0,0.0,0.0,0.0
|
||||
|
||||
|
6
test/fixtures/boat_example/centers.csv
vendored
6
test/fixtures/boat_example/centers.csv
vendored
@@ -43,16 +43,16 @@ Retail (Los Angeles),1,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Los Angeles),2,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Los Angeles),3,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Los Angeles),4,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Los Angeles),5,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Los Angeles),5,NewBoat,-0.0,0.0,125000.0
|
||||
Retail (Houston),1,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Houston),2,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Houston),3,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Houston),4,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Houston),5,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Houston),5,NewBoat,-0.0,0.0,125000.0
|
||||
Retail (Phoenix),1,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Phoenix),2,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Phoenix),3,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Phoenix),4,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Phoenix),4,NewBoat,-0.0,-0.0,125000.0
|
||||
Retail (Phoenix),5,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Philadelphia),1,NewBoat,0.0,0.0,125000.0
|
||||
Retail (Philadelphia),2,NewBoat,0.0,0.0,125000.0
|
||||
|
||||
|
4
test/fixtures/boat_example/plant_outputs.csv
vendored
4
test/fixtures/boat_example/plant_outputs.csv
vendored
@@ -50,12 +50,12 @@ BoatFactory (San Jose),NewBoat,3,0.0,0.0,0.0
|
||||
BoatFactory (San Jose),NewBoat,4,0.0,0.0,0.0
|
||||
BoatFactory (San Jose),NewBoat,5,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Nail,1,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Nail,2,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Nail,2,-0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Nail,3,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Nail,4,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Nail,5,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Wood,1,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Wood,2,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Wood,2,-0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Wood,3,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Wood,4,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),Wood,5,0.0,0.0,0.0
|
||||
|
||||
|
50
test/fixtures/boat_example/plants.csv
vendored
50
test/fixtures/boat_example/plants.csv
vendored
@@ -1,39 +1,39 @@
|
||||
plant,year,operational?,input amount (tonne),opening cost ($),fixed operating cost ($),variable operating cost ($)
|
||||
BoatFactory (Chicago),1,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Chicago),2,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Chicago),3,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Chicago),4,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Chicago),5,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Chicago),1,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Chicago),2,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Chicago),3,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Chicago),4,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Chicago),5,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (New York City),1,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (New York City),2,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (New York City),3,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (New York City),4,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (New York City),5,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Los Angeles),1,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Los Angeles),2,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Los Angeles),3,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Los Angeles),4,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Los Angeles),5,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Houston),1,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Houston),2,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Houston),3,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Houston),4,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Houston),5,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Phoenix),1,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Phoenix),2,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Los Angeles),1,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Los Angeles),2,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Los Angeles),3,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Los Angeles),4,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Los Angeles),5,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Houston),1,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Houston),2,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Houston),3,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Houston),4,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Houston),5,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Phoenix),1,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Phoenix),2,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Phoenix),3,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Phoenix),4,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (Phoenix),4,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Phoenix),5,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Philadelphia),1,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Philadelphia),2,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Philadelphia),3,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Philadelphia),4,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (Philadelphia),5,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Antonio),1,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (San Antonio),2,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (San Antonio),3,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (San Antonio),4,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (San Antonio),5,false,-0.0,0.0,0.0,-0.0
|
||||
BoatFactory (San Antonio),1,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Antonio),2,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Antonio),3,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Antonio),4,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Antonio),5,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Diego),1,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Diego),2,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Diego),3,false,0.0,0.0,0.0,0.0
|
||||
@@ -50,7 +50,7 @@ BoatFactory (San Jose),3,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Jose),4,false,0.0,0.0,0.0,0.0
|
||||
BoatFactory (San Jose),5,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),1,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),2,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),2,false,-0.0,0.0,0.0,-0.0
|
||||
RecyclingPlant (Chicago),3,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),4,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Chicago),5,false,0.0,0.0,0.0,0.0
|
||||
@@ -71,7 +71,7 @@ RecyclingPlant (Houston),4,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Houston),5,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Phoenix),1,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Phoenix),2,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Phoenix),3,false,-0.0,0.0,0.0,-0.0
|
||||
RecyclingPlant (Phoenix),3,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Phoenix),4,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Phoenix),5,false,0.0,0.0,0.0,0.0
|
||||
RecyclingPlant (Philadelphia),1,false,0.0,0.0,0.0,0.0
|
||||
|
||||
|
12
test/fixtures/simple.json
vendored
12
test/fixtures/simple.json
vendored
@@ -11,7 +11,8 @@
|
||||
"transportation emissions (tonne/km/tonne)": {
|
||||
"CO2": 0.052,
|
||||
"CH4": [0.003, 0.003, 0.003, 0.003]
|
||||
}
|
||||
},
|
||||
"disposal limit (tonne)": 1.0
|
||||
},
|
||||
"P2": {
|
||||
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
|
||||
@@ -19,7 +20,8 @@
|
||||
"transportation emissions (tonne/km/tonne)": {
|
||||
"CO2": [0.052, 0.052, 0.052, 0.052],
|
||||
"CH4": [0.003, 0.003, 0.003, 0.003]
|
||||
}
|
||||
},
|
||||
"disposal limit (tonne)": 2.0
|
||||
},
|
||||
"P3": {
|
||||
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
|
||||
@@ -27,7 +29,8 @@
|
||||
"transportation emissions (tonne/km/tonne)": {
|
||||
"CO2": [0.052, 0.052, 0.052, 0.052],
|
||||
"CH4": [0.003, 0.003, 0.003, 0.003]
|
||||
}
|
||||
},
|
||||
"disposal limit (tonne)": 5.0
|
||||
},
|
||||
"P4": {
|
||||
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
|
||||
@@ -35,7 +38,8 @@
|
||||
"transportation emissions (tonne/km/tonne)": {
|
||||
"CO2": [0.052, 0.052, 0.052, 0.052],
|
||||
"CH4": [0.003, 0.003, 0.003, 0.003]
|
||||
}
|
||||
},
|
||||
"disposal limit (tonne)": null
|
||||
}
|
||||
},
|
||||
"centers": {
|
||||
|
||||
@@ -18,6 +18,7 @@ function instance_parse_test_1()
|
||||
@test p1.tr_energy == [0.12, 0.12, 0.12, 0.12]
|
||||
@test p1.tr_emissions ==
|
||||
Dict("CO2" => [0.052, 0.052, 0.052, 0.052], "CH4" => [0.003, 0.003, 0.003, 0.003])
|
||||
@test p1.disposal_limit == [1.0, 1.0, 1.0, 1.0]
|
||||
@test instance.products_by_name["P1"] === p1
|
||||
p2 = instance.products[2]
|
||||
p3 = instance.products[3]
|
||||
|
||||
@@ -109,4 +109,13 @@ function model_build_test()
|
||||
@test repr(model[:eq_disposal_limit]["C1", "P2", 1]) ==
|
||||
"eq_disposal_limit[C1,P2,1] : z_disp[C1,P2,1] ≤ 0"
|
||||
@test ("C1", "P3", 1) ∉ keys(model[:eq_disposal_limit])
|
||||
|
||||
# Global disposal limit
|
||||
@test repr(model[:eq_disposal_limit]["P1", 1]) ==
|
||||
"eq_disposal_limit[P1,1] : z_disp[C2,P1,1] ≤ 1"
|
||||
@test repr(model[:eq_disposal_limit]["P2", 1]) ==
|
||||
"eq_disposal_limit[P2,1] : z_disp[C1,P2,1] ≤ 2"
|
||||
@test repr(model[:eq_disposal_limit]["P3", 1]) ==
|
||||
"eq_disposal_limit[P3,1] : z_disp[L1,P3,1] + z_disp[C1,P3,1] ≤ 5"
|
||||
@test ("P4", 1) ∉ keys(model[:eq_disposal_limit])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user