CPLEX OPL Error 5002: Constraint not convex continues even setting optimalitytarget=3

169 views Asked by At

I have a problem with CPLEX Optimization Studio. I want to solve the following quadratic constraint problem, but I get 'CPLEX Error 5002: 'qconstraint1' is not convex.->'. Inicially I thought it was because the optimalitytarget is not automatically set to 3, but even when I set that explicitly the error continues. An interesting fact is that the problem is solved normally in AMPL or MATLAB environment.

How can I solve this problem?

/*********************************************
 * OPL 12.10.0.0 Model
 * Author: johnm
 * Creation Date: Oct 16, 2020 at 6:29:33 PM
 *********************************************/
execute{
  cplex.optimalitytarget=3;
}
range R=1..6;
dvar float x[R];

minimize x[1] + x[2] + x[3] + x[4] + x[5] + x[6];
subject to{
  constraint1: x[1] +  x[2] + x[5] == 8;
  constraint2: x[3] + x[5] + x[6] == 10;
  qconstraint1: -x[1]^2 + x[2]^2 + x[3]^2 <= 0;
  qconstraint2: -x[4]^2 + x[5]^2 <= 0;
  bound_x1:   x[1] >= 0;
  bound_x4:   x[4] >= 0;
  bound_x6:   x[6] >= 0;
}  
1

There are 1 answers

1
Alex Fleischer On
execute{
  cplex.optimalitytarget=3;
}
range R=1..6;
dvar float x[R] in 0..100;

minimize x[1] + x[2] + x[3] + x[4] + x[5] + x[6];
subject to{
  constraint1: x[1] +  x[2] + x[5] == 8;
  constraint2: x[3] + x[5] + x[6] == 10;
  qconstraint1: x[1]^2 - x[2]^2 - x[3]^2 >= 0;
  qconstraint2: -x[4]^2 + x[5]^2 <= 0;
  bound_x1:   x[1] >= 0;
  bound_x4:   x[4] >= 0;
  bound_x6:   x[6] >= 0;
} 

works fine