Skip to content

Commit 7fa41ea

Browse files
committed
Expand pivot variations
1 parent c64ae45 commit 7fa41ea

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Pivoting.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ value, or `0` if all entries in the bottom row are nonnegative.
66
"""
77
function find_pivot_column(T::Tableau)
88
bottom = T.M[end, 1:(end - 1)]
9-
@show bottom
109
v, j = findmin(bottom)
1110
return v < 0 ? j : 0
1211
end
@@ -40,8 +39,11 @@ end
4039

4140
"""
4241
pivot!(T::Tableau, i::Int, j::Int)
42+
pivot!(T::Tableau)
4343
4444
Modify `T` by doing a pivot operation at entry `(i,j)`.
45+
46+
Second version automatically finds the pivot location.
4547
"""
4648
function pivot!(T::Tableau, i::Int, j::Int)
4749
M = T.M # for easier access
@@ -63,6 +65,7 @@ end
6365

6466
"""
6567
pivot(T::Tableau, i::Int, j::Int)
68+
pivot!(T::Tableau)
6669
6770
Non-modifying version of `pivot!`
6871
"""
@@ -71,10 +74,15 @@ function pivot(T::Tableau, i::Int, j::Int)
7174
return pivot!(TT, i, j)
7275
end
7376

74-
function pivot(T::Tableau)
77+
function pivot!(T::Tableau)
7578
i, j = find_pivot(T)
7679
if i == 0 || j == 0
7780
return T
7881
end
79-
return pivot(T, i, j)
82+
return pivot!(T, i, j)
83+
end
84+
85+
function pivot(T::Tableau)
86+
TT = deepcopy(T)
87+
return pivot!(TT)
8088
end

0 commit comments

Comments
 (0)