11# SimpleTableaux
22
3- Solve linear programming problems using the simplex method by pivoting
3+ This module can be used to show how to solve linear programming problems using the simplex method by pivoting
44tableaux.
55
66This is an illusration project for solving
77feasible optimization problems of the form
8- $\max c^t x$ subject to $Ax ≤ b$ and $x \ge 0$.
8+ $\max c^t x$ subject to $Ax ≤ b$ and $x \ge 0$.
99
10- Here are some quick start instructions.
10+ ## Caveats
11+
12+ As a demonstration project, this is not suitable for solving actual linear programming (LP) problems.
13+ At present it will fail if:
14+ * The LP is infeasible.
15+ * The LP is unbounded.
16+ * Other unidentified reasons.
17+
18+ It is also set up for maximization problems only. To solve a minimization problem use the dual LP by
19+ replacing the inputs ` A ` , ` b ` , and ` c ` with ` A' ` , ` c ` , and ` b ` respectively.
20+
21+
22+
23+
24+ # Quick Start Instructions
1125
1226## Set up the problem
1327
1428This example comes from [ this video] ( https://www.youtube.com/watch?v=rzRZLGD_aeE ) .
1529
1630Create the matrix ` A ` , the RHS vector ` b ` , and the objective function coefficients ` c ` :
1731```
32+ julia> using SimpleTableaux
1833julia> A = [3 5; 4 1];
1934julia> b = [78; 36];
2035julia> c = [5; 4];
@@ -36,7 +51,6 @@ Notice that the last row is the encoding of the objective function.
3651
3752```
3853julia> x = pivot_solve(T)
39- Iteration 0
40543×6 DataFrame
4155 Row │ x1 x2 s1 s2 val RHS
4256 │ Exact Exact Exact Exact Exact Exact
@@ -45,7 +59,9 @@ Iteration 0
4559 2 │ 4 1 0 1 0 36
4660 3 │ -5 -4 0 0 1 0
4761
48- Iteration 1
62+
63+ Pivot at (2,1)
64+
49653×6 DataFrame
5066 Row │ x1 x2 s1 s2 val RHS
5167 │ Exact Exact Exact Exact Exact Exact
@@ -54,7 +70,9 @@ Iteration 1
5470 2 │ 1 1/4 0 1/4 0 9
5571 3 │ 0 -11/4 0 5/4 1 45
5672
57- Iteration 2
73+
74+ Pivot at (1,2)
75+
58763×6 DataFrame
5977 Row │ x1 x2 s1 s2 val RHS
6078 │ Exact Exact Exact Exact Exact Exact
@@ -63,7 +81,7 @@ Iteration 2
6381 2 │ 1 0 -1/17 5/17 0 6
6482 3 │ 0 0 11/17 13/17 1 78
6583
66- Optimum value = 78
84+ Optimum value after 2 iterations = 78
67852-element Vector{Rational{BigInt}}:
6886 6
6987 12
@@ -86,11 +104,13 @@ julia> c' * x == 78
86104true
87105```
88106
89- ## Repeat using an LP solver (HiGHS)
107+ ## Repeat using a proper LP solver
90108
91109```
92110julia> lp_solve(T)
931112-element Vector{Float64}:
94112 6.0
95113 12.0
96- ```
114+ ```
115+
116+ The ` lp_solve ` function uses the [ HiGHS] ( https://highs.dev/ ) solver.
0 commit comments