File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change 3939
4040Solve the LP `T` using the big-M method.
4141"""
42- function big_M_solve(T:: Tableau , M:: Int = 100 )
42+ function big_M_solve(T:: Tableau , M:: Int = 100 , verbose :: Bool = true )
4343 TT = big_M_tableau(T, M)
44- println(" Solving this augmented tableau" )
44+ if verbose
45+ println(" Solving this augmented tableau" )
46+ end
4547 Tx = deepcopy(TT)
4648 restore!(Tx)
47- println(Tx)
49+ if verbose
50+ println(Tx)
51+ end
4852
49- x = simplex_solve!(TT)
53+ x = simplex_solve!(TT, verbose )
5054
5155 if isnothing(x)
5256 return nothing
@@ -56,16 +60,20 @@ function big_M_solve(T::Tableau, M::Int=100)
5660 arts = x[(T. n_vars + 1 ): end ]
5761
5862 if any(arts .≠ 0 )
59- @info " LP is possibly infeasible. Try a larger value than M = $M ?"
63+ if verbose
64+ @info " LP is possibly infeasible. Try a larger value than M = $M ?"
65+ end
6066 return nothing
6167 end
6268
6369 x = x[1 : T. n_vars]
6470 B = infer_basis!(T, x)
6571 set_basis!(T, B)
66- println(" \n Final tableau\n " )
67- println(T)
68- v = value(T)
69- println(" Minimial value = $v = $(Float64(v)) " )
72+ if verbose
73+ println(" \n Final tableau\n " )
74+ println(T)
75+ v = value(T)
76+ println(" Minimal value = $v = $(Float64(v)) " )
77+ end
7078 return x
7179end
You can’t perform that action at this time.
0 commit comments