Search code examples
matlabmathematical-optimizationcplexquadratic-programming

CPLEX Error 5002: %s is not convex - Least Square Problem with binary formulation


first post on SO.

I'm working on a quadratic optimization problem.
I'm getting the following error:

Aeq = beq = sostype =sosind = soswt = [] % for my specific problem

The others paramers look like correctly define.

Error using cplexmiqp
CPLEX Error  5002: %s is not convex.
Error in MIP_CPLEX_OptL2_CstrL0 (line 78)
        [x,z,exitflag,output] = cplexmiqp(Hprim'*Hprim,(-y'*Hprim)',Aineq,bineq,Aeq,beq,sostype,sosind,soswt,lb,ub,ctype,z0,solveur);

I've already checked the properties of the matrix (it's semi-PSD).

The error only appears for a dimension greater than 600 variables (continuous and binary -> MIQP). Below this value, the model works correctly.

Anybody got any ideas? Thx a lot :)


Solution

  • As the error message states, the problem is that your objective function is not convex. By default, CPLEX only handles convex objective functions in quadratic programs. You can however switch some parameters to make CPLEX accept (and solve for) non-convex objective functions.

    You can find the details in the user manual in section CPLEX > User's Manual for CPLEX > Continuous optimization > Solving problems with a quadratic objective (QP).

    In order to solve models with a non-convex quadratic objective, you have to set parameter Cplex.Param.optimalitytarget to 3 (find global optimum).