我正在尝试构建具有硬时间窗口约束的 conVRP 模型。但是,我被流入和流出限制所困扰。
我有四套:
range N = 1..20 // set of Nodes
range P = 1..19 // set of customers
range D = 1..5 // set of Days
range K = 1..2 // set of Vehicles
然后我有一些其他的输入参数
int q[D][N] = ...; //demand matrix of 5*20
int cap = ...; // capacity of a truck
三个决策变量:
dvar boolean x[N][N][D][K]; //= one if node i visits node j on day d with vehicle k
dvar float+ y[N][D][K]; // arrival time
dvar boolean z[N][K]; // = one if node n is visisted by vehicle k
//客观的
minimize sum(i,j in N, d in D, k in K) x[i][j][d][k] * c[i][j];
我遇到的限制是:
forall(d in D, i in N: q[i][d]>=1)
sum (j in N, k in K) x[i][j][k][d] == 1; //outflow
forall(d in D, j in N : q[j][d]>=1)
sum(i in N, k in K) x[j][i][k][d] == 1; //inflow
我收到这些错误消息:
我很想知道如何解决这个问题。您的帮助将不胜感激!