From 237275fc2bed335013397c7946acf09bdf64449c Mon Sep 17 00:00:00 2001 From: Alinson S Xavier Date: Fri, 17 Jul 2020 12:39:41 -0500 Subject: [PATCH] Fix expansion cost breakdown --- CHANGELOG.md | 6 +- Project.toml | 2 +- instances/solutions/s1.json | 116 ++++++++++++++++++------------------ instances/solutions/s1.log | 64 ++++---------------- src/model.jl | 14 +++-- 5 files changed, 83 insertions(+), 119 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e78818a..a4323a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -# Version 0.3 (June 25, 2020) +# Vertion 0.3.1 (July 17, 2020) + +- Fix expansion cost breakdown + +# Version 0.3.0 (June 25, 2020) - Track emissions and energy (transportation and plants) - Minor changes to input file format: diff --git a/Project.toml b/Project.toml index d04bdaf..610b7a3 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RELOG" uuid = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008" authors = ["Alinson S Xavier "] -version = "0.3.0" +version = "0.3.1" [deps] Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76" diff --git a/instances/solutions/s1.json b/instances/solutions/s1.json index 65c506c..5ce9c9d 100644 --- a/instances/solutions/s1.json +++ b/instances/solutions/s1.json @@ -15,16 +15,16 @@ 216672.818 ], "Transportation ($)": [ - 714499.2748313101, - 714499.2748313101 + 714499.27483131, + 714499.27483131 ], "Disposal ($)": [ -20.0, -20.0 ], "Total ($)": [ - 935782.0928313101, - 935396.8688313101 + 939896.86883131, + 931282.09283131 ], "Fixed operating ($)": [ 130.0, @@ -35,8 +35,8 @@ 0.0 ], "Expansion ($)": [ - 0.0, - 4114.776 + 4114.776, + 0.0 ] }, "Plants": { @@ -119,8 +119,8 @@ ] }, "Expansion cost ($)": [ - 0.0, - 750.0 + 750.0, + 0.0 ], "Longitude (deg)": 0.0, "Energy (GJ)": [ @@ -207,16 +207,16 @@ "C3": { "Distance (km)": 8889.75, "Amount (tonne)": [ - 212.97, - 212.97 + 212.97000000000003, + 212.97000000000003 ], "Transportation energy (J)": [ - 227190.00689999998, - 208257.506325 + 227190.00690000004, + 208257.50632500005 ], "Transportation cost ($)": [ - 28398.7508625, - 28398.7508625 + 28398.750862500005, + 28398.750862500005 ], "Longitude (deg)": 76.0, "Variable operating cost ($)": [ @@ -226,74 +226,74 @@ "Latitude (deg)": 84.0, "Emissions (tonne)": { "CH4": [ - 0.63891, - 0.42594 + 0.6389100000000001, + 0.42594000000000004 ], "CO2": [ - 11.07444, - 10.6485 + 11.074440000000001, + 10.648500000000002 ] } }, "C7": { "Distance (km)": 8526.39, "Amount (tonne)": [ - 246.61999999999998, - 246.61999999999998 + 246.62, + 246.62 ], "Transportation energy (J)": [ - 252333.39621599994, - 231305.61319799995 + 252333.396216, + 231305.613198 ], "Transportation cost ($)": [ - 31541.674526999996, - 31541.674526999996 + 31541.674527, + 31541.674527 ], "Longitude (deg)": 83.0, "Variable operating cost ($)": [ - 7398.599999999999, - 7398.599999999999 + 7398.6, + 7398.6 ], "Latitude (deg)": 30.0, "Emissions (tonne)": { "CH4": [ - 0.73986, - 0.49323999999999996 + 0.7398600000000001, + 0.49324 ], "CO2": [ - 12.824239999999998, - 12.331 + 12.82424, + 12.331000000000001 ] } }, "C5": { "Distance (km)": 9148.52, "Amount (tonne)": [ - 510.33, - 510.33 + 510.3299999999999, + 510.3299999999999 ], "Transportation energy (J)": [ - 560251.705392, - 513564.06327600003 + 560251.7053919999, + 513564.0632759999 ], "Transportation cost ($)": [ - 70031.463174, - 70031.463174 + 70031.46317399999, + 70031.46317399999 ], "Longitude (deg)": 92.0, "Variable operating cost ($)": [ - 15309.9, - 15309.9 + 15309.899999999998, + 15309.899999999998 ], "Latitude (deg)": 32.0, "Emissions (tonne)": { "CH4": [ - 1.53099, + 1.5309899999999999, 1.02066 ], "CO2": [ 26.537159999999997, - 25.5165 + 25.516499999999997 ] } }, @@ -333,7 +333,7 @@ }, "L2": { "Opening cost ($)": [ - 1000.0, + 999.9999999999999, 0.0 ], "Emissions (tonne)": { @@ -347,8 +347,8 @@ ] }, "Expansion cost ($)": [ - 0.0, - 3364.776 + 3364.7759999999994, + 0.0 ], "Longitude (deg)": 0.5, "Energy (GJ)": [ @@ -357,8 +357,8 @@ ], "Total output": { "P2": [ - 747.7280000000001, - 747.7280000000001 + 747.728, + 747.728 ], "P3": [ 1869.32, @@ -366,8 +366,8 @@ ] }, "Capacity (tonne)": [ - 3738.64, - 3738.64 + 3738.6399999999994, + 3738.6399999999994 ], "Latitude (deg)": 0.5, "Output": { @@ -377,8 +377,8 @@ "L4": { "Distance (km)": 43.35, "Amount (tonne)": [ - 747.7280000000001, - 747.7280000000001 + 747.728, + 747.728 ], "Longitude (deg)": 0.2, "Latitude (deg)": 0.75 @@ -635,7 +635,7 @@ "F2": { "L4": { "Opening cost ($)": [ - 3000.0, + 2999.9999999999995, 0.0 ], "Emissions (tonne)": {}, @@ -695,8 +695,8 @@ "Dispose": {} }, "Total input (tonne)": [ - 946.7280000000001, - 946.7280000000001 + 946.728, + 946.728 ], "Fixed operating cost ($)": [ 50.0, @@ -729,21 +729,21 @@ "L2": { "Distance (km)": 43.35, "Amount (tonne)": [ - 747.7280000000001, - 747.7280000000001 + 747.728, + 747.728 ], "Transportation energy (J)": [ 0.0, 0.0 ], "Transportation cost ($)": [ - 648.2801760000001, - 648.2801760000001 + 648.280176, + 648.280176 ], "Longitude (deg)": 0.5, "Variable operating cost ($)": [ - 37386.4, - 37386.4 + 37386.399999999994, + 37386.399999999994 ], "Latitude (deg)": 0.5, "Emissions (tonne)": {} diff --git a/instances/solutions/s1.log b/instances/solutions/s1.log index 02327c9..230d5fc 100644 --- a/instances/solutions/s1.log +++ b/instances/solutions/s1.log @@ -1,53 +1,11 @@ -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... -Optimizing MILP... -Re-optimizing with integer variables fixed... -Extracting solution... +[ Info: Reading s1.json... +[ Info: Building graph... +[ Info: 2 time periods +[ Info: 6 process nodes +[ Info: 8 shipping nodes (plant) +[ Info: 10 shipping nodes (collection) +[ Info: 38 arcs +[ Info: Building optimization model... +[ Info: Optimizing MILP... +[ Info: Re-optimizing with integer variables fixed... +[ Info: Extracting solution... diff --git a/src/model.jl b/src/model.jl index 42ffe85..b964aa4 100644 --- a/src/model.jl +++ b/src/model.jl @@ -304,12 +304,14 @@ function get_solution(model::ManufacturingModel) JuMP.value(vars.expansion[process_node, t]) * slope_fix_oper_cost(plant, t) for t in 1:T], - "Expansion cost (\$)" => [JuMP.value(vars.expansion[process_node, t]) * - (if t < T - slope_open(plant, t) - slope_open(plant, t + 1) - else - slope_open(plant, t) - end) + "Expansion cost (\$)" => [(if t == 1 + slope_open(plant, t) * JuMP.value(vars.expansion[process_node, t]) + else + slope_open(plant, t) * ( + JuMP.value(vars.expansion[process_node, t]) - + JuMP.value(vars.expansion[process_node, t - 1]) + ) + end) for t in 1:T], ) output["Costs"]["Fixed operating (\$)"] += plant_dict["Fixed operating cost (\$)"]