当前位置:文档之家› 运筹学实验报告一

运筹学实验报告一

例3 某家具公司制造书桌、餐桌和椅子,所用资源有三种:木料、木工和漆工。

生产数据表如表所示,若要求桌子生产量不超过5件,问如何安排三种产品的生产可使产品利润最大?
书桌 餐桌 椅子 资源总数 木料 8 6 1 48 漆工 4 2 1.5 20 木工 2 1.5 0.5 8 成品单价
60
30
20
解:假设书桌、餐桌和椅子的生产数量分别为:X1、X2和X3,依题意建立如下线性规划模型:
12312312312312123603020864842 1.520.2 1.50.585,,0Maxf x x x x x x x x x s t x x x x x x x x =++++≤⎧⎪
++≤⎪⎪
++≤⎨⎪+≤⎪⎪≥⎩且取整数
(1)在LINGO 中输入:
max 60x1+30x2+20x3
st8x1+6x2+x3<=48 4x1+2x2+1.5x3<=20 2x1+1.5x2+0.5x3<=8 x1+x2<=5 end gin3
(2)执行运行结果为:
Global optimal solution found.
Objective value: 280.0000 Objective bound: 280.0000 Infeasibilities: 0.000000 Extended solver steps: 0 Total solver iterations: 3
Variable Value Reduced Cost X1 2.000000 -60.00000 X2 0.000000 -30.00000 X3 8.000000 -20.00000
Row Slack or Surplus Dual Price 1 280.0000 1.000000 2 24.00000 0.000000 3 0.000000 0.000000 4 0.000000 0.000000 5 3.000000 0.000000
(3)结果分析:得到最优解f= 280.0000,X1= 2.000000,X2 =0.000000,X3 =8.000000。

例4:有某种物资需要从3个产地运到4个销地,产量、销量及单位运费如表所示,试求总运费最少的运输方案和总运费。

(1)在LINGO 中输入:
model :
!3 Warehouse,4 Customer Transportation Problem; sets :
Warehouse/1..3/:a; Customer/1..4/:b;
Routes(Warehouse,Customer):c,x; endsets
!Here are the parameters; data :
a=30,25,21; b=15,17,22,12; c=6,2,6,7, 4,9,5,3, 8,8,1,5; enddata
! The objective;
[OBJ]min = @sum (Routes:c*x); ! The supply constraints; @for (Warehouse(i):[SUP]
@sum (Customer(j):x(i,j))<=a(i)); ! The demand constraints; @for (Customer(j):[DEM]
@sum (Warehouse(i):x(i,j))=b(j));
End
(2)执行运行结果为:
Global optimal solution found.
Objective value: 161.0000 Infeasibilities: 0.000000。

相关主题