决策变量不允许 CPLEX 模型

Decision variable not allowed CPLEX model

 int NStations1= ...; int Nstations2=...;

range Stations1= 1..NStations1; range Stations2= 1..Nstations2;

int demand1[Stations1]=...; int demand2[Stations2]=...; int 
distance[Stations1][Stations2]=...;

int AvailTime=...; int Capacity=...;

dvar float+ x[Stations1][Stations2]; dvar float+ f[Stations1] 
[Stations2];

 minimize sum(i in Stations1) sum(j in Stations2) x[i][j]*distance[i] 
[j];

 subject to {

 forall (i in Stations1) sum(i in Stations1, j in Stations2) (f[j][i]- 
f[i][j]) <= demand1[i];

 forall (i in Stations1) sum(j in Stations2) x[i][j] == 1 ;

 forall (i in Stations1) sum(j in Stations2) x[j][i] == 1;

 forall (i in Stations1) 0<= f[i][j] <= x[i][j]*C;

问题:我在最后一行 x[i]*[j] 中得到错误,乘以 C,这就是他给出决策变量不允许的错误的地方

数据文件:

NSstations1=5; Nstations2=5;

需求1=[5, 3, 10, 7, 8];需求 2=[5, 3, 10, 7, 8];距离=[ [0 7 2 3 4 ] [ 2 0 2 3 3 ] [1 4 0 2 1 ] [7 3 1 0 3 ] [4 7 5 3 0 ] ];可用时间=3600;容量= 70;

如果你添加

int C=10;

forall (i in Stations1) 0<= f[i][j] <= x[i][j]*C;

进入

forall (i in Stations1, j in Stations2) 
 {
   0<= f[i][j];
    f[i][j] <= x[i][j]*C;
 }

你的模型会更好

注意:

如果 x,y,z 是决策变量 x<=y<=z 是禁止的,应该变成 x<=y 和 y<=z