From 046ee52d9d290a9a1551961c9f1743b0e32d719f Mon Sep 17 00:00:00 2001 From: Alinson S Xavier Date: Thu, 25 Jun 2020 16:49:45 -0500 Subject: [PATCH] Update output; fix typo --- instances/solutions/s1.json | 358 +++++++++++++++++++++++------------- instances/solutions/s1.log | 97 +++++----- src/model.jl | 4 +- 3 files changed, 277 insertions(+), 182 deletions(-) diff --git a/instances/solutions/s1.json b/instances/solutions/s1.json index 2f59b6a..12f1988 100644 --- a/instances/solutions/s1.json +++ b/instances/solutions/s1.json @@ -1,20 +1,30 @@ { + "Energy": { + "Plants (GJ)": [ + 568.6368, + 521.2504 + ], + "Transportation (GJ)": [ + 3.120910400232, + 2.860834533546 + ] + }, "Costs": { "Variable operating ($)": [ 216672.818, 216672.818 ], "Transportation ($)": [ - 714499.27483131, - 714499.27483131 + 714499.2748313101, + 714499.2748313101 ], "Disposal ($)": [ -20.0, -20.0 ], "Total ($)": [ - 935782.09283131, - 935396.86883131 + 935782.0928313101, + 935396.8688313101 ], "Fixed operating ($)": [ 130.0, @@ -32,30 +42,34 @@ "Plants": { "F3": { "L5": { - "Output": { - "Send": {}, - "Dispose": {} - }, - "Total input (tonne)": [ - 757.3824000000001, - 757.3824000000001 + "Opening cost ($)": [ + 0.0, + 0.0 ], - "Total output": {}, "Expansion cost ($)": [ 0.0, 0.0 ], + "Longitude (deg)": 100.0, + "Energy (GJ)": [ + 0.0, + 0.0 + ], + "Total output": {}, "Capacity (tonne)": [ 15000.0, 15000.0 ], - "Fixed operating cost ($)": [ - 0.0, - 0.0 - ], - "Longitude (deg)": 100.0, "Latitude (deg)": 100.0, - "Opening cost ($)": [ + "Output": { + "Send": {}, + "Dispose": {} + }, + "Total input (tonne)": [ + 757.3824000000001, + 757.3824000000001 + ], + "Fixed operating cost ($)": [ 0.0, 0.0 ], @@ -67,6 +81,10 @@ 757.3824000000001, 757.3824000000001 ], + "Transportation energy (J)": [ + 0.0, + 0.0 + ], "Transportation cost ($)": [ 116792.36127216002, 116792.36127216002 @@ -84,6 +102,34 @@ }, "F1": { "L1": { + "Opening cost ($)": [ + 500.0, + 0.0 + ], + "Expansion cost ($)": [ + 0.0, + 750.0 + ], + "Longitude (deg)": 0.0, + "Energy (GJ)": [ + 120.0, + 110.0 + ], + "Total output": { + "P2": [ + 200.0, + 200.0 + ], + "P3": [ + 500.0, + 500.0 + ] + }, + "Capacity (tonne)": [ + 1000.0, + 1000.0 + ], + "Latitude (deg)": 0.0, "Output": { "Send": { "P2": { @@ -140,45 +186,25 @@ 1000.0, 1000.0 ], - "Total output": { - "P2": [ - 200.0, - 200.0 - ], - "P3": [ - 500.0, - 500.0 - ] - }, - "Expansion cost ($)": [ - 0.0, - 750.0 - ], - "Capacity (tonne)": [ - 1000.0, - 1000.0 - ], "Fixed operating cost ($)": [ 30.0, 30.0 ], - "Longitude (deg)": 0.0, - "Latitude (deg)": 0.0, - "Opening cost ($)": [ - 500.0, - 0.0 - ], "Input": { "Origin": { "C3": { "Distance (km)": 8889.75, "Amount (tonne)": [ - 212.97000000000003, - 212.97000000000003 + 212.97, + 212.97 + ], + "Transportation energy (J)": [ + 227190.00689999998, + 208257.506325 ], "Transportation cost ($)": [ - 28398.750862500005, - 28398.750862500005 + 28398.7508625, + 28398.7508625 ], "Longitude (deg)": 76.0, "Variable operating cost ($)": [ @@ -190,34 +216,42 @@ "C7": { "Distance (km)": 8526.39, "Amount (tonne)": [ - 246.62, - 246.62 + 246.61999999999998, + 246.61999999999998 + ], + "Transportation energy (J)": [ + 252333.39621599994, + 231305.61319799995 ], "Transportation cost ($)": [ - 31541.674527, - 31541.674527 + 31541.674526999996, + 31541.674526999996 ], "Longitude (deg)": 83.0, "Variable operating cost ($)": [ - 7398.6, - 7398.6 + 7398.599999999999, + 7398.599999999999 ], "Latitude (deg)": 30.0 }, "C5": { "Distance (km)": 9148.52, "Amount (tonne)": [ - 510.3299999999999, - 510.3299999999999 + 510.33, + 510.33 + ], + "Transportation energy (J)": [ + 560251.705392, + 513564.06327600003 ], "Transportation cost ($)": [ - 70031.46317399999, - 70031.46317399999 + 70031.463174, + 70031.463174 ], "Longitude (deg)": 92.0, "Variable operating cost ($)": [ - 15309.899999999998, - 15309.899999999998 + 15309.9, + 15309.9 ], "Latitude (deg)": 32.0 }, @@ -227,6 +261,10 @@ 30.08, 30.08 ], + "Transportation energy (J)": [ + 29603.087615999993, + 27136.163647999994 + ], "Transportation cost ($)": [ 3700.385951999999, 3700.385951999999 @@ -242,6 +280,34 @@ } }, "L2": { + "Opening cost ($)": [ + 1000.0, + 0.0 + ], + "Expansion cost ($)": [ + 0.0, + 3364.776 + ], + "Longitude (deg)": 0.5, + "Energy (GJ)": [ + 448.6368, + 411.2504 + ], + "Total output": { + "P2": [ + 747.7280000000001, + 747.7280000000001 + ], + "P3": [ + 1869.32, + 1869.32 + ] + }, + "Capacity (tonne)": [ + 3738.64, + 3738.64 + ], + "Latitude (deg)": 0.5, "Output": { "Send": { "P2": { @@ -249,8 +315,8 @@ "L4": { "Distance (km)": 43.35, "Amount (tonne)": [ - 747.728, - 747.728 + 747.7280000000001, + 747.7280000000001 ], "Longitude (deg)": 0.2, "Latitude (deg)": 0.75 @@ -277,34 +343,10 @@ 3738.64, 3738.64 ], - "Total output": { - "P2": [ - 747.728, - 747.728 - ], - "P3": [ - 1869.32, - 1869.32 - ] - }, - "Expansion cost ($)": [ - 0.0, - 3364.7759999999994 - ], - "Capacity (tonne)": [ - 3738.6399999999994, - 3738.6399999999994 - ], "Fixed operating cost ($)": [ 50.0, 50.0 ], - "Longitude (deg)": 0.5, - "Latitude (deg)": 0.5, - "Opening cost ($)": [ - 999.9999999999999, - 0.0 - ], "Input": { "Origin": { "C1": { @@ -313,6 +355,10 @@ 934.56, 934.56 ], + "Transportation energy (J)": [ + 114103.047168, + 104594.459904 + ], "Transportation cost ($)": [ 14262.880895999999, 14262.880895999999 @@ -330,6 +376,10 @@ 198.95, 198.95 ], + "Transportation energy (J)": [ + 51698.430779999995, + 47390.228214999996 + ], "Transportation cost ($)": [ 6462.303847499999, 6462.303847499999 @@ -347,6 +397,10 @@ 706.17, 706.17 ], + "Transportation energy (J)": [ + 459386.18243999995, + 421104.00057 + ], "Transportation cost ($)": [ 57423.272805, 57423.272805 @@ -364,6 +418,10 @@ 471.66, 471.66 ], + "Transportation energy (J)": [ + 373301.15558400005, + 342192.72595200007 + ], "Transportation cost ($)": [ 46662.64444800001, 46662.64444800001 @@ -381,6 +439,10 @@ 536.52, 536.52 ], + "Transportation energy (J)": [ + 387204.123312, + 354937.113036 + ], "Transportation cost ($)": [ 48400.515413999994, 48400.515413999994 @@ -398,6 +460,10 @@ 352.19, 352.19 ], + "Transportation energy (J)": [ + 118425.43713599998, + 108556.65070799999 + ], "Transportation cost ($)": [ 14803.179642, 14803.179642 @@ -415,6 +481,10 @@ 538.59, 538.59 ], + "Transportation energy (J)": [ + 547413.827688, + 501796.008714 + ], "Transportation cost ($)": [ 68426.728461, 68426.728461 @@ -432,6 +502,34 @@ }, "F2": { "L4": { + "Opening cost ($)": [ + 3000.0, + 0.0 + ], + "Expansion cost ($)": [ + 0.0, + 0.0 + ], + "Longitude (deg)": 0.2, + "Energy (GJ)": [ + 0.0, + 0.0 + ], + "Total output": { + "P4": [ + 757.3824000000001, + 757.3824000000001 + ], + "P3": [ + 47.336400000000005, + 47.336400000000005 + ] + }, + "Capacity (tonne)": [ + 10000.0, + 10000.0 + ], + "Latitude (deg)": 0.75, "Output": { "Send": { "P4": { @@ -464,37 +562,13 @@ "Dispose": {} }, "Total input (tonne)": [ - 946.728, - 946.728 - ], - "Total output": { - "P4": [ - 757.3824000000001, - 757.3824000000001 - ], - "P3": [ - 47.336400000000005, - 47.336400000000005 - ] - }, - "Expansion cost ($)": [ - 0.0, - 0.0 - ], - "Capacity (tonne)": [ - 10000.0, - 10000.0 + 946.7280000000001, + 946.7280000000001 ], "Fixed operating cost ($)": [ 50.0, 50.0 ], - "Longitude (deg)": 0.2, - "Latitude (deg)": 0.75, - "Opening cost ($)": [ - 2999.9999999999995, - 0.0 - ], "Input": { "F1": { "L1": { @@ -503,6 +577,10 @@ 199.0, 199.0 ], + "Transportation energy (J)": [ + 0.0, + 0.0 + ], "Transportation cost ($)": [ 341.7626, 341.7626 @@ -517,17 +595,21 @@ "L2": { "Distance (km)": 43.35, "Amount (tonne)": [ - 747.728, - 747.728 + 747.7280000000001, + 747.7280000000001 + ], + "Transportation energy (J)": [ + 0.0, + 0.0 ], "Transportation cost ($)": [ - 648.280176, - 648.280176 + 648.2801760000001, + 648.2801760000001 ], "Longitude (deg)": 0.5, "Variable operating cost ($)": [ - 37386.399999999994, - 37386.399999999994 + 37386.4, + 37386.4 ], "Latitude (deg)": 0.5 } @@ -537,30 +619,34 @@ }, "F4": { "L6": { - "Output": { - "Send": {}, - "Dispose": {} - }, - "Total input (tonne)": [ - 2415.6564, - 2415.6564 + "Opening cost ($)": [ + 0.0, + 0.0 ], - "Total output": {}, "Expansion cost ($)": [ 0.0, 0.0 ], + "Longitude (deg)": 50.0, + "Energy (GJ)": [ + 0.0, + 0.0 + ], + "Total output": {}, "Capacity (tonne)": [ 10000.0, 10000.0 ], - "Fixed operating cost ($)": [ - 0.0, - 0.0 - ], - "Longitude (deg)": 50.0, "Latitude (deg)": 50.0, - "Opening cost ($)": [ + "Output": { + "Send": {}, + "Dispose": {} + }, + "Total input (tonne)": [ + 2415.6564, + 2415.6564 + ], + "Fixed operating cost ($)": [ 0.0, 0.0 ], @@ -572,6 +658,10 @@ 499.0, 499.0 ], + "Transportation energy (J)": [ + 0.0, + 0.0 + ], "Transportation cost ($)": [ 42997.644875000005, 42997.644875000005 @@ -589,6 +679,10 @@ 1869.32, 1869.32 ], + "Transportation energy (J)": [ + 0.0, + 0.0 + ], "Transportation cost ($)": [ 159567.258185, 159567.258185 @@ -608,6 +702,10 @@ 47.336400000000005, 47.336400000000005 ], + "Transportation energy (J)": [ + 0.0, + 0.0 + ], "Transportation cost ($)": [ 4038.1676941500004, 4038.1676941500004 diff --git a/instances/solutions/s1.log b/instances/solutions/s1.log index 5204b43..02327c9 100644 --- a/instances/solutions/s1.log +++ b/instances/solutions/s1.log @@ -1,53 +1,50 @@ -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Oct 7 2019 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is 1.86768e+06 - 0.00 seconds -Cgl0003I 7 fixed, 0 tightened bounds, 9 strengthened rows, 0 substitutions -Cgl0003I 0 fixed, 0 tightened bounds, 2 strengthened rows, 0 substitutions -Cgl0003I 0 fixed, 0 tightened bounds, 1 strengthened rows, 0 substitutions -Cgl0004I processed model has 35 rows, 55 columns (9 integer (9 of which binary)) and 211 elements -Cbc0012I Integer solution of 1871179 found by DiveCoefficient after 0 iterations and 0 nodes (0.00 seconds) -Cbc0038I Full problem 35 rows 55 columns, reduced to 18 rows 37 columns -Cbc0006I The LP relaxation is infeasible or too expensive -Cbc0013I At root node, 0 cuts changed objective from 1869627.3 to 1871179 in 1 passes -Cbc0014I Cut generator 0 (Probing) - 0 row cuts average 0.0 elements, 1 column cuts (1 active) in 0.000 seconds - new frequency is 1 -Cbc0014I Cut generator 1 (Gomory) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100 -Cbc0014I Cut generator 2 (Knapsack) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100 -Cbc0014I Cut generator 3 (Clique) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100 -Cbc0014I Cut generator 4 (MixedIntegerRounding2) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100 -Cbc0014I Cut generator 5 (FlowCover) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100 -Cbc0014I Cut generator 6 (TwoMirCuts) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100 -Cbc0014I Cut generator 7 (ZeroHalf) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100 -Cbc0001I Search completed - best objective 1871178.961662621, took 2 iterations and 0 nodes (0.01 seconds) -Cbc0035I Maximum depth 0, 5 variables fixed on reduced cost -Cuts at root node changed objective from 1.86963e+06 to 1.87118e+06 -Probing was tried 1 times and created 1 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: 1871178.96166262 -Enumerated nodes: 0 -Total iterations: 2 -Time (CPU seconds): 0.01 -Time (Wallclock seconds): 0.01 - -Total time (CPU seconds): 0.01 (Wallclock seconds): 0.01 - -Coin0506I Presolve 24 (-100) rows, 38 (-103) columns and 164 (-236) elements -Clp0006I 0 Obj 1590708.5 Primal inf 13041.309 (4) Dual inf 429.24088 (24) -Clp0006I 16 Obj 1871179 -Clp0000I Optimal - objective value 1871179 -Coin0511I After Postsolve, objective 1871179, infeasibilities - dual 0 (0), primal 0 (0) -Clp0032I Optimal objective 1871178.962 - 16 iterations time 0.002, Presolve 0.00 +Gurobi Optimizer version 9.0.0 build v9.0.0rc2 (linux64) +Optimize a model with 124 rows, 141 columns and 400 nonzeros +Model fingerprint: 0x46af87f0 +Variable types: 117 continuous, 24 integer (24 binary) +Coefficient statistics: + Matrix range [5e-02, 2e+04] + Objective range [9e-01, 3e+03] + Bounds range [1e+00, 1e+08] + RHS range [3e+01, 2e+04] +Presolve removed 98 rows and 107 columns +Presolve time: 0.00s +Presolved: 26 rows, 34 columns, 74 nonzeros +Variable types: 28 continuous, 6 integer (6 binary) + +Root relaxation: objective 1.870636e+06, 10 iterations, 0.00 seconds + + Nodes | Current Node | Objective Bounds | Work + Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time + + 0 0 1870636.06 0 2 - 1870636.06 - - 0s +H 0 0 1871178.9617 1870636.06 0.03% - 0s + +Explored 1 nodes (10 simplex iterations) in 0.00 seconds +Thread count was 8 (of 80 available processors) + +Solution count 1: 1.87118e+06 + +Optimal solution found (tolerance 1.00e-02) +Best objective 1.871178961663e+06, best bound 1.870636062997e+06, gap 0.0290% +Gurobi Optimizer version 9.0.0 build v9.0.0rc2 (linux64) +Optimize a model with 124 rows, 141 columns and 400 nonzeros +Model fingerprint: 0x133a97e7 +Coefficient statistics: + Matrix range [5e-02, 2e+04] + Objective range [9e-01, 3e+03] + Bounds range [1e+00, 1e+08] + RHS range [3e+01, 2e+04] +Presolve removed 115 rows and 110 columns +Presolve time: 0.00s +Presolved: 9 rows, 31 columns, 94 nonzeros + +Iteration Objective Primal Inf. Dual Inf. Time + 0 1.0296026e+06 1.950922e+03 0.000000e+00 0s + 7 1.8711790e+06 0.000000e+00 0.000000e+00 0s + +Solved in 7 iterations and 0.00 seconds +Optimal objective 1.871178962e+06 Reading s1.json... Building graph... Building optimization model... diff --git a/src/model.jl b/src/model.jl index a6c31a7..a9b7122 100644 --- a/src/model.jl +++ b/src/model.jl @@ -315,7 +315,7 @@ function get_solution(model::ManufacturingModel) "Longitude (deg)" => a.source.location.longitude, "Transportation cost (\$)" => a.source.product.transportation_cost .* vals .* a.values["distance"], "Variable operating cost (\$)" => plant.sizes[1].variable_operating_cost .* vals, - "Energy (J)" => vals .* a.values["distance"] .* a.source.product.transportation_energy, + "Transportation energy (J)" => vals .* a.values["distance"] .* a.source.product.transportation_energy, ) if a.source.location isa CollectionCenter plant_name = "Origin" @@ -332,7 +332,7 @@ function get_solution(model::ManufacturingModel) plant_dict["Total input (tonne)"] += vals output["Costs"]["Transportation (\$)"] += dict["Transportation cost (\$)"] output["Costs"]["Variable operating (\$)"] += dict["Variable operating cost (\$)"] - output["Energy"]["Transportation (GJ)"] += dict["Energy (J)"] / 1e + output["Energy"]["Transportation (GJ)"] += dict["Transportation energy (J)"] / 1e6 end plant_dict["Energy (GJ)"] = plant_dict["Total input (tonne)"] .* plant.energy