File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 11# SimpleTableaux
2+
3+ Illustration project for the optimization problem
4+ $$ \max c^t x \quad\text{subject to}\quad Ax ≤ b $$
Original file line number Diff line number Diff line change @@ -5,15 +5,21 @@ using LinearAlgebra
55
66import DataFrames: DataFrame
77
8+
89TabEntry = Rational{BigInt}
910
10- export Tableau
11+ export DataFrame, Tableau
12+ """
13+ Tableau(A::Matrix, b::Vector, c::Vector)
1114
15+ Create a `Tableau` datastructure for the linear program maximize `c'x` subject to `Ax ≤ b`.
16+ """
1217struct Tableau
13- M:: Matrix{TabEntry}
14- n_vars:: Int
15- n_cons:: Int
16- function Tableau(A:: Matrix , b:: Vector , c:: Vector )
18+ M:: Matrix{TabEntry} # place to hold the entire Tableau
19+ n_vars:: Int # number of variables in the LP
20+ n_cons:: Int # number of constraints in the LP
21+
22+ function Tableau(A:: Matrix , b:: Vector , c:: Vector )
1723 m, n = size(A)
1824 if length(b) ≠ m || length(c) ≠ n
1925 throw(ArgumentError(" Size mismatch" ))
Original file line number Diff line number Diff line change 1+ using Test
2+ using SimpleTableaux
3+ using LinearAlgebra
4+ using DataFrames
5+
6+
7+
8+ @testset " Dumb start" begin
9+ A = [1 2 3 4 ; 5 6 7 8 ]
10+ b = [1 ; 3 ]
11+ c = [5 ; 6 ; 9 ; 2 ]
12+ T = Tableau(A,b,c)
13+ @show DataFrame(T)
14+ end
You can’t perform that action at this time.
0 commit comments