我为一个项目编写了代码。但是第96行有太多错误。我的项目的目的是最大限度地减少工厂中物料流和部门与站点之间的距离。显然,目的是通过改变工厂布局来减少物流中的时间损失。但最关键的一点是,各部门和车站之间只是交换位置。即部门1和部门4或者站3和站10可以被交换。但是3号部门和5号站不能互换。请帮帮我!
SETS
i departments /1*6/
j stations /1*10/
m departments2 /1*6/
n stations2 /1*10/ ;
PARAMETERS
Table
Workflow(i, j) Workflow matrix
1 2 3 4 5 6 7 8 9 10
1 1 1 3 3 3 3 0 4 5 3
2 4 6 5 7 6 6 8 9 7 6
3 1 0 5 4 1 0 0 6 6 5
4 5 8 5 6 7 0 0 1 1 6
5 3 0 4 0 0 0 0 5 6 5
6 3 4 3 0 5 0 4 10 9 4;
PARAMETERS
Table
Distance(m, n) Distance matrix
1 2 3 4 5 6 7 8 9 10
1 35 47 61 74 81 97 111 125 137 55
2 68 86 90 98 104 103 79 78 90 67
3 312 323 335 344 358 367 377 393 414 318
4 72 83 95 106 118 128 136 151 173 57
5 116 0 97 0 0 0 0 39 28 193
6 83 87 69 0 52 0 18 17 12 171;
VARIABLES
y(m, n) Binary variables
a(j, n) Binary variables
b(i, m) Binary variables
z Objective function;
BINARY VARIABLES
Q(i, j, m, n);
EQUATIONS
c1(n)
c2(j)
c3(i, j, m, n)
c4(i, j, m, n)
c5(i, j, m, n)
c6(i)
c7(m)
c8(i, j, m, n)
t1(n)
t2(n)
t3(n)
t4(n)
t5(n)
t6(n)
t7(n)
t8(n)
t9(n)
t10(n)
k1(m)
k2(m)
k3(m)
k4(m)
k5(m)
k6(m);
c1(n).. sum(j, a(j, n)) =e= 1;
c2(j).. sum(n, a(j, n)) =e= 1;
c6(i).. sum(m, b(i, m)) =e= 1;
c7(m).. sum(i, b(i, m)) =e= 1;
c3(i, j, m, n).. Q(i, j, m, n) =l= a(j, n);
c8(i, j, m, n).. Q(i, j, m, n) =l= b(i, m);
c4(i, j, m, n).. Q(i, j, m, n) =l= y(m, n);
c5(i, j, m, n).. Q(i, j, m, n) =g= a(j, n) + y(m, n) + b(i, m) - 1;
t1(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t2(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t3(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t4(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t5(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t6(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t7(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t8(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t9(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
t10(n).. sum((i, j, m), Q(i, j, m, n)) =e= 1;
k1(m).. sum((n, i,j), Q(i, j, m, n)) =e= 1;
k2(m).. sum((n, i,j), Q(i, j, m, n)) =e= 1;
k3(m).. sum((n, i,j), Q(i, j, m, n)) =e= 1;
k4(m).. sum((n, i,j), Q(i, j, m, n)) =e= 1;
k5(m).. sum((n, i,j), Q(i, j, m, n)) =e= 1;
k6(m).. sum((n, i,j), Q(i, j, m, n)) =e= 1;
min.. z =e= sum((i, j, m, n), workflow(i, j) * Distance(m, n) * Q(i, j, m, n));
Model Layout /all/;
Solve Layout using RMIP minimizing z;
错误太多了,没用。