# Problem with CPLEX variable types using JuMP

Hello all,

I am trying to solve a quadratic optimization problem using CPLEX through JuMP. It is a continuous relaxation, hence all of my variables are continuous (with box constraints).
After dealing with convexity issues, I get the following error :

``````ERROR: CPLEX.CplexError(1017, "CPLEX Error  1017: Not available for mixed-integer problems.\n")
``````

Since the error is thrown by CPLEX, I went through documentation and forums on the CPLEX side of things, until I found the following note (in the documentation for the Python API, granted).

Note : If types is specified, the problem type will be a MIP, even if all variables are specified to be continuous. (https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cplex.help/refpythoncplex/html/cplex._internal._subinterfaces.VariablesInterface-class.html#add)

Since the python user and I got the same error, this might be the same problem for both of us. How do I remedy this situation in JuMP ? I need the problem to be seen as a continuous optimization problem.

Can you please post a minimal code example to replicate the error ?

1 Like
``````using JuMP
using CPLEX
mp = Model(CPLEX.Optimizer)
@variable(mp, 0 <= x[1:3] <= 1)
@objective(mp, Min, x[1]^2 + x[2]^2 + x[3]^2 -3*x[1]*x[2] -4*x[1]*x[3] -5*x[2]*x[3])
set_optimizer_attribute(mp, "CPXPARAM_OptimalityTarget",3) #To search global opt
#Despite non convexity
optimize!(mp)
``````

This should yield the error, despite all variables being continuous.

1 Like

I can’t reproduce the error locally. Are you using the latest versions of JuMP & CPLEX?

[EDIT]: this is obtained with the master branch of CPLEX.jl

``````Version identifier: 12.10.0.0 | 2019-11-26 | 843d4de
CPXPARAM_OptimalityTarget                        3
Warning: global optimality target changes problem type to MIQP.
Found incumbent of value 0.000000 after 0.01 sec. (0.00 ticks)
Found incumbent of value -9.000000 after 0.01 sec. (0.00 ticks)
Tried aggregator 2 times.
MIQP Presolve added 0 rows and 3 columns.
Aggregator did 1 substitutions.
Reduced MIQP has 2 rows, 6 columns, and 7 nonzeros.
Reduced MIQP has 0 binaries, 0 generals, 0 SOSs, and 0 indicators.
Reduced MIQP objective Q matrix has 3 nonzeros.
Presolve time = 0.01 sec. (0.01 ticks)
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 8 threads.
Root relaxation solution time = 0.01 sec. (0.03 ticks)
Nodes                                         Cuts/
Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

0     0      -12.5250     0                    -12.5250       14
*     0+    0                           -9.0000      -12.5250            39.17%
0     2      -12.5250     0       -9.0000      -12.5250       14   39.17%
Elapsed time = 0.05 sec. (0.17 ticks, tree = 0.02 MB, solutions = 2)
Root node processing (before b&c):
Real time             =    0.05 sec. (0.16 ticks)
Real time             =    0.01 sec. (0.04 ticks)
Sync time (average)   =    0.00 sec.
Wait time (average)   =    0.00 sec.
------------
Total (root+branch&cut) =    0.05 sec. (0.20 ticks)
``````

With the latest tagged release, I obtain the same error, which is triggered when the MOI wrapper tries to query dual information from the problem.

I suggest you swtich to CPLEX#master for now. A new version should be tagged soon.

3 Likes

Thank you very much ! Seems I have a habit of stumbling on issues that have been solved in the master branch. I should think about it next time something like that happens.

2 Likes

Make sure you read the following before using `CPLEX#master`. It also explains when a new version will be tagged:

The underlying issue for this is complicated. I wasn’t aware `CPXPARAM_OptimalityTarget` changes the problem type, so I should add some better tests.

Edit: added a test so this doesn’t break in future: Add test for CPXPARAM_OptimalityTarget by odow · Pull Request #332 · jump-dev/CPLEX.jl · GitHub

1 Like