Skip to content

Commit e0a33e2

Browse files
committed
Quieter non-versbose runnning
1 parent e75d490 commit e0a33e2

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

development/examples.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ function peanut_butter()
2424
return -A, -b, -c
2525
end
2626

27+
"""
28+
fishkind4()
29+
30+
DEF's example for chapter 4.
31+
"""
2732
function fishkind4()
2833
A = [2 1 0 9 -1; 1 1 -1 5 1]
2934
b = [9; 7]

src/Bases.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ end
3333
3434
Return a feasible basis for the LP in `T` or `nothing` if none exists.
3535
"""
36-
function find_a_basis(T::Tableau)
36+
function find_a_basis(T::Tableau, verbose::Bool=true)
3737
TT = _phase_one_tableau(T)
3838
n = T.n_vars
3939
m = T.n_cons
4040

4141
simplex_solve!(TT, false)
4242
v = value(TT)
4343
if v>0
44-
@info "No basis found."
44+
if verbose
45+
@info "No basis found."
46+
end
4547
return 0*get_basis(TT)
4648
end
4749

src/SimplexTableaux.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ using PrettyTables
1111
import Base: show
1212
import LatexPrint: latex_form
1313

14-
# function __init__()
15-
# LatexPrint.set_slash()
16-
# end
17-
1814
include("Exact.jl")
1915

2016
export Tableau,

src/Solver.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ Solve `T` using the simplex method.
8686
"""
8787
function simplex_solve!(T::Tableau, verbose::Bool=true)
8888
if 0 T.B
89-
B = find_a_basis(T)
89+
B = find_a_basis(T, verbose)
9090
if 0 B
91-
@info "This linear program is infeasible."
91+
if verbose
92+
@info "This linear program is infeasible."
93+
end
9294
return nothing
9395
end
9496
if verbose
@@ -107,7 +109,9 @@ function simplex_solve!(T::Tableau, verbose::Bool=true)
107109
while !is_optimal(T)
108110
p = find_pivot(T)
109111
if 0 p
110-
@info "This linear program is unbounded"
112+
if verbose
113+
@info "This linear program is unbounded"
114+
end
111115
return nothing
112116
end
113117
basis_pivot!(T, p...)

0 commit comments

Comments
 (0)