求每一行的解释,尤其那个for循环.lingo关于最小运输费用的编程问题.
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 18:07:33
求每一行的解释,尤其那个for循环.lingo关于最小运输费用的编程问题.
求每一行的解释,尤其那个for循环.
model:
6 发点 8 收点运输问题;
sets:
warehouses/wh1..wh6/:capacity;
vendors/v1..v8/:demand;
links(warehouses,vendors):cost,volume;
endsets
目标函数;
min=@sum(links:cost*volume);
需求约束;
@for(vendors(J):
@sum(warehouses(I):volume(I,J))=demand(J));
产量约束;
@for(warehouses(I):
@sum(vendors(J):volume(I,J))
求每一行的解释,尤其那个for循环.
model:
6 发点 8 收点运输问题;
sets:
warehouses/wh1..wh6/:capacity;
vendors/v1..v8/:demand;
links(warehouses,vendors):cost,volume;
endsets
目标函数;
min=@sum(links:cost*volume);
需求约束;
@for(vendors(J):
@sum(warehouses(I):volume(I,J))=demand(J));
产量约束;
@for(warehouses(I):
@sum(vendors(J):volume(I,J))
!需求约束;
@for(vendors(J):
@sum(warehouses(I): volume(I,J))=demand(J));
首先先看里面的嵌套:@sum(warehouses(I): volume(I,J))=demand(J) 意思从1到i的产地分别运往接受地J的产量总和满足J的需求,外面的@for(vendors(J))是从1到J的意思.
!产量约束;
@for(warehouses(I):
@sum(vendors(J): volume(I,J))
@for(vendors(J):
@sum(warehouses(I): volume(I,J))=demand(J));
首先先看里面的嵌套:@sum(warehouses(I): volume(I,J))=demand(J) 意思从1到i的产地分别运往接受地J的产量总和满足J的需求,外面的@for(vendors(J))是从1到J的意思.
!产量约束;
@for(warehouses(I):
@sum(vendors(J): volume(I,J))