Originally posted by: Rym
Hi,
I have a model that is a little bit complex, i can't express a decision variable that take différents sizes, depending of the entry. And also, i have an error in the execute"xvd"
If i have an array "VDC "of Vtuple, Vtuple is composed as the following
//ILP
int RQ=5;
range nRQ=1..RQ;
tuple Vtuple
{
int nv;
int cpui[nv] // cpui array must take the size nv;
}
Vtuple VDC[nRQ];
int CPUj[P];
// fill the VDC array
execute xvd
{
for(var i in VDC )
{
VDC[i].nv=1+rand(3);;
for(var j in VDC[i].cpui )
{
VDC[i].cpui[j]= 1+rand(3);
}
}
}
//model
dvar boolean vq[nRQ];
dvar boolean lumda[nRQ][?????]; // it depends of the entry " nv" in the tuple Vtuple
dexpr int O = sum( i in nRQ) vq[i];
maximize O;
//constraint
subject to{
xv:
forall(i in nRQ,j in 1..VDC[i].nv)
sum(k in P) lumda[i][j][k]==vq[i];
//une machine virtuelle est hébergée par au plus une seule pm
limit:
forall( i in nRQ,j in 1..VDC[i].nv )
sum( k in P ) lumda[i][j][k] <= 1;
//la quantité de cpu consommée par les vms ne depasse la la quantité de cpu de la pm j
cpur:
forall( k in P)
sum( i in nRQ)sum(j in 1..VDC[i].nv) VDC[i].cpui[j]*lumda[i][j][k] <= CPUj[k];
}
#DecisionOptimization#OPLusingCPLEXOptimizer