Skip to content

Commit

Permalink
Remove try_import and load solvers later
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Sep 27, 2018
1 parent d1d38e7 commit c34fab4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 26 deletions.
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ end

include("utilities.jl")

# Load solvers
include("solvers.jl")

# Static tests - most don't require a solver
include("print.jl")
include("variable.jl")
Expand All @@ -32,6 +29,9 @@ include("macros.jl")
# Fuzzer of macros to build expressions
include("fuzzer.jl")

# Load solvers
include("solvers.jl")

# Solver-dependent tests
include("model.jl"); length( lp_solvers) == 0 && @warn("Model tests not run!")
include("probmod.jl"); length( lp_solvers) == 0 && @warn("Prob. mod. tests not run!")
Expand Down
38 changes: 15 additions & 23 deletions test/solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,23 @@
# Should be run as part of runtests.jl
#############################################################################

function try_import(name::Symbol)
try
@eval import $name
return true
catch e
return false
end
end
import GLPKMathProgInterface

# Load available solvers
grb = try_import(:Gurobi)
cpx = try_import(:CPLEX)
xpr = try_import(:Xpress)
mos = try_import(:Mosek)
cbc = try_import(:Cbc)
if cbc; import Clp; end
glp = try_import(:GLPKMathProgInterface)
ipt = try_import(:Ipopt)
nlo = try_import(:NLopt)
kni = try_import(:KNITRO)
eco = try_import(:ECOS)
osl = try_import(:CoinOptServices)
scs = try_import(:SCS)
nlw = try_import(:AmplNLWriter)
brn = try_import(:BARON)
grb = false
cpx = false
xpr = false
mos = false
cbc = false
glp = true
ipt = false
nlo = false
kni = false
eco = false
osl = false
scs = false
nlw = false
brn = false

# Create solver lists
# LP solvers
Expand Down

0 comments on commit c34fab4

Please sign in to comment.