如何在Zimpl中编写子轮廓消除约束?

时间:2018-10-06 12:13:51

标签: node.js

我正在将Zimpl与Scip一起使用以解决TSP牛奶收集问题,如果有人帮助我如何为以下.Zpl文件编写子行程消除约束的代码,则会收到一条错误消息

set V:={read "milk.dat" as "<1n>" comment "#"};

set E:=V*V;

set T:={1,2};

set S[]:=subsets(V without 0); #subtour`enter code here`

param truck_Capacity:=80;`enter code here`
param east[V]:=read "milk.dat" as "<1n> 2n";`enter code here`
param north[V]:=read "milk.dat" as "<1n> 3n";`enter code here`
param freq[V]:=read "milk.dat" as "<1n> 4n";`enter code here`
param requar[V]:=read "milk.dat" as "<1n> 5n";`enter code here`
param dist[<i,j> in E]:= sqrt((east[i]-east[j])^2+(north[i]-north[j])^2);`enter code here`

var X[E*T] binary;# Nodes `enter code here`
var Y[V*T] binary;# Edges `enter code here`

minimize distance:sum <i,j,t> in E*T do X[i,j,t]*dist[i,j];`enter code here`

subto start_at_depot:forall <t> in T do sum <j> in V\{0} do X[0,j,t] ==1;`enter code here`
subto end_at_depot:forall <t> in T do sum <i> in V\{0} do X[i,0,t] ==1;`enter code here`

subto visit_every_farm:forall <j> in V\{0} do sum <i,t> in (V\{j})*T do X[i,j,t]==freq[j];`enter code here`

subto flow_conservation:forall <t> in T do forall <j> in V\{0} do sum <i> in V do X[i,j,t] ==sum <a> in V do X[j,a,t];`enter code here`

subto capacity:forall <t> in T do sum <i,j> in E do X[i,j,t]*requar[i]<=truck_Capacity;`enter code here`

subto every_oter_day:forall <t> in T do sum <i,j> in E do X[i,j,t]==sum <l> in V do 2*Y[l,t];`enter code here`

subto sub:forall <t> in T do sum <i,j> in E do sum <i> in S\{j} do X[i,j,t]>=2;`enter code here`

#subto subtour:forall <k> in S do forall <t> in T do sum <i> in V\{k} do sum <j> in S do sum <i,j> in E do X[i,j,t] + sum <i> in S do sum <j> in V\{k} do sum <i,j> in E do X[i,j,t]>=sum <k> in S do 2*Y[k,t];

0 个答案:

没有答案