• 1 reply
  • Latest Post - ‏2014-01-31T11:11:41Z by DanielJunglas
1 Post

Pinned topic CPLEX Error 5002: Q is not positive semi-definite

‏2014-01-31T08:36:46Z | cplex; error


I'm developing a mathematical model for my thesis, whose objective function doesn't seem to be quadratic, and generally, non-linear. However, I encounter the error related to the indefiniteness of matrix Q. Could you please guide me what the problem might be?? The following is part of my code:


using CPLEX;

int n=...;//Number of customers
int N=2*n;//Number of customer nodes
int T=...;
range Nodes=0..N+1;
range Periods=1..T;
range Linehauls=1..n;
range Backhauls=n+1..N;
float Hd[0..n]=...;//Unit delivery unit time holding cost
float Hp[n+1..N+1]=...;//Unit pichup unit time holding cost
int c[Nodes][Nodes]=...;//Unit cost of transportation from consumer i to j
dvar int+ Id[0..n][Periods];//Inventory level of serviceable product at the depot
dvar int+ Ip[n+1..N+1][Periods];//Inventory level of cores at the depot
dvar boolean x[Nodes][Nodes][Periods];
dvar boolean y[Nodes][Periods];
dexpr float DeliveryHoldingCost=sum(i in 0..n, t in Periods)(Hd[i]*Id[i][t]);
dexpr float PickupHoldingCost=sum(j in n+1..N+1, t in Periods)(Hp[j]*Ip[j][t]);
dexpr float TransportationCost=sum(i,j in Nodes:i!=j, t in Periods)(c[i][j]*x[i][j][t]);
minimize DeliveryHoldingCost+PickupHoldingCost+TransportationCost;




CPLEX Error 5002: Q in 'id1399' is not positive semi-definite. General Unknown OPL Problem Marker


Thank you so much.

Updated on 2014-01-31T08:38:43Z at 2014-01-31T08:38:43Z by Morianta
  • DanielJunglas
    170 Posts

    Re: CPLEX Error 5002: Q is not positive semi-definite


    I think this error message refers to one of your constraints instead of the objective function. The objective function looks perfectly linear to me since it only contains products of variables and data (no products of variables and variables).

    So you have at least one quadratic constraint which has an invalid Q matrix. You should label your constraints to get a more verbose error message that points to the offending constraint.