Skip to content

Commit

Permalink
Make boat example easier to run; add output
Browse files Browse the repository at this point in the history
  • Loading branch information
iSoron committed Dec 8, 2023
1 parent 6dae3a8 commit f82a1d1
Show file tree
Hide file tree
Showing 7 changed files with 498 additions and 26 deletions.
17 changes: 17 additions & 0 deletions test/fixtures/boat_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,24 @@ function run_boat_example()
),
)

# Generate instance file
open(fixture("boat_example.json"), "w") do file
JSON.print(file, data, 2)
end

# Load and solve example
instance = RELOG.parsefile(fixture("boat_example.json"))
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
optimize!(model)

# Write reports
mkpath(fixture("boat_example"))
write_to_file(model, fixture("boat_example/model.lp"))
RELOG.write_plants_report(model, fixture("boat_example/plants.csv"))
RELOG.write_plant_outputs_report(model, fixture("boat_example/plant_outputs.csv"))
RELOG.write_centers_report(model, fixture("boat_example/centers.csv"))
RELOG.write_center_outputs_report(model, fixture("boat_example/center_outputs.csv"))
RELOG.write_transportation_report(model, fixture("boat_example/transportation.csv"))

return
end
52 changes: 26 additions & 26 deletions test/fixtures/boat_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"Nail"
],
"fixed output (tonne)": {
"Nail": 5
"Nail": 1
},
"variable output (tonne/tonne)": {
"Nail": 0
Expand All @@ -68,7 +68,7 @@
"Nail"
],
"fixed output (tonne)": {
"Nail": 5
"Nail": 1
},
"variable output (tonne/tonne)": {
"Nail": 0
Expand All @@ -93,7 +93,7 @@
"Nail"
],
"fixed output (tonne)": {
"Nail": 5
"Nail": 1
},
"variable output (tonne/tonne)": {
"Nail": 0
Expand All @@ -118,7 +118,7 @@
"Wood"
],
"fixed output (tonne)": {
"Wood": 95
"Wood": 100
},
"variable output (tonne/tonne)": {
"Wood": 0
Expand All @@ -143,7 +143,7 @@
"Wood"
],
"fixed output (tonne)": {
"Wood": 95
"Wood": 100
},
"variable output (tonne/tonne)": {
"Wood": 0
Expand All @@ -168,7 +168,7 @@
"Wood"
],
"fixed output (tonne)": {
"Wood": 95
"Wood": 100
},
"variable output (tonne/tonne)": {
"Wood": 0
Expand Down Expand Up @@ -208,7 +208,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -237,7 +237,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -266,7 +266,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -295,7 +295,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -324,7 +324,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -353,7 +353,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -382,7 +382,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -411,7 +411,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -440,7 +440,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -469,7 +469,7 @@
},
"operating cost ($)": 125000,
"disposal limit (tonne)": {
"UsedBoat": null
"UsedBoat": 0
},
"disposal cost ($/tonne)": {
"UsedBoat": 0
Expand Down Expand Up @@ -507,7 +507,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -550,7 +550,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -593,7 +593,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -636,7 +636,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -679,7 +679,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -722,7 +722,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -765,7 +765,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -808,7 +808,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -851,7 +851,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down Expand Up @@ -894,7 +894,7 @@
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 1000000,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
Expand Down
81 changes: 81 additions & 0 deletions test/fixtures/boat_example/center_outputs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
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,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
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,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
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
Forest (Chicago),Wood,4,100.0,100.0,0.0,0.0
Forest (Chicago),Wood,5,100.0,100.0,0.0,0.0
Forest (Phoenix),Wood,1,100.0,100.0,0.0,0.0
Forest (Phoenix),Wood,2,100.0,100.0,0.0,0.0
Forest (Phoenix),Wood,3,100.0,100.0,0.0,0.0
Forest (Phoenix),Wood,4,100.0,100.0,0.0,0.0
Forest (Phoenix),Wood,5,100.0,100.0,0.0,0.0
Forest (Dallas),Wood,1,100.0,43.0,14250.0,0.0
Forest (Dallas),Wood,2,100.0,43.0,14250.0,0.0
Forest (Dallas),Wood,3,100.0,43.0,14250.0,0.0
Forest (Dallas),Wood,4,100.0,43.0,14250.0,0.0
Forest (Dallas),Wood,5,100.0,43.0,14250.0,0.0
Retail (Chicago),UsedBoat,1,0.0,0.0,0.0,0.0
Retail (Chicago),UsedBoat,2,0.0,0.0,0.0,0.0
Retail (Chicago),UsedBoat,3,0.0,0.0,0.0,0.0
Retail (Chicago),UsedBoat,4,0.0,0.0,0.0,0.0
Retail (Chicago),UsedBoat,5,0.0,0.0,0.0,0.0
Retail (New York City),UsedBoat,1,0.0,0.0,0.0,0.0
Retail (New York City),UsedBoat,2,0.0,0.0,0.0,0.0
Retail (New York City),UsedBoat,3,0.0,0.0,0.0,0.0
Retail (New York City),UsedBoat,4,0.0,0.0,0.0,0.0
Retail (New York City),UsedBoat,5,0.0,0.0,0.0,0.0
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 (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 (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 (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
Retail (Philadelphia),UsedBoat,4,0.0,0.0,0.0,0.0
Retail (Philadelphia),UsedBoat,5,0.0,0.0,0.0,0.0
Retail (San Antonio),UsedBoat,1,0.0,0.0,0.0,0.0
Retail (San Antonio),UsedBoat,2,0.0,0.0,0.0,0.0
Retail (San Antonio),UsedBoat,3,0.0,0.0,0.0,0.0
Retail (San Antonio),UsedBoat,4,0.0,0.0,0.0,0.0
Retail (San Antonio),UsedBoat,5,0.0,0.0,0.0,0.0
Retail (San Diego),UsedBoat,1,0.0,0.0,0.0,0.0
Retail (San Diego),UsedBoat,2,0.0,0.0,0.0,0.0
Retail (San Diego),UsedBoat,3,0.0,0.0,0.0,0.0
Retail (San Diego),UsedBoat,4,0.0,0.0,0.0,0.0
Retail (San Diego),UsedBoat,5,0.0,0.0,0.0,0.0
Retail (Dallas),UsedBoat,1,6.31579,0.0,631.57895,0.0
Retail (Dallas),UsedBoat,2,22.93629,0.0,2293.62881,0.0
Retail (Dallas),UsedBoat,3,31.7714,0.0,3177.13952,0.0
Retail (Dallas),UsedBoat,4,33.80867,0.0,3380.86724,0.0
Retail (Dallas),UsedBoat,5,34.54174,0.0,3454.17409,0.0
Retail (San Jose),UsedBoat,1,0.0,0.0,0.0,0.0
Retail (San Jose),UsedBoat,2,0.0,0.0,0.0,0.0
Retail (San Jose),UsedBoat,3,0.0,0.0,0.0,0.0
Retail (San Jose),UsedBoat,4,0.0,0.0,0.0,0.0
Retail (San Jose),UsedBoat,5,0.0,0.0,0.0,0.0
Loading

0 comments on commit f82a1d1

Please sign in to comment.