Topic
• 10 replies
• Latest Post - ‏2013-11-11T20:56:18Z by PaulRubin
meletis13forever
28 Posts

# Pinned topic Help with CPLEX Error 5002!

‏2012-01-23T08:50:34Z |
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("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)

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

}
execute{
}
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)

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.
Updated on 2012-03-01T22:47:01Z at 2012-03-01T22:47:01Z by SystemAdmin
754 Posts

#### Re: Help with CPLEX Error 5002!

‏2012-01-23T23:57:26Z
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)
• meletis13forever
28 Posts

#### Re: Help with CPLEX Error 5002!

‏2012-02-15T16: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.
754 Posts

#### Re: Help with CPLEX Error 5002!

‏2012-02-18T22:22:38Z
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.
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)
• meletis13forever
28 Posts

#### Re: Help with CPLEX Error 5002!

‏2012-02-22T17: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?
754 Posts

#### Re: Help with CPLEX Error 5002!

‏2012-02-23T16:25:12Z
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?
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:

{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)
• meletis13forever
28 Posts

#### Re: Help with CPLEX Error 5002!

‏2012-02-28T17:21:25Z
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?
• meletis13forever
28 Posts

#### Re: Help with CPLEX Error 5002!

‏2012-03-01T16: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?
754 Posts

#### Re: Help with CPLEX Error 5002!

‏2012-03-01T22:47:01Z
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?
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)
• lydiazhao
1 Post

#### Re: Help with CPLEX Error 5002!

‏2013-11-11T08:00:50Z
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

• PaulRubin
63 Posts

#### Re: Help with CPLEX Error 5002!

‏2013-11-11T20:56:18Z
• lydiazhao
• ‏2013-11-11T08: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).