Trying to use quadprog function from MathProgBase, has error "no method matching"

jump

#1

Hi, I was trying to use JuMP.MathProgBase and Ipopt solver to solve a problem, but it seems my parameters are wrong.

The third option in the error message seems to be the closest one to my problem. Does it mean, for example, the first parameter, has to be a matrix that has only one column? Thank you in advance.

Third option from error message:

" quadprog(::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::AbstractArray{T,2} where T, ::AbstractArray{T,2} where T, ::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::MathProgBase.SolverInterface.AbstractMathProgSolver)"

Full error messages:

ERROR: LoadError: MethodError: no method matching quadprog(::Array{Float64,2}, ::Array{Float64,1}, ::Array{Array{Float64,N} where N,1}, ::Char, ::Array{Float64,1}, ::Array{Float64,2}, ::Array{Float64,2}, ::Ipopt.IpoptSolver)
Closest candidates are:
quadprog(::Any, ::Any, ::Any, ::Any, ::Any) at /Users/june/.julia/v0.6/MathProgBase/src/HighLevelInterface/quadprog.jl:73
quadprog(::Any, ::Any, ::Any, ::Any, ::Any, ::MathProgBase.SolverInterface.AbstractMathProgSolver) at /Users/june/.julia/v0.6/MathProgBase/src/HighLevelInterface/quadprog.jl:70
quadprog(::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::AbstractArray{T,2} where T, ::AbstractArray{T,2} where T, ::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::Union{Array{T,1}, Char, Real} where T<:Union{Char, Real}, ::MathProgBase.SolverInterface.AbstractMathProgSolver) at /Users/june/.julia/v0.6/MathProgBase/src/HighLevelInterface/quadprog.jl:21


#2

Hi there! Here is an example for how to use quadprog (Unless it’s super necessary, I recommend using JuMP directly over the lower-level MathProgBase; then you won’t have issues like this):

using MathProgBase, Ipopt
c = [0, 0]  # Vector
Q = [1 0; 0 1]  # Matrix
A = [1 1]  # Matrix
sense = ['=']  # Vector
b = [1]  # Vector
l = [0, 0]  # Vector
u = [1, 1]  # Vector

MathProgBase.quadprog(c, Q, A, sense, b, l, u, Ipopt.IpoptSolver())

You should also have a read of:


#3

Thanks, I tried it on simple functions and it worked. I guess there’s something wrong with the parameters I have for the complected functions. I’ll double check all my inputs.