lingo运输问题设有两个工厂A、B,产量都是10万个,工厂有三个仓库x,y,z,产品都先送到仓库。现有四个顾
发布网友
发布时间:2022-04-30 00:13
我来回答
共1个回答
热心网友
时间:2023-10-10 23:37
这里面transport1 2分别代表从工厂到仓库和从仓库到顾客的运输量
model:
sets:
factory/1,2/:output;
warehouse/1,2,3/;
customer/1..4/:demand;
link1(factory,warehouse):cost1,transport1;
link2(warehouse,customer):cost2,transport2;
endsets
data:
output=10 10;
demand=3 5 4 5;
cost1=
4 2 5
3 1 2;
cost2=
5 7 10 20
9 6 7 15
20 6 7 4;
enddata
min=@sum(link1:cost1*transport1)+@sum(link2:cost2*transport2);
@for(factory(i):@sum(warehouse(j):transport1(i,j))<=output(i));
@for(customer(k):@sum(warehouse(j):transport2(j,k))=demand(k));
@for(warehouse(j):@sum(customer(k):transport2(j,k))<=@sum(factory(i):transport1(i,j)));
end