Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

CPLEX Error 5002: Q is not positive semi-definite

  • 1.  CPLEX Error 5002: Q is not positive semi-definite

    Posted Fri January 31, 2014 03:37 AM

    Originally posted by: Morianta


    Hi,

    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;

    ...

     

    Error:

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

     

    Thank you so much.

     

    #DecisionOptimization
    #MathematicalProgramming-General


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

    Posted Fri January 31, 2014 06:12 AM

    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.


    #DecisionOptimization
    #MathematicalProgramming-General