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

**URL:** <https://discourse.julialang.org/t/trying-to-use-quadprog-function-from-mathprogbase-has-error-no-method-matching/17831>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [November 21, 2018, 8:20pm UTC](https://discourse.julialang.org/t/trying-to-use-quadprog-function-from-mathprogbase-has-error-no-method-matching/17831 "2018-11-21T20:20:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balance37](https://avatars.discourse-cdn.com/v4/letter/b/5fc32e/32.png) [@Balance37](https://discourse.julialang.org/u/Balance37)\
**Post date:** [November 21, 2018, 8:20pm UTC](https://discourse.julialang.org/t/trying-to-use-quadprog-function-from-mathprogbase-has-error-no-method-matching/17831/1 "2018-11-21T20:20:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [November 21, 2018, 10:14pm UTC](https://discourse.julialang.org/t/trying-to-use-quadprog-function-from-mathprogbase-has-error-no-method-matching/17831/2 "2018-11-21T22:14:19Z")

</div>

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):

```julia
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:

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

<div class="post-metadata">

**Author:** ![Balance37](https://avatars.discourse-cdn.com/v4/letter/b/5fc32e/32.png) [@Balance37](https://discourse.julialang.org/u/Balance37)\
**Post date:** [November 23, 2018, 4:28pm UTC](https://discourse.julialang.org/t/trying-to-use-quadprog-function-from-mathprogbase-has-error-no-method-matching/17831/3 "2018-11-23T16:28:28Z")

</div>

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.
