I am having some trouble solving binary quadratic programs with JuMP and CPLEX. Here is some code that illustrates the problem:

```
import JuMP
import CPLEX
function bqp(Q, c)
m = JuMP.Model(solver=CPLEX.CplexSolver())
@JuMP.variable(m, x[1:size(Q, 1)], Bin)
@JuMP.objective(m, Min, dot(x, Q * x) + dot(c, x))
return JuMP.solve(m)
end
bqp(eye(2, 2), ones(2))
```

Running this produces the error, “CPLEX Error 1029: Not a MIQP or fixed MIQP.”. Am I doing something wrong? Is this an issue in JuMP or CPLEX? Any help would be much appreciated.

Dan

It works perfectly in Gurobi.

Maybe CPLEX only supports a quadratic object function, but not quadratic constraints (in combination with integer variables). That’s what QP (quadratic program) is usually used for, compared to QCQP (quadratically constrained QP).

EDIT: disregard that, your model has the objective.

I can’t reproduce this. Which version of JuMP/CPLEX/CPLEX.jl are you using? (run `Pkg.status()`

and `CPLEX.version()`

).

```
julia> Pkg.status()
...
- CPLEX 0.2.2
...
- JuMP 0.16.1
...
julia> CPLEX.version()
"12.7.0.0"
julia> VERSION
v"0.5.1"
```

Strange. Can you run `Pkg.update()`

and then retry? Is there a more complete backtrace?

I did the Pkg.update(), and ran the code again. I got the same error. Here is the full stack trace:

```
julia> bqp(eye(2, 2), ones(2))
CPLEX Error 1029: Not a MIQP or fixed MIQP.
ERROR: CPLEX.CplexError(1029,"CPLEX Error 1029: Not a MIQP or fixed MIQP.\n")
in set_prob_type!(::CPLEX.Model, ::Int64) at /homedir/.julia/v0.5/CPLEX/src/cpx_model.jl:135
in set_prob_type!(::CPLEX.Model, ::Symbol) at /homedir/.julia/v0.5/CPLEX/src/cpx_model.jl:138
in toggleproblemtype!(::CPLEX.CplexMathProgModel) at /homedir/.julia/v0.5/CPLEX/src/CplexSolverInterface.jl:265
in setvartype!(::CPLEX.CplexMathProgModel, ::Array{Symbol,1}) at /homedir/.julia/v0.5/CPLEX/src/CplexSolverInterface.jl:247
in #build#114(::Bool, ::Bool, ::JuMP.ProblemTraits, ::Function, ::JuMP.Model) at /homedir/.julia/v0.5/JuMP/src/solvers.jl:440
in (::JuMP.#kw##build)(::Array{Any,1}, ::JuMP.#build, ::JuMP.Model) at ./<missing>:0
in #solve#109(::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::JuMP.Model) at /homedir/.julia/v0.5/JuMP/src/solvers.jl:166
in bqp(::Array{Float64,2}, ::Array{Float64,1}) at ./REPL[4]:5
```

Thanks! That resolved my issue.