Lingo与最小费用运输问题

Lingo与最小费用运输问题

Lingo与最小费用运输问题_第1张图片

代码如下:

model:
!6发点8 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))=capacity(I)); !产量约束;
!这里是数据;
data:
  capacity=55 47 42 52 41 32;   
  demand=60 55 51 43 41 52 43 38; 
  cost=6 2 9 7 4 2 5 9
       4 5 5 3 8 5 3 2
       5 2 1 3 7 4 8 3     
       7 6 7 9 9 2 7 1
       2 3 6 5 7 2 6 5
       5 9 2 2 8 1 4 3;
enddata
end

你可能感兴趣的:(lingo程序)