发布网友 发布时间:2022-05-02 15:59
共2个回答
热心网友 时间:2022-06-20 18:51
model:
!4人4工作的分配问题;
title:assignment problem;!分配问题;
sets:
warehouses/wh1..wh4/:capacity;
vendors/v1..v4/: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=1 1 1 1;
demand=1 1 1 1;
cost=2 15 13 4
10 4 14 15
9 14 16 13
7 8 11 9;
enddata
end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global optimal solution found.
Objective value: 28.00000
Total solver iterations: 0
Model Title: :assignment problem
Variable Value Reced Cost
CAPACITY( WH1) 1.000000 0.000000
CAPACITY( WH2) 1.000000 0.000000
CAPACITY( WH3) 1.000000 0.000000
CAPACITY( WH4) 1.000000 0.000000
DEMAND( V1) 1.000000 0.000000
DEMAND( V2) 1.000000 0.000000
DEMAND( V3) 1.000000 0.000000
DEMAND( V4) 1.000000 0.000000
COST( WH1, V1) 2.000000 0.000000
COST( WH1, V2) 15.00000 0.000000
COST( WH1, V3) 13.00000 0.000000
COST( WH1, V4) 4.000000 0.000000
COST( WH2, V1) 10.00000 0.000000
COST( WH2, V2) 4.000000 0.000000
COST( WH2, V3) 14.00000 0.000000
COST( WH2, V4) 15.00000 0.000000
COST( WH3, V1) 9.000000 0.000000
COST( WH3, V2) 14.00000 0.000000
COST( WH3, V3) 16.00000 0.000000
COST( WH3, V4) 13.00000 0.000000
COST( WH4, V1) 7.000000 0.000000
COST( WH4, V2) 8.000000 0.000000
COST( WH4, V3) 11.00000 0.000000
COST( WH4, V4) 9.000000 0.000000
VOLUME( WH1, V1) 0.000000 2.000000
VOLUME( WH1, V2) 0.000000 12.00000
VOLUME( WH1, V3) 0.000000 7.000000
VOLUME( WH1, V4) 1.000000 0.000000
VOLUME( WH2, V1) 0.000000 9.000000
VOLUME( WH2, V2) 1.000000 0.000000
VOLUME( WH2, V3) 0.000000 7.000000
VOLUME( WH2, V4) 0.000000 10.00000
VOLUME( WH3, V1) 1.000000 0.000000
VOLUME( WH3, V2) 0.000000 2.000000
VOLUME( WH3, V3) 0.000000 1.000000
VOLUME( WH3, V4) 0.000000 0.000000
VOLUME( WH4, V1) 0.000000 2.000000
VOLUME( WH4, V2) 0.000000 0.000000
VOLUME( WH4, V3) 1.000000 0.000000
VOLUME( WH4, V4) 0.000000 0.000000
Row Slack or Surplus Dual Price
1 28.00000 -1.000000
2 0.000000 -5.000000
3 0.000000 -8.000000
4 0.000000 -11.00000
5 0.000000 -9.000000
6 0.000000 5.000000
7 0.000000 4.000000
8 0.000000 -4.000000
9 0.000000 0.000000
热心网友 时间:2022-06-20 18:52
model: