[AMPL 24815] CPLEX 22.1.1.0: Constraint _scon[1] is not convex quadratic since it is an equality constraint.

Here is my code that keeps giving me that error:

param n;

param m;

param R {i in 1…m, j in 1…n};

param p {i in 1…m};

param delta;

var x {j in 1…n} >=0;

var rP;

var d{i in 1…m};

var r{i in 1…m};

minimize ADR: sum {i in 1…m} d[i]*p[i];

subject to return {i in 1…m}: sum {j in 1…n} x[j]*R[i,j] = r[i];

subject to sum_x: sum {j in 1…n} x[j]=1;

subject to total_return: sum {i in 1…m} p[i]*r[i] = rP;

subject to returns: rP >= delta;

subject to downside {i in 1…m}: d[i] = max(0,-r[i]);

Can someone help me find the problem please?

Thank you!!

To see which constraint is causing the problem, use this AMPL command:

print _sconname[1];

I think it will tell you that the problem is with this constraint:

subject to downside {i in 1..m}: d[i] = max(0,-r[i]);

The problem is that CPLEX does not accept the “max” function. Can you switch to another solver? Any of Gurobi, COPT, Xpress, Mosek, HiGHS, CBC, or SCIP will accept “max”.

If you must use CPLEX, then since you are minimizing d[i]*p[i], if all p[i] are positive you should be able to replace the downside constraint with d[i] >= 0 and d[i] >= -r[i].