Pinned topic Help with CPLEX Error 5002!
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..NbPL1;
float lPL=...;
int NbBL=...;
range BL = 0..NbBL1;
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.xdummy.xter)^2 + (posBS_femto.ydummy.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 semidefinite.
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.

Re: Help with CPLEX Error 5002!
20120123T23:57:26ZThis is the accepted answer. This is the accepted answer.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) 
Re: Help with CPLEX Error 5002!
20120218T22:22:38ZThis is the accepted answer. This is the accepted answer. meletis13forever
 20120215T16:50:27Z
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.
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) 
Re: Help with CPLEX Error 5002!
20120222T17:40:40ZThis is the accepted answer. This is the accepted answer.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? 
Re: Help with CPLEX Error 5002!
20120223T16:25:12ZThis is the accepted answer. This is the accepted answer. meletis13forever
 20120222T17:40:40Z
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?
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) 
Re: Help with CPLEX Error 5002!
20120228T17:21:25ZThis is the accepted answer. This is the accepted answer.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? 
Re: Help with CPLEX Error 5002!
20120301T16:59:09ZThis is the accepted answer. This is the accepted answer.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? 
Re: Help with CPLEX Error 5002!
20120301T22:47:01ZThis is the accepted answer. This is the accepted answer. meletis13forever
 20120301T16:59:09Z
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?
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) 
Re: Help with CPLEX Error 5002!
20131111T08:00:50ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20120218T22:22:38Z
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)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

Re: Help with CPLEX Error 5002!
20131111T20:56:18ZThis is the accepted answer. This is the accepted answer. lydiazhao
 20131111T08:00:50Z
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
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).