CPLEX.jl Quadratic Expression symmetric matrix bug?

I have a optimization procedure that used to work but now I’m getting an error. Is it related to the new CPLEX.jl package? A simple working example that produces the error is:

m = Model(CPLEX.Optimizer)
@variable m x[1:10]
@variable m y

tmp = @expression m (y + x[1] + x[2] + x[3] + x[4] + x[5] - x[6] - x[7] - x[8] - x[9] - x[10] - .5)^2

@objective m Min tmp

optimize!(m)

This produces the error

ERROR: Matrix Q must be either symmetric or triangular
Stacktrace:
 [1] add_qpterms!(::CPLEX.Model, ::Array{Int32,1}, ::Array{Int32,1}, ::Array{Float64,1}) at /home/paul/.julia/packages/CPLEX/DgohF/src/cpx_quad.jl:17

Like I said, I used to have an optimization procedure essentially like this that worked well with JuMP and CPLEX. I’m unsure if this is a bug and if I should post it somewhere?

I test this code on my computer with newest CPLEX@0.7.2 and it works fine.
It seems that you are using an older version of CPLEX.

1 Like

Yeah, the provided stack trace is from an older version.

1 Like

Ok, this is a silly question. But updating CPLEX keeps the version at v0.6.6. I even updated julia to make sure its version 1.5.2 but it still won’t update. I thought the new version was tagged?

You most likely have another package that is preventing Pkg from using the latest CPLEX release.
You can force Pkg to use the latest CPLEX with

] add CPLEX#master

(the # is not a comment, it means "use the master branch from CPLEX.jl), and see what Pkg’s conflict tool says.

1 Like

Awesome - it was CUDA and CuArrays

Ok, I’m really sorry for these questions. But now I can’t install CPLEX again. I re-downloaded the binaries to make sure it was greater than version 12.10, I set the ENV["CPLEX_STUDIO_BINARIES"] variables correctly and whenever I tried to build it it says no cplex in and then lists the folders in my PATH variable? Did it package get changed to look for the binaries in the PATH and not CPLEX_STUDIO_BINARIES folders?

Ok, so it looks like the version I just downloaded is 12.80. Is the only version supported by CPLEX 12.10? I don’t even know how I would get that version

12.80 is a misnomer. It’s really 12.8.

12.10 is the latest version. You can download it from IBM. They have an academic program: CPLEX Optimization Studio is free for students and academics!

That is strange. I had literally just done that. But I did it again and this time it was 12.10. I guess I made a mistake. Thanks for the help. Everything from my original question works now