Skip to content

Commit 3099d27

Browse files
Merge pull request #777 from Quantum-Software-Development/FabianaCampanari-patch-1
Add files via upload
2 parents 884d6c9 + abbaa13 commit 3099d27

File tree

1 file changed

+175
-0
lines changed
  • class__15-✍🏻 HandMade Excercise prep EXAM -LP -MathModels - Simplex Two-Stages + Transportation Problem/🇺🇸 Answers - English/Exercise_1-Answers

1 file changed

+175
-0
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
```markdown
2+
# Detailed Solution of the Problem Using the Two-Phase Simplex Method
3+
4+
## Original Problem
5+
6+
**Minimize:**
7+
8+
$$
9+
Z = x_1 + x_2 + x_3
10+
$$
11+
12+
**Subject to:**
13+
14+
$$
15+
\begin{cases}
16+
2x_1 + x_2 - x_3 \leq 10 \\
17+
x_1 + x_2 + 2x_3 \geq 20 \\
18+
2x_1 + x_2 + 3x_3 = 60 \\
19+
x_1, x_2, x_3 \geq 0
20+
\end{cases}
21+
$$
22+
23+
<br>
24+
25+
## Phase I: Elimination of Artificial Variables
26+
27+
### Step 1: Convert inequalities to equalities
28+
29+
- For the $\leq$ constraint, add slack variable $s_1 \geq 0$:
30+
31+
$$
32+
2x_1 + x_2 - x_3 + s_1 = 10
33+
$$
34+
- For the $\geq$ constraint, subtract excess variable $s_2 \geq 0$ and add artificial variable $a_1 \geq 0$:
35+
36+
$$
37+
x_1 + x_2 + 2x_3 - s_2 + a_1 = 20
38+
$$
39+
- For the equality constraint, add artificial variable $a_2 \geq 0$:
40+
41+
$$
42+
2x_1 + x_2 + 3x_3 + a_2 = 60
43+
$$
44+
45+
46+
### Step 2: Auxiliary objective function for Phase I
47+
48+
$$
49+
\min W = a_1 + a_2
50+
$$
51+
52+
<br>
53+
54+
### Initial Tableau
55+
56+
| **Base** | $x_1$ | $x_2$ | $x_3$ | $s_1$ | $s_2$ | $a_1$ | $a_2$ | **RHS** |
57+
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
58+
| $\mathbf{s_1}$ | 2 | 1 | -1 | 1 | 0 | 0 | 0 | 10 |
59+
| $\mathbf{a_1}$ | 1 | 1 | 2 | 0 | -1 | 1 | 0 | 20 |
60+
| $\mathbf{a_2}$ | 2 | 1 | 3 | 0 | 0 | 0 | 1 | 60 |
61+
| $\mathbf{W}$ | -3 | -2 | -5 | 0 | 1 | 0 | 0 | 80 |
62+
63+
*Note: The $W$ row is obtained by substituting $a_1$ and $a_2$ from the constraints.*
64+
65+
<br>
66+
67+
### Step 3: Iteration 1 — Enter $x_3$, Leave $a_1$
68+
69+
- **Pivot element:** $2$ (row $a_1$, column $x_3$).
70+
- **Row operations:** Divide row $a_1$ by $2$ and update other rows to zero out column $x_3$.
71+
72+
<br>
73+
74+
### Tableau after Iteration 1
75+
76+
| **Base** | $x_1$ | $x_2$ | $x_3$ | $s_1$ | $s_2$ | $a_1$ | $a_2$ | **RHS** |
77+
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
78+
| $\mathbf{s_1}$ | 2.5 | 1.5 | 0 | 1 | -0.5 | 0.5 | 0 | 20 |
79+
| $\mathbf{x_3}$ | 0.5 | 0.5 | 1 | 0 | -0.5 | 0.5 | 0 | 10 |
80+
| $\mathbf{a_2}$ | 0.5 | -0.5 | 0 | 0 | 1.5 | -1.5 | 1 | 30 |
81+
| $\mathbf{W}$ | -0.5 | 0.5 | 0 | 0 | -1.5 | 2.5 | 0 | 130 |
82+
83+
84+
<br>
85+
86+
### Step 4: Iteration 2 — Enter $s_2$, Leave $a_2$
87+
88+
- **Pivot element:** $1.5$ (row $a_2$, column $s_2$).
89+
- **Row operations:** Divide row $a_2$ by $1.5$ and update other rows to zero out column $s_2$.
90+
91+
<br>
92+
93+
### Tableau after Iteration 2
94+
95+
| **Base** | $x_1$ | $x_2$ | $x_3$ | $s_1$ | $s_2$ | $a_1$ | $a_2$ | **RHS** |
96+
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
97+
| $\mathbf{s_1}$ | 8/3 | 4/3 | 0 | 1 | 0 | 0 | 1/3 | 30 |
98+
| $\mathbf{x_3}$ | 2/3 | 1/3 | 1 | 0 | 0 | 0 | 1/3 | 20 |
99+
| $\mathbf{s_2}$ | 1/3 | -1/3 | 0 | 0 | 1 | -1 | 2/3 | 20 |
100+
| $\mathbf{W}$ | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 |
101+
102+
103+
<br>
104+
105+
### ⚠️ **Attention: If Phase I ends with $W \neq 0$**
106+
107+
If at the end of Phase I the auxiliary objective function $W$ **is not zero**, i.e., $W > 0$, this indicates that **there is no feasible solution to the original problem**.
108+
109+
This happens because artificial variables could not be removed from the basis, signaling inconsistency in the original constraints.
110+
111+
In this case, the Two-Phase Simplex method **stops and reports the problem as infeasible**.
112+
113+
<br>
114+
115+
## Phase II: Optimization of the Original Objective Function
116+
117+
### Initial Tableau Phase II
118+
119+
| **Base** | $x_1$ | $x_2$ | $x_3$ | $s_1$ | $s_2$ | **RHS** |
120+
| :--: | :--: | :--: | :--: | :--: | :--: | :--: |
121+
| $\mathbf{s_1}$ | 8/3 | 4/3 | 0 | 1 | 0 | 30 |
122+
| $\mathbf{x_3}$ | 2/3 | 1/3 | 1 | 0 | 0 | 20 |
123+
| $\mathbf{s_2}$ | 1/3 | -1/3 | 0 | 0 | 1 | 20 |
124+
125+
126+
<br>
127+
128+
### Step 5: Write the original objective function in terms of the variables
129+
130+
$$
131+
x_3 = 20 - \frac{2}{3}x_1 - \frac{1}{3}x_2
132+
$$
133+
134+
$$
135+
Z = x_1 + x_2 + x_3 = x_1 + x_2 + 20 - \frac{2}{3}x_1 - \frac{1}{3}x_2 = 20 + \frac{1}{3}x_1 + \frac{2}{3}x_2
136+
$$
137+
138+
---
139+
140+
### Step 6: Optimality Check
141+
142+
The coefficients of $Z$ for the non-basic variables $x_1$ and $x_2$ are positive $\left(\frac{1}{3}\right.$ and $\left.\frac{2}{3}\right)$, indicating the current solution is optimal.
143+
144+
---
145+
146+
## Optimal Solution
147+
148+
$$
149+
\boxed{
150+
(x_1, x_2, x_3) = (0, 0, 20) \quad \text{with} \quad Z_{\min} = 20
151+
}
152+
$$
153+
154+
<br>
155+
156+
## Constraint Verification
157+
158+
$$
159+
\begin{cases}
160+
2(0) + 0 - 20 = -20 \leq 10 \quad \checkmark \\
161+
0 + 0 + 2(20) = 40 \geq 20 \quad \checkmark \\
162+
2(0) + 0 + 3(20) = 60 = 60 \quad \checkmark
163+
\end{cases}
164+
$$
165+
166+
<br>
167+
168+
# **Summary**
169+
170+
- The Two-Phase Simplex method was applied correctly.
171+
- Phase I eliminated artificial variables with $W = 0$, indicating the problem is **feasible**.
172+
- Phase II optimized the original objective function, finding the optimal solution.
173+
- If $W \neq 0$ at the end of Phase I, the problem would be **infeasible** (no feasible solution).
174+
````
175+

0 commit comments

Comments
 (0)