Lecture 16
October 11, 2023
A linear program (LP), has the following characteristics:
Solutions to LPs must occur at intersections of constraints, which is the key insight for the simplex method.
Text: VSRIKRISH to 22333
Resource Allocation Problems are a broad category of prescriptive environmental modeling.
Resource Allocation Schematic
A farmer has access to a pesticide which can be used on corn, soybeans, and wheat fields, and costs $70/ha-yr to apply.
The following crop yields can be obtained:
Application Rate (kg/ha) | Soybean (kg/ha) | Wheat (kg/ha) | Corn (kg/ha) |
---|---|---|---|
0 | 2900 | 3500 | 5900 |
1 | 3800 | 4100 | 6700 |
2 | 4400 | 4200 | 7900 |
Production costs, excluding pesticide, and selling prices:
Crop | Production Cost ($/ha-yr) | Selling Price ($/kg) |
---|---|---|
Soybeans | 350 | 0.36 |
Wheat | 280 | 0.27 |
Corn | 390 | 0.22 |
Recently, environmental authorities have declared that farms cannot have an average application rate on soybeans, wheat, and corn which exceeds 0.8, 0.7, and 0.6 kg/ha, respectively.
Question: How should the farmer plant crops and apply pesticides to maximize profits over 130 total ha while remaining in regulatory compliance if demand for each crop this year is 250,000 kg?
The first step is to establish notation for our decision variables.
Text: VSRIKRISH to 22333
Variable | Meaning |
---|---|
\(S_j\) | ha planted with soybeans and treated with pesticide rate \(j=0,1,2\) kg |
\(W_j\) | ha planted with wheat and treated with pesticide rate \(j=0,1,2\) kg |
\(C_j\) | ha planted with corn and treated with pesticide rate \(j=0,1,2\) kg |
Next, let’s formulate the objective function.
The farmer’s goal is to maximize profits.
Take some time to work on this.
Key: Compute profit for each ha by crop and pesticide rate.
\[Z = \sum_{\text{crop}, i} \left[ (\text{yield} \times \text{selling price}) - \text{total cost} \right]\]
After some algebra:
\[\begin{align*} Z &= 694 S_0 + 948 S_1 + 1164 S_2 \\[0.25em] & \qquad + 665 W_0 + 757 W_1 + 784 W_2 \\[0.25em] & \qquad + 908 C_0 + 1014 C_1 + 1278 C_2 \end{align*}\]
Original: \[\begin{align*} Z &= 694 S_0 + 948 S_1 + 1164 S_2 \\[0.25em] & + 665 W_0 + 757 W_1 + 784 W_2 \\[0.25em] & + 908 C_0 + 1014 C_1 + 1278 C_2 \end{align*}\]
Vectorized: \[\begin{align*} Z &= \mathbf{S} \begin{pmatrix}694 \\ 948 \\ 1164 \end{pmatrix} + \mathbf{W} \begin{pmatrix}665 \\ 757 \\ 784 \end{pmatrix} \\[0.25em] & + \mathbf{C} \begin{pmatrix}908 \\ 1014 \\ 1278 \end{pmatrix} \end{align*}\]
Finally, we need to establish our constraints.
Text: VSRIKRISH to 22333
\[\sum_j S_j + C_j + W_j \leq 130\]
Can write this out more fully, but as you will see, JuMP.jl
can handle these compact formulations (which makes debugging easier).
\[\begin{alignat*}{3} \text{Soybeans}:& \qquad &\mathbf{S} \begin{pmatrix}2900 \\ 3800 \\ 4400 \end{pmatrix} \leq 250000 \\ \text{Wheat}:& \qquad &\mathbf{W} \begin{pmatrix}3500 \\ 4100 \\ 4200 \end{pmatrix} \leq 250000 \\ \text{Corn}:& \qquad &\mathbf{C} \begin{pmatrix}5900 \\ 6700 \\ 7200 \end{pmatrix} \leq 250000 \end{alignat*}\]
For soybeans:
\[\frac{S_1 + 2 S_2}{S_0 + S_1 + S_2} \leq 0.8\]
Is this an acceptable constraint?
These need to be linear for a linear program.
\[\begin{align*} & \frac{S_1 + 2 S_2}{S_0 + S_1 + S_2} \leq 0.8 \\\\ & \quad \Rightarrow S_1 + 2S_2 \leq 0.8 (S_0 + S_1 + S_2) \\\\ & \quad \Rightarrow -0.8 S_0 + 0.2 S_1 + 1.2 S_2 \leq 0 \end{align*}\]
Similarly for wheat and corn:
\[\begin{align*} -0.7 W_0 + 0.3 W_1 + 1.3 W_2 & \leq 0 \\\\ -0.6 C_0 + 0.4 C_1 + 1.4 C_2 & \leq 0 \end{align*}\]
These are straightforward, but neglecting them can lead to numerical issues:
\[S_j, W_j, C_j \geq 0.\]
\[\begin{align} \max_{S_j, W_j, C_j} \quad & 694 S_0 + 948 S_1 + 1164 S_2 + 665 W_0 + 757 W_1 + 784 W_2 \tag{1} \\[-1em] & \qquad + 908 C_0 + 1014 C_1 + 1278 C_2 \\[0.5em] \text{subject to:} \quad & S_0 + S_1 + S_2 + W_0 + W_1 + W_2 + C_0 + C_1 + C_2 \leq 130 \tag{2} \\ & 2900 S_0 + 3800 S_1 + 4400 S_2 \leq 250000 \tag{3a} \\ & 3500 W_0 + 4100 W_1 + 4200 W_2 \leq 250000 \tag{3b}\\ & 5900 C_0 + 6700 C_1 + 7200 C_2 \leq 250000 \tag{3c}\\ & -0.8 S_0 + 0.2 S_1 + 1.2 S_2 \leq 0 \tag{4a}\\ & -0.7 W_0 + 0.3 W_1 + 1.3 W_2 \leq 0 \tag{4b}\\ & -0.6 C_0 + 0.4 C_1 + 1.4 C_2 \leq 0 \tag{4c}\\ & S_j, W_j, C_j \geq 0 \tag{5} \end{align}\]
Pesticide Application (kg/ha-yr) | Soybeans (ha) | Wheat (ha) | Corn (ha) |
---|---|---|---|
0 | 13.8 | 26.9 | 6.7 |
1 | 55.2 | 0 | 15.7 |
2 | 0 | 11.5 | 0 |
This solution has an objective value of $117,549.
The following constraints have non-zero shadow prices:
Friday/Monday: Electric power system decision problems (generating capacity expansion, unit commitment)