Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Help with CPLEX Error 5002!

    Posted 01/23/12 03:51 AM

    Originally posted by: meletis13forever


    Hello,

    I have a problem with my model:

    {string} terminal =...;
    {string} macroBS =...;
    {string} femto =...;

    tuple coordinates{
    int x;
    int y;
    }
    coordinates posBS_femtomacroBS union femto =...;

    int covBS =...;
    int capmacroBS union femto =...;
    float powerfemto=...;
    int NbPL=...;
    range PL = 0..NbPL-1;
    float lPL=...;
    int NbBL=...;
    range BL = 0..NbBL-1;
    int BWBL =...;
    int maxBWterminal =...;

    tuple positionterminal{
    int xter;
    int yter;
    }
    positionterminal posterminalterminal;
    positionterminal dummy;

    execute{
    for(var t in terminal){
    dummy.xter=100000;
    dummy.yter=100000;
    while((posBS_femto.x-dummy.xter)^2 + (posBS_femto.y-dummy.yter)^2 >= covBS){
    dummy.xter=875+Opl.rand(30);
    dummy.yter=268+Opl.rand(30);
    //writeln("testing- xter="+dummy.xter + ";yter="+dummy.yter);
    }
    posterminal[t]=dummy;
    writeln("success adding - posterminal="+posterminal[t]);
    }
    writeln("posterminal="+posterminal);
    }

    dvar boolean xterminalmacroBS union femto;
    dvar boolean yPLfemto;
    dvar boolean NterminalfemtoPL;
    dvar int bterminal;

    dexpr float CpPLj in femto = sum(k in PL) y[k][j] * l[k] * power[j];
    dexpr float covj in femtok in PL = 10^((Cp[k][j]/20) + 1.96);
    dexpr float di in terminalj in macroBS union femto = sqrt((posterminal[i].xter - posBS_femto[j].x)^2 + (posterminal[i].yter - posBS_femto[j].y)^2);
    dexpr int loadj in macroBS union femto = sum(i in terminal) x[i][j] * b[i] ;

    minimize
    sum(j in femto, k in PL) Cp[k][j] +
    sum(i in terminal, j in femto, i2 in terminal : i2!=i, j2 in femto : j2!=j) (x[i][j] - xi2j2) +
    sum(i in terminal, j in macroBS union femto) x[i][j] * d[i][j];

    subject to{

    forall(i in terminal)
    sum(j in macroBS union femto)
    x[i][j] == 1;

    forall(j in femto)
    sum(k in PL)
    y[k][j] == 1;

    forall(i in terminal, j in femto, k in PL)
    N[i][j][k] <= y[k][j];

    forall(i in terminal, j in femto, k in PL)
    x[i][j] <= N[i][j][k] * y[k][j];

    forall(i in terminal)
    b[i] <= maxBW[i];

    forall(j in macroBS union femto)
    load[j] <= cap[j];

    forall(i in terminal)
    b[i] == 64 || b[i] == 128 || b[i] == 256 || b[i] == 384 || b[i] == 512 || b[i] ==1024;

    }
    execute{
    writeln(load);
    }
    In the problem browser I see CPLEX Error 5002: Q in 'id3585' is not positive semi-definite.
    This is caused by the constraint in the subject block
    forall(j in macroBS union femto)
    load[j] <= cap[j];

    The load is dexpr and I don't know why this is happening. Can you help me? The capacity (cap) is defined in the data.
    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: Help with CPLEX Error 5002!

    Posted 01/23/12 06:57 PM

    Originally posted by: SystemAdmin


    Your expression for load (which goes on the left side of a constraint) is a sum of products of variables (x*b). That is quadratic and not positive semidefinite, so CPLEX cannot handle it.

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: Help with CPLEX Error 5002!

    Posted 02/15/12 11:50 AM

    Originally posted by: meletis13forever


    Is there any other way to express this constraint? I want the load of each BS/femto to be <= of their capacity which is defined in my .dat.
    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: Help with CPLEX Error 5002!

    Posted 02/18/12 05:23 PM

    Originally posted by: SystemAdmin


    You need to linearize the expression for load, which you can do since one of the factors is binary. See my blog post on this.

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #DecisionOptimization
    #MathematicalProgramming-General


  • 5.  Re: Help with CPLEX Error 5002!

    Posted 11/11/13 03:01 AM

    Originally posted by: lydiazhao


    Hi Paul,could you please post your blog post about Error 5002 here?sometimes,there is some proglem to access your blog post.Thank you very much.Lydia


    #DecisionOptimization
    #MathematicalProgramming-General


  • 6.  Re: Help with CPLEX Error 5002!

    Posted 11/11/13 03:56 PM

     

    Lydia, I'm afraid that it would not be legible here; this forum does not have math fonts. It would also be to long, and might violate forum use rules.

    The link above works for me. If your browser does not handle the math fonts, and if you are willing to supply an email address here, I can send you a copy (probably PDF).

     

     

     

     

     

     


    #DecisionOptimization
    #MathematicalProgramming-General


  • 7.  Re: Help with CPLEX Error 5002!

    Posted 02/22/12 12:41 PM

    Originally posted by: meletis13forever


    First of all thank you for the tip. I have read very carefully your article in the blog and I wrote down to ILOG the constaints as you mentioned but I still get this 5002 error. The first variable is binary (dvar boolean xterminalmacroBS union femto;) and the bounds for the second constraint are here:

    forall(i in terminal)
    b[i] == 64 || b[i] == 128 || b[i] == 256 || b[i] == 384 || b[i] == 512 || b[i] ==1024;

    And here is the new code in the subject to block:

    forall(j in macroBS union femto)
    load[j] <= 1024 * sum(i in terminal) x[i][j];

    forall(j in macroBS union femto)
    load[j] >= 64 * sum(i in terminal) x[i][j];

    forall(j in macroBS union femto)
    load[j] <= sum(i in terminal) (b[i] - 64 * (1 - x[i][j]));

    forall(j in macroBS union femto)
    load[j] >= sum(i in terminal) (b[i] - 1024 * (1 - x[i][j]));

    Can you help me? Where is the mistake?
    #DecisionOptimization
    #MathematicalProgramming-General


  • 8.  Re: Help with CPLEX Error 5002!

    Posted 02/23/12 11:25 AM

    Originally posted by: SystemAdmin


    I think that you need to introduce a new variable for each term in the summation that defines load_j. Call the new variables w_{ij}. They can be declared as float variables. The constraints you want are:
    
    load_j = \sum_i w_
    {ij
    } \forall j w_
    {ij
    } \le 1024 x_
    {ij
    } \forall i,j w_
    {ij
    } \ge 64 x_
    {ij
    } \forall i,j w_
    {ij
    } \le b_i - 64(1 - x_
    {ij
    }) \forall i,j w_
    {ij
    } \ge b_i - 1024(1 - x_
    {ij
    }) \forall i,j
    


    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #DecisionOptimization
    #MathematicalProgramming-General


  • 9.  Re: Help with CPLEX Error 5002!

    Posted 02/28/12 12:21 PM

    Originally posted by: meletis13forever


    Hello,

    I wrote the script:

    forall(j in macroBS union femto)
    load[j] == sum(i in terminal) w[i][j];

    forall(i in terminal, j in macroBS union femto)
    w[i][j] <= 1024 * x[i][j];

    forall(i in terminal, j in macroBS union femto)
    w[i][j] >= 64 * x[i][j];

    forall(i in terminal, j in macroBS union femto)
    w[i][j] <= (b[i] - 64 * (1 - x[i][j]));

    forall(i in terminal, j in macroBS union femto)
    w[i][j] >= (b[i] - 1024 * (1 - x[i][j]));

    and defined the variables as you said:

    dvar float wterminalmacroBS union femto;

    But again the same problem. Any more ideas?
    #DecisionOptimization
    #MathematicalProgramming-General


  • 10.  Re: Help with CPLEX Error 5002!

    Posted 03/01/12 11:59 AM

    Originally posted by: meletis13forever


    I converted
    dexpr int loadj in macroBS union femto = sum(i in terminal) x[i][j] * b[i] ;

    to
    dexpr float loadj in macroBS union femto = sum(i in terminal) w[i][j] ;

    and wrote the constraints you said me
    forall(i in terminal, j in macroBS union femto)
    w[i][j] <= 1024 * x[i][j];

    forall(i in terminal, j in macroBS union femto)
    w[i][j] >= 64 * x[i][j];

    forall(i in terminal, j in macroBS union femto)
    w[i][j] <= (b[i] - 64 * (1 - x[i][j]));

    forall(i in terminal, j in macroBS union femto)
    w[i][j] >= (b[i] - 1024 * (1 - x[i][j]));

    and finally the model is running. All these constraints with w[i][j] are the same as my first dvar? do the same thing?
    #DecisionOptimization
    #MathematicalProgramming-General


  • 11.  Re: Help with CPLEX Error 5002!

    Posted 03/01/12 05:47 PM

    Originally posted by: SystemAdmin


    All those constraints serve to ensure that each w[i][j] matches one of the terms in your original definition of load[i].

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #DecisionOptimization
    #MathematicalProgramming-General