Skip to content

Commit 6827c65

Browse files
committed
find_pivot_column
1 parent 77fb43b commit 6827c65

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Pivoting.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
find_pivot_column(T::Tableau)
3+
4+
Return the index of the column in `T` with the most negative
5+
value, or `0` if all entries in the bottom row are nonnegative.
6+
"""
7+
function find_pivot_column(T::Tableau)
8+
bottom = T.M[end, 1:(end - 1)]
9+
v, i = findmin(bottom)
10+
return v < 0 ? i : 0
11+
end

src/SimpleTableaux.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Base: show
88

99
TabEntry = Rational{BigInt}
1010

11-
export Tableau, get_A, get_b, get_c
11+
export Tableau, find_pivot_column, get_A, get_b, get_c
1212

1313
"""
1414
Tableau(A::Matrix, b::Vector, c::Vector)
@@ -69,4 +69,6 @@ function show(io::IO, T::Tableau)
6969
return show(io, df)
7070
end
7171

72+
include("Pivoting.jl")
73+
7274
end # module SimpleTableaux

0 commit comments

Comments
 (0)