Originally posted by: Mili12
Hi All,
I'm trying to solve a simple non-convex QP with linear constraints in R using Rcplex and I'm getting the following error: CPLEX Error 5002: objective is not convex. Isn't Cplex supposed to deal with non-convex objectives? not sure how to fix this. Here is a sample that I ran:
```r
A = matrix(c(1,19,1,1),2,2,byrow = TRUE)
B = matrix(c(2,11,2,2),2,2,byrow = TRUE)
C = A + B
D = array(0, dim = c(6,6))
D[1:2,3:4] = C; D[3:4,1:2] = t(C)
d = c(0,0,0,0,-1,-1)
Avec = matrix(c(1,1,0,0,0,0,
0,0,1,1,0,0,
0,0,A[1,1],A[1,2],-1,0,
0,0,A[2,1],A[2,2],-1,0,
B[1,1],B[2,1],0,0,0,-1,
B[1,2],B[2,2],0,0,0,-1),6,6,byrow = TRUE)
bvec = c(1,1,0,0,0,0)
require(Rcplex)
#control = list(method=4),
lower = array(0, dim = 6)
out <- Rcplex(cvec = d,Amat = Avec,bvec = bvec,Qmat = D, control = list(method=4),
objsense = "max",sense = c('E','E','L','L','L','L'), n = NA)
```
This is the full error that I'm getting:
CPLEX environment opened
Rcplex: num variables=6 num constraints=6
CPXPARAM_TimeLimit 9.9999999999999995e+73
CPXPARAM_QPMethod 4
CPXPARAM_MIP_Tolerances_AbsMIPGap 0
CPXPARAM_MIP_Pool_RelGap 0
CPXPARAM_MIP_Pool_AbsGap 0
Number of nonzeros in lower triangle of Q = 4
Using Approximate Minimum Degree ordering
Total time for automatic ordering = 0.00 sec. (0.00 ticks)
Summary statistics for factor of Q:
Rows in Factor = 4
Integer space required = 4
Total non-zeros in factor = 10
Total FP ops to factor = 30
CPLEX Error 5002: objective is not convex.
QP with an indefinite objective can be solved
to local optimality with optimality target 2,
or to global optimality with optimality target 3.
Presolve time = 0.00 sec. (0.00 ticks)
Barrier time = 0.00 sec. (0.00 ticks)
Error in Rcplex(cvec = d, Amat = Avec, bvec = bvec, Qmat = D, control = list(method = 4), :
Failed to optimize problem.
Closed CPLEX environment
Any idea on how to fix this?
#CPLEXOptimizers#DecisionOptimization