Skip to content

Commit

Permalink
test Ipopt for QCQP. ref #227
Browse files Browse the repository at this point in the history
  • Loading branch information
mlubin committed Dec 17, 2014
1 parent 7245969 commit e7fd802
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/qcqpmodel.jl
Expand Up @@ -9,8 +9,8 @@
#############################################################################
using JuMP, FactCheck

facts("[qcqpmodel] Test quad objective") do
for solver in quad_solvers
facts("[qcqpmodel] Test quad objective (discrete)") do
for solver in quad_mip_solvers
context("With solver $(typeof(solver))") do

modQ = Model(solver=solver)
Expand All @@ -32,6 +32,11 @@ context("With solver $(typeof(solver))") do
@fact modQ.objVal => roughly(-247.0, 1e-5)
@fact getValue(x)[:] => roughly([2.0, 3.0, 4.0], 1e-6)

end; end; end

facts("[qcqpmodel] Test quad objective (continuous)") do
for solver in quad_solvers
context("With solver $(typeof(solver))") do

modQ = Model(solver=solver)
@defVar(modQ, 0.5 <= x <= 2 )
Expand All @@ -41,11 +46,12 @@ context("With solver $(typeof(solver))") do
@fact solve(modQ) => :Optimal
@fact modQ.objVal => roughly(1.0, 1e-6)
@fact (getValue(x) + getValue(y)) => roughly(1.0, 1e-6)

end; end; end



facts("[qcqpmodel] Test quad constraints") do
facts("[qcqpmodel] Test quad constraints (continuous)") do
for solver in quad_solvers
context("With solver $(typeof(solver))") do

Expand All @@ -59,7 +65,11 @@ context("With solver $(typeof(solver))") do
@fact modQ.objVal => roughly(-1-4/sqrt(3), 1e-6)
@fact (getValue(x) + getValue(y)) => roughly(-1/3, 1e-3)

end; end; end

facts("[qcqpmodel] Test quad constraints (discrete)") do
for solver in quad_mip_solvers
context("With solver $(typeof(solver))") do
modQ = Model(solver=solver)
@defVar(modQ, -2 <= x <= 2, Int )
@defVar(modQ, -2 <= y <= 2, Int )
Expand Down Expand Up @@ -101,4 +111,4 @@ context("With solver $(typeof(solver))") do
@fact modQ.internalModelLoaded => true
@fact solve(modQ) => :Optimal
@fact getObjectiveValue(modQ) => roughly(-0.75, 1e-6)
end; end; end
end; end; end
2 changes: 2 additions & 0 deletions test/solvers.jl
Expand Up @@ -73,6 +73,8 @@ quad_solvers = Any[]
grb && push!(quad_solvers, Gurobi.GurobiSolver(OutputFlag=0))
cpx && push!(quad_solvers, CPLEX.CplexSolver(CPX_PARAM_SCRIND=0))
mos && push!(quad_solvers, Mosek.MosekSolver(LOG=0))
quad_mip_solvers = copy(quad_solvers)
ipt && push!(quad_solvers, Ipopt.IpoptSolver(print_level=0))
# Nonlinear solvers
nl_solvers = Any[]
ipt && push!(nl_solvers, Ipopt.IpoptSolver(print_level=0))
Expand Down

0 comments on commit e7fd802

Please sign in to comment.