class: center, middle .title[Mixed Integer Programming and Waste Management]
.subtitle[BEE 4750/5750]
.subtitle[Environmental Systems Analysis, Fall 2022]
.author[Vivek Srikrishnan]
.date[October 17, 2022] --- name: toc class: left # Outline
1. Mixed Integer Programming for Operational Decisions 2. Waste Management: Netowrk \& Transport Modeling 3. Solving our Waste Management Example --- name: poll-answer layout: true class: left # Poll
.left-column[{{content}} URL: [https://pollev.com/vsrikrish](https://pollev.com/vsrikrish) Text: **VSRIKRISH** to 22333, then message] .right-column[.center[]] --- name: questions template: poll-answer ***Any questions?*** --- layout: false # Last Class
* Economic Dispatch Examples --- class: left # Decision-Making About Operational Status
Last class, we discussed economic dispatch, which assumed we had already decided which generating plants are online. But what if we need to make that decision? Or what if we have a fleet of treatment facilities, some of which might be operated at a given time? --- class: left # Decision-Making About Operational Status
Last class, we discussed economic dispatch, which assumed we had already decided which generating plants are online. But what if we need to make that decision? Or what if we have a fleet of treatment facilities, some of which might be operated at a given time? --- class: left # Fixed Costs
A key consideration when deciding whether to operate *something* is fixed costs. Costs can be (roughly) broken down into two categories: * **Fixed costs**: Labor, etc, required to operate or produce regardless of quantity. * **Variable costs**: Costs of inputs (energy, additional labor, materials) required to operate or produce per unit of time/quantity. --- class: left # Fixed Costs
The existence of fixed costs creates a discontinuous cost function. .center[] --- class: left # Discontinuous Objectives: No More LP
A discontinuous cost function is one way to violate the principles of linear programming! This might mean a discontinuous objective, *particularly* if higher average costs mean that it is less cost-effective to operate minimally than to not operate and find another option. --- class: left # Indicator Variables and Constraints
The potential decision to not operate means that we need to introduce new *indicator* variables, which flag on/off status. These variables are binary, and hence not continuous! For an example, let's consider **waste allocation** problems. --- class: left # Waste Load Allocation
.left-column[ Many options exist for waste management, of varying levels of desirability. Some relevant questions: * Where do we send waste? * What types of facilities do we build/operate? ] .right-column[.center[  .cite[Source: [EPA](https://www.epa.gov/homeland-security-waste/waste-management-options-homeland-security-incidents)] ]] --- class: left # Waste Load Allocation
Notice that this type of allocation problem is not specific to garbage: those key questions are applicable to all supply chain problems. --- class: left # Waste Load Allocation as a Network Problem
Think in terms of flows between sources and sinks! .center[] --- class: left # Parameterizing the Network Representation
.left-column[  ] .right-column[ | Variable | Definition | |:--------------------:|:---------------------------------------------------------- | | $\color{purple}S_i$ | Waste produced at source $i$ (Mg/day) | | $\color{red}K_j$ | Capacity of disposal $j$ (Mg/day) | | $\color{blue}W_{ij}$ | Waste transported from source $i$ to disposal $j$ (Mg/day) | ] --- class: left # Further System-Specific Information Needs
This network representation takes into account the graph structure of the system, but nothing else. To complete a model, need: * System dynamics (fate, transport) * Objectives * Costs * Management goals and/or regulatory constraints --- class: left # Waste Management Information
Mass-Balance constraints: * Need to dispose of all waste from each source $i$: $$ \sum\_{j \in J} W\_{ij} = S_i $$ * Capacity limit at each disposal site $j$: $$ \sum\_{i \in I} W\_{ij} \leq K_j $$ --- class: left # Objective: Minimize Total Costs
What are the components of the total system cost? --- template: poll-answer ***What are the components of total waste management system cost?*** --- class: left # Objective: Minimize Total Costs
* **Transportation** of waste between sources and disposals * **Disposal**: fixed costs (labor, maintanance energy), variable costs (fuel, etc) --- class: left # Objective: Transportation Costs
| Variable | Definition | |:--------:|:-------------------------------------------------------------------- | | $a_{ij}$ | Cost of transporting waste from source $i$ to disposal $j$ ($/Mg-km) | | $l_{ij}$ | Distance between source $i$ and disposal $j$ (km) | -- $$ \text{Transportation Costs} = \sum\_{i \in I, j \in J} a\_{ij}l\_{ij}W\_{ij} $$ --- class: left # Objective: Disposal Costs
| Variable | Definition | |:--------:|:------------------------------------------------------- | | $c_j$ | Fixed costs of operating disposal $j$ ($/day) | | $b_{j}$ | Variable cost of disposing waste at disposal $j$ ($/Mg) | -- $$ \text{Disposal Costs} = \sum\_{j \in J} \left[c\_j + b\_j \sum\_{i \in I} W\_{ij}\right] $$ -- Is that expression for disposal costs right? What is the underlying assumption? --- class: left # Objective: Disposal Costs
The equation from the previous slide is only right if all disposal facilities are operating. But the fixed costs of a disposal may make it not cost-effective to operate within the system constraints. --- class: left # Objective: Disposal Costs
The option to not operate a disposal facility $j$ means that we need to introduce a new set of variables: $$ Y\_j = \begin{cases}0 & \text{if } \sum\_{i \in I} W\_{ij} = 0 \\\\ 1 & \text{if } \sum\_{i \in I} W\_{ij} > 0 \end{cases} $$ -- Since $Y_j$ is not a continuous variable, our decision problem is no longer a linear program. Instead, the inclusion of some integer-constrained variables (which includes binary variables) makes this a ***mixed integer* linear program**. --- class: left # Waste Management Problem Formulation
$$ \begin{alignat}{2} & \min\_{W\_{i,j}, {Y\_j}} && \sum\_i \sum\_j a\_{ij}l\_{ij}W\_{ij} + \sum\_j \left[c\_jY\_j + \sum\_i b\_jW\_{ij}\right] \notag \\\\ & \text{subject to:} \qquad && Y\_j = \begin{cases}0 & \text{if } \sum\_{i \in I} W\_{ij} = 0 \\\\ 1 & \text{if } \sum\_{i \in I} W\_{ij} > 0 \end{cases} \tag{commitment} \\\\ & && \sum\_i W\_{ij} \leq K\_j \tag{capacity limit} \\\\ & && \sum\_j W\_{ij} = S\_i \tag{mass balance} \\\\ & && W_{ij} \geq 0 \tag{nonnegativity}\\\\ \end{alignat} $$ --- class: left # How Do We Solve a Mixed-Integer Program?
What are the implications of the integer-constrained variable $Y_j$ for the solution? --- class: left # Recall: Linear Programming
.left-column[ Since objective function and constraints are all linear and variables are continuous, we know optimal solutions occur at corners of the feasible polytope. ] .right-column[.center[]] --- class: left # Now: Mixed-Integer Linear Program
.left-column[ But corners may not exist at integer-valued points! ] .right-column[.center[]] --- class: left # A Simple Mixed-Integer Problem
.left-column[ $\begin{alignedat}{2} & \max && 3x_1 + 4x_2 \\\\ & \text{subject to:} && \\\\ & && 2x_1 + 6x_2 \leq 27 \\\\ & && x_2 \geq 2 \\\\ & && 3x_1 + x_2 \leq 19 \\\\ & && x_1, x_2 \geq 0 \\\ & && x_1, x_2 \quad \text{integers} \end{alignedat}$ ] .right-column[ .center[] ] --- class: left # A Simple Mixed-Integer Problem
.left-column[ $\begin{alignedat}{2} & \max && 3x_1 + 4x_2 \\\\ & \text{subject to:} && \\\\ & && 2x_1 + 6x_2 \leq 27 \\\\ & && x_2 \geq 2 \\\\ & && 3x_1 + x_2 \leq 19 \\\\ & && x_1, x_2 \geq 0 \\\ & && x_1, x_2 \quad \text{integers} \end{alignedat}$ Integer solution: $f(4, 3) = 24$ ] .right-column[ .center[] ] --- class: left # Idea of Mixed-Integer Solution Method
.left-column[ Solution to linear relaxation (relax integer constraint) is an *upper bound* on the mixed-integer solution (why?). Starting from this, test new problems "bounding" LP solution with integer constraints. Continue until integer solution found. ] .right-column[ .center[] ] --- class: left # Idea of Mixed-Integer Solution Method
.left-column[ Solution to linear relaxation (relax integer constraint) is an *upper bound* on the mixed-integer solution (why?). Starting from this, test new problems "bounding" LP solution with integer constraints. Continue until integer solution found. ] .right-column[ .center[] ] --- class: left # Back to Waste Management
.left-column[.center[]] .right-column[ Three disposal options: * Waste-to-Energy (WTE) combusts waste, resulting in residual ash. * Materials Recovery Facility (MRF) recycles waste. * Landfill (LF) can store all waste types. ] --- class: left # Back to Waste Management ```julia using JuMP using Cbc waste = Model(Cbc.Optimizer) I = 1:2 # number of cities J = 1:3 # number of disposal sites ``` --- class: left # Waste Management Example: Decision Variables
.left-column[.center[]] .right-column[ | Variable | Definition | |:---------:|:--------------------------------------------------------------------- | | $W\_{ij}$ | Waste transported from city $i$ to disposal $j$ (Mg/day) | | $R\_{kj}$ | Residual waste transported from disposal $k$ to disposal $j$ (Mg/day) | | $Y\_j$ | Operational status (on/off) of disposal $j$ (binary) | ```julia @variable(waste, W[i in I, j in J] >= 0) @variable(waste, R[k in J, j in J] >= 0) @variable(waste, Y[j in J], Bin) ``` ] --- class: left # Waste Management Example: WTE Costs
.left-column[.center[] Transportation: $1.50/Mg-km Recycling Rate: 40%] .right-column[ Facility Costs: | Facility | Fixed Cost ($/yr) | Tipping Cost ($/Mg) | Recycling Cost ($/Mg recycled) | |:--------:| -----------------:| -------------------:| ------------------------------:| | WTE | 900,000 | 60 | – | | MRF | 400,000 | 5 | 35 | | LF | 700,000 | 40 | – | ] **WTE Costs**: $2466 Y\_1 + 60(W\_{11} + W\_{21} + R\_{21})$ --- class: left # Waste Management Example: MRF Costs
.left-column[.center[] Transportation: $1.50/Mg-km Recycling Rate: 40%] .right-column[ Facility Costs: | Facility | Fixed Cost ($/yr) | Tipping Cost ($/Mg) | Recycling Cost ($/Mg recycled) | |:--------:| -----------------:| -------------------:| ------------------------------:| | WTE | 900,000 | 60 | – | | MRF | 400,000 | 5 | 35 | | LF | 700,000 | 40 | – | **MRF Costs**: $1096 Y\_2 + 5(W\_{12} + W\_{22} + 0.4(35)(W\_{12} + W\_{22})$ ] --- class: left # Waste Management Example: LF Costs
.left-column[.center[] Transportation: $1.50/Mg-km Recycling Rate: 40%] .right-column[ Facility Costs: | Facility | Fixed Cost ($/yr) | Tipping Cost ($/Mg) | Recycling Cost ($/Mg recycled) | |:--------:| -----------------:| -------------------:| ------------------------------:| | WTE | 900,000 | 60 | – | | MRF | 400,000 | 5 | 35 | | LF | 700,000 | 40 | – | **LF Costs**: $1918 Y\_2 + 40(W\_{13} + W\_{23} + R\_{13} + R\_{23})$ ] --- class: left # Waste Management Example: Transportation Costs
.left-column[.center[] Transportation: $1.50/Mg-km Recycling Rate: 40%] .right-column[ **Transportation Costs**: $\begin{aligned} &1.5[15W\_{11} + 5W\_{12} + 30W\_{13} \\\\ & \quad 10W\_{21} + 15W\_{22} + 25W\_{23} \\\\ & \quad 18R\_{13} + 15R\_{21} + 32R\_{23}] \end{aligned}$ ] --- class: left # Waste Management Example: Objective
$$ \begin{aligned} \min\_{W, R, Y} \qquad & 82.5 W\_{11} + 26.5W\_{12} + 85W\_{13} + 75W\_{21} + \\\\ & \quad 41.5W\_{22} + 77.5W\_{23} + 67R\{13} + 82.5R\_{21} + \\\\ & \quad 88R\_{23} + 2466Y\_1 + 1096Y\_2 + 1918Y\_3 \end{aligned} $$ ```julia @objective(waste, Min, sum([82.5 26.5 85; 75 41.5 77.5] .* W) + sum([0 0 67; 82.5 0 88; 0 0 0] .* R) + sum([2466; 1096; 1916] .* Y)) ``` --- class: left # Waste Management Example: Mass-Balance
.left-column[.center[]] .right-column[ City 1: $W\_{11} + W\_{12} + W\_{13} = 100$ City 2: $W\_{21} + W\_{22} + W\_{23} = 170$ ] --- class: left # Waste Management Example: Mass-Balance
.left-column[.center[]] .right-column[ WTE: $W\_{11} + W\_{21} + R\_{21} \leq 150$ MRF: $W\_{12} + W\_{22} \leq 130$ LF: $W\_{13} + W\_{23} + R\_{23} + R\_{13} \leq 200$ ] --- class: left # Waste Management Example: Mass-Balance
.left-column[.center[]] .right-column[ Recycling Rate: 40% WTE Residual Ash: 20% $$ R\_{13} = 0.2(W\_{11} + W\_{21} + R\_{21}) $$ $$ R\_{21} + R\_{23} = 0.6(W\_{12} + W\_{22}) $$ ] --- class: left # Waste Management Example: Commitment and Non-Negativity
$$ \begin{aligned} Y\_1 &= \begin{cases}0 &\quad \text{if } W\_{11} + W\_{21} + R\_{21} = 0 \\\\ 1 & \quad \text{else} \end{cases} \\\\ Y\_2 &= \begin{cases}0 &\quad \text{if } W\_{21} + W\_{22} = 0 \\\\ 1 & \quad \text{else} \end{cases} \\\\ Y\_3 &= 1 \\\\ W\_{ij}, R\_{ij} &\geq 0 \end{aligned} $$ --- class: left # Waste Management Example: All Constraints
```julia city_out = [100; 170] # mass-balance @constraint(waste, city[i in I], sum(W[i,:]) == city_out[i]) @constraint(waste, wte, W[1,1] + W[2,1] + R[2,1] <= 150) @constraint(waste, mrf, W[1,2] + W[2,2] <= 130) @constraint(waste, lf, W[1,3] + W[2,3] + R[2,3] + R[1,3] <= 200) # residuals @constraint(waste, resid1, R[1,3] == 0.2 .* (W[1,1] + W[2,1] + R[2,1])) @constraint(waste, resid2, R[2,1] + R[2,3] == 0.6 .* (W[1,2] + W[2,2])) @constraint(waste, resid3, sum(R[3,:]) == 0) @constraint(waste, noresiddiag, sum(R[i, i] for i in I) == 0) @constraint(waste, noresid, R[1,2] == 0) ``` --- class: left # Waste Management Example: All Constraints
```julia # commitment @constraint(waste, commit1, !Y[1] => {W[1,1] + W[2,1] + R[2,1] == 0}) @constraint(waste, commit2, !Y[2] => {W[1,2] + W[2,2] == 0}) @constraint(waste, commit3, Y[3] == 1) ``` --- class: left # Waste Management Example: Optimize
```julia optimize!(waste) ``` --- class: left # Waste Management Example: Solution
```julia objective_value(waste) ``` ``` 26879.25 ``` --- class: left # Waste Management Example: Solution
```julia value.(Y) ``` ``` 1-dimensional DenseAxisArray{Float64,1,...} with index sets: Dimension 1, 1:3 And data, a 3-element Vector{Float64}: 1.0 1.0 1.0 ``` --- class: left # Waste Management Example: Solution
```julia value.(W) ``` ``` 2-dimensional DenseAxisArray{Float64,2,...} with index sets: Dimension 1, 1:2 Dimension 2, 1:3 And data, a 2×3 Matrix{Float64}: 0.0 100.0 0.0 0.0 0.0 170.0 ``` --- class: left # Waste Management Example: Solution
```julia value.(R) ``` ``` 2-dimensional DenseAxisArray{Float64,2,...} with index sets: Dimension 1, 1:3 Dimension 2, 1:3 And data, a 3×3 Matrix{Float64}: 0.0 0.0 7.5 37.5 0.0 22.5 0.0 0.0 0.0 ``` --- class: left # Waste Management Example: Solution
.center[] --- class: left # Key Takeaways
* Fixed Costs cause discontinuities in the cost function; average cost usually declines with operation. * Decisions about operational status of facilities requires *binary* variables; no longer an LP. * Waste disposal as an example of a network problem. * Fate \& transport dynamics can result in residuals and extra flows which need to be accounted for. --- class: left # Next Class
* Term Project Release * Unit Commitment as a mixed-integer example