Skip to content

Commit

Permalink
Merge pull request #415 from JuliaOpt/msddefault
Browse files Browse the repository at this point in the history
by default use MSD if MIP solver allows
  • Loading branch information
chriscoey committed Jul 20, 2018
2 parents a427d04 + c92d9f4 commit f39ad99
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/cardls.jl
Expand Up @@ -53,7 +53,7 @@ end
Choose solvers and options
=========================================================#

mip_solver_drives = false
mip_solver_drives = true
rel_gap = 1e-5


Expand Down
2 changes: 1 addition & 1 deletion src/conic_algorithm.jl
Expand Up @@ -645,7 +645,7 @@ function MathProgBase.optimize!(m::PajaritoConicModel)
m.new_incumb = false
m.cache_dual = Dict{Vector{Float64},Vector{Float64}}()

if m.log_level > 1
if m.log_level >= 1
@printf "\nStarting %s algorithm\n" (m.mip_solver_drives ? "MIP-solver-driven" : "iterative")
end
status_oa = m.mip_solver_drives ? solve_mip_driven!(m) : solve_iterative!(m)
Expand Down
7 changes: 6 additions & 1 deletion src/solver.jl
Expand Up @@ -64,7 +64,7 @@ function PajaritoSolver(;
timeout = Inf,
rel_gap = 1e-5,

mip_solver_drives = false,
mip_solver_drives = nothing,
mip_solver = UnsetSolver(),
mip_subopt_solver = UnsetSolver(),
mip_subopt_count = 0,
Expand Down Expand Up @@ -112,6 +112,11 @@ function PajaritoSolver(;
if mip_solver == UnsetSolver()
error("No MIP solver specified (set mip_solver)\n")
end
if mip_solver_drives == nothing
mip_solver_drives = applicable(MathProgBase.setlazycallback!, MathProgBase.ConicModel(mip_solver), x -> x)
elseif mip_solver_drives && !applicable(MathProgBase.setlazycallback!, MathProgBase.ConicModel(mip_solver), x -> x)
error("MIP solver does not support callbacks (cannot set mip_solver_drives = true)")
end

if viol_cuts_only == nothing
# If user has not set option, default is true on MSD and false on iterative
Expand Down
2 changes: 1 addition & 1 deletion test/conictest.jl
Expand Up @@ -1063,7 +1063,7 @@ function run_sdpexp_misocp(mip_solver_drives, mip_solver, cont_solver, log_level
testname = "SOC eig cuts (Dopt)"
probname = "expsdp_optimalD"
@testset "$testname" begin
solver = PajaritoSolver(timeout=120., mip_solver=mip_solver, cont_solver=cont_solver, log_level=log_level, sdp_eig=true, sdp_soc=true, prim_cut_feas_tol=1e-7, cut_zero_tol=1e-8)
solver = PajaritoSolver(timeout=120., mip_solver_drives=mip_solver_drives, mip_solver=mip_solver, cont_solver=cont_solver, log_level=log_level, sdp_eig=true, sdp_soc=true, prim_cut_feas_tol=1e-7, cut_zero_tol=1e-8)

(status, time, objval, objbound, sol) = solve_cbf(testname, probname, solver, redirect)

Expand Down
8 changes: 4 additions & 4 deletions test/runtests.jl
Expand Up @@ -32,25 +32,25 @@ tol_gap = 0.0
if glp
solvers["MILP"]["GLPK"] = GLPKMathProgInterface.GLPKSolverMIP(msg_lev=GLPK.MSG_OFF, tol_int=tol_int, tol_bnd=tol_feas, mip_gap=tol_gap)
if eco
solvers["MISOCP"]["Paj(GLPK+ECOS)"] = PajaritoSolver(mip_solver=GLPKMathProgInterface.GLPKSolverMIP(presolve=true, msg_lev=GLPK.MSG_OFF, tol_int=tol_int, tol_bnd=tol_feas/10, mip_gap=tol_gap), cont_solver=ECOS.ECOSSolver(verbose=false), log_level=0, rel_gap=1e-7)
solvers["MISOCP"]["Paj(GLPK+ECOS)"] = PajaritoSolver(mip_solver_drives=false, mip_solver=GLPKMathProgInterface.GLPKSolverMIP(presolve=true, msg_lev=GLPK.MSG_OFF, tol_int=tol_int, tol_bnd=tol_feas/10, mip_gap=tol_gap), cont_solver=ECOS.ECOSSolver(verbose=false), log_level=0, rel_gap=1e-7)
end
end
if cpx
solvers["MILP"]["CPLEX"] = solvers["MISOCP"]["CPLEX"] = CPLEX.CplexSolver(CPX_PARAM_SCRIND=0, CPX_PARAM_EPINT=tol_int, CPX_PARAM_EPRHS=tol_feas, CPX_PARAM_EPGAP=tol_gap)
if mos
solvers["MISOCP"]["Paj(CPLEX+Mosek)"] = PajaritoSolver(mip_solver=CPLEX.CplexSolver(CPX_PARAM_SCRIND=0, CPX_PARAM_EPINT=tol_int, CPX_PARAM_EPRHS=tol_feas/10, CPX_PARAM_EPGAP=tol_gap), cont_solver=Mosek.MosekSolver(LOG=0), log_level=0, rel_gap=1e-7)
solvers["MISOCP"]["Paj(CPLEX+Mosek)"] = PajaritoSolver(mip_solver_drives=false, mip_solver=CPLEX.CplexSolver(CPX_PARAM_SCRIND=0, CPX_PARAM_EPINT=tol_int, CPX_PARAM_EPRHS=tol_feas/10, CPX_PARAM_EPGAP=tol_gap), cont_solver=Mosek.MosekSolver(LOG=0), log_level=0, rel_gap=1e-7)
end
end
if grb
solvers["MILP"]["Gurobi"] = solvers["MISOCP"]["Gurobi"] = Gurobi.GurobiSolver(OutputFlag=0, IntFeasTol=tol_int, FeasibilityTol=tol_feas, MIPGap=tol_gap)
if mos
solvers["MISOCP"]["Paj(Gurobi+Mosek)"] = PajaritoSolver(mip_solver=Gurobi.GurobiSolver(OutputFlag=0, IntFeasTol=tol_int, FeasibilityTol=tol_feas/10., MIPGap=tol_gap), cont_solver=Mosek.MosekSolver(LOG=0), log_level=0, rel_gap=1e-7)
solvers["MISOCP"]["Paj(Gurobi+Mosek)"] = PajaritoSolver(mip_solver_drives=false, mip_solver=Gurobi.GurobiSolver(OutputFlag=0, IntFeasTol=tol_int, FeasibilityTol=tol_feas/10., MIPGap=tol_gap), cont_solver=Mosek.MosekSolver(LOG=0), log_level=0, rel_gap=1e-7)
end
end
#if cbc
# solvers["MILP"]["CBC"] = Cbc.CbcSolver(logLevel=0, integerTolerance=tol_int, primalTolerance=tol_feas, ratioGap=tol_gap, check_warmstart=false)
# if eco
# solvers["MISOCP"]["Paj(CBC+ECOS)"] = PajaritoSolver(mip_solver=Cbc.CbcSolver(logLevel=0, integerTolerance=tol_int, primalTolerance=tol_feas/10, ratioGap=tol_gap, check_warmstart=false), cont_solver=ECOS.ECOSSolver(verbose=false), log_level=0, rel_gap=1e-6)
# solvers["MISOCP"]["Paj(CBC+ECOS)"] = PajaritoSolver(mip_solver_drives=false, mip_solver=Cbc.CbcSolver(logLevel=0, integerTolerance=tol_int, primalTolerance=tol_feas/10, ratioGap=tol_gap, check_warmstart=false), cont_solver=ECOS.ECOSSolver(verbose=false), log_level=0, rel_gap=1e-6)
# end
#end
# if try_import(:SCIP)
Expand Down

0 comments on commit f39ad99

Please sign in to comment.