Originally posted by: skyskyhuanghuang
Hi,everyone.I encountered a problem.
using CP;
int M=...;
float P=...;
float H[1..M][1..M]=...;
float B0=...;
float n0=...;
dvar int Yji[1..M][1..M] in 0..1 ;
execute
{
var p=cp.param;
p.LogPeriod=80000;
p.TimeLimit=300;
p.Workers=40;
p.searchType="Restart";
p.OptimalityTolerance=1;
}
maximize
B0*sum(i in 1..M)(
log(1+P*sum(j in 1..M:j!=i)(
H[j][i]*Yji[j][i]/ //fenzi
(n0+P*sum(n in 1..M:n!=j)(
sum(q in 1..M)H[n][i]*Yji[n][q]
)
)
)
)/log(2)
);
subject to
{
forall(i in 1..M)
{
Hangyueshu:
sum(j in 1..M)
Yji[i][j]<=1;
}
forall(i in 1..M)
{
Lieyueshu:
sum(j in 1..M)
Yji[j][i]<=1;
}
forall(i in 1..M)
Zishenyueshu:
Yji[i][i]==0;
forall(i in 1..M)
{
FDRLimiation:
sum(j in 1..M)
(Yji[i][j]+Yji[j][i])-Yji[i][i]<=2;
}
}
execute
{
writeln("Yji=",Yji);
writeln("Objective= ",cp.getObjValue());
}
main
{
var nbsol=0;
thisOplModel.generate();
cp.startNewSearch();
while(cp.next())
{
nbsol++;
writeln("solution ",nbsol);
thisOplModel.postProcess();
}
}
The data file is as follows
M=3;
P=0.126;//21dbm 0126w
H=[
[0 5 0]
[0 0 6]
[0 0 0]
];
B0=20e6;
n0=6.3e-13;
The result is as follows:
solution 1
Yji= [[0 1 0]
[0 0 1]
[1 0 0]]
Objective= 1.59978617e+09
However, the decision variable can have other values. The target value is also 1.59978617e+09. For example, the decision variable can be as follows:
Yji= [[0 1 0]
[0 0 1]
[0 0 0]]
How to find all the different solutions of the decision variable corresponding to the optimal value?
#DecisionOptimization#OPLusingCPLEXOptimizer