2023
年中
石油大学
建模
作业
中国石油大学-建模作业
数学规划上机实践作业一
1 首先练习一下书中线性规划案例。
2 某企业和用户签定了设备交货合同,该企业各季度的生产能力、每台设备的生产本钱和每季度末的交货量见下表,假设生产出的设备当季度不交货,每台设备每季度需要支付保管费0.1万元,试问在遵守合同的条件下,企业应如何安排生产方案,才能使年消消耗用最低?
季度
工厂生产能力(台)
交货量(台)
每台设备生产本钱(万元/台)
1
25
15
12.0
2
35
20
11.0
3
30
25
11.5
4
20
20
12.5
变量定义:设第季度生产台,;
模型假设:,①每个季度都交货交满②第四季度交货后无设备剩余;
目标函数:
约束条件: ,
,
,
,
。
Lingo程序:
model:
min=12xx1+(x1-15)x0.1+11xx2+(x2+x1-15-20)x0.1+x3x11.5+(x3+x2+x1-15-20-25)x0.1+x4x12.5;
x2+x1>=35;
x3+x2+x1>=60;
x4+x3+x2+x1=80;
x1>=15;
x2<=35;
x3<=30;
x4<=20;
@gin(x1);@gin(x2);@gin(x3);@gin(x4);
End
程序运行结果:
Global optimal solution found.
Objective value: 913.5000
Objective bound: 913.5000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X1 15.00000 12.30000
X2 35.00000 11.20000
X3 30.00000 11.60000
X4 0.000000 12.50000
Row Slack or Surplus Dual Price
1 913.5000 -1.000000
2 0.000000 0.000000
3 15.00000 0.000000
4 20.00000 0.000000
5 0.000000 0.000000
6 0.000000 0.000000
7 0.000000 0.000000
8 20.00000 0.000000
建模结果:第一季度生产15台,第二季度生产35台,第三季度生产30台,第四季度生产0台,最小值913.5万元。
3.
五名选手的百米成绩如上所示;如何选拔队员组成4′100米混合泳接力队 讨论:丁的蛙泳成绩退步到1’15〞2;戊的自由泳成绩进步到57〞5, 组成接力队的方案是否应该调整?
变量定义:设表示第个人参加第个工程, 表示第个人没有参加第个工程,为第个人的第个工程的成绩()。
目标函数:。
约束条件:每个人最多参加一个工程,所以,每个工程必须有且最多有一个人选择,所以,同时有。
Lingo程序
Model:
sets:
person/1..5/;
position/1..4/;
link(person,position):x,a;
endsets
data:
a=66.8,75.6,87,58.6,
57.2,66,66.4,53,
78,67.8,84.6,59.4,
70,74.2,69.6,57.2,
67.4,71,83.8,62.4;
enddata
min=@sum(link:xxa);
@for(person(i):@sum(position(j):x(i,j))<=1;);
@for(position(j):@sum(person(i):x(i,j))=1;);
@for(link:@bin(x));
end
程序运行结果
Global optimal solution found.
Objective value: 253.2000
Objective bound: 253.2000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X( 1, 1) 0.000000 66.80000
X( 1, 2) 0.000000 75.60000
X( 1, 3) 0.000000 87.00000
X( 1, 4) 1.000000 58.60000
X( 2, 1) 1.000000 57.20000
X( 2, 2) 0.000000 66.00000
X( 2, 3) 0.000000 66.40000
X( 2, 4) 0.000000 53.00000
X( 3, 1) 0.000000 78.00000
X( 3, 2) 1.000000 67.80000
X( 3, 3) 0.000000 84.60000
X( 3, 4) 0.000000 59.40000
X( 4, 1) 0.000000 70.00000
X( 4, 2) 0.000000 74.20000
X( 4, 3) 1.000000 69.60000
X( 4, 4) 0.000000 57.20000
X( 5, 1) 0.000000 67.40000
X( 5, 2) 0.000000 71.00000
X( 5, 3) 0.000000 83.80000
X( 5, 4) 0.000000 62.40000
A( 1, 1) 66.80000 0.000000
A( 1, 2) 75.60000 0.000000
A( 1, 3) 87.00000 0.000000
A( 1, 4) 58.60000 0.000000
A( 2, 1) 57.20000 0.000000
A( 2, 2) 66.00000 0.000000
A( 2, 3) 66.40000 0.000000
A( 2, 4) 53.00000 0.000000
A( 3, 1) 78.00000 0.000000
A( 3, 2) 67.80000 0.000000
A( 3, 3) 84.60000 0.000000
A( 3, 4) 59.40000 0.000000
A( 4, 1) 70.00000 0.000000
A( 4, 2) 74.20000 0.000000
A( 4, 3) 69.60000 0.000000
A( 4, 4) 57.20000 0.000000
A( 5, 1) 67.40000 0.000000
A( 5, 2) 71.00000 0.000000
A( 5, 3) 83.80000 0.000000
A( 5, 4) 62.40000 0.000000
Row Slack or Surplus Dual Price
1 253.2000 -1.000000
2 0.000000 0.000000
3 0.000000 0.000000
4 0.000000 0.000000
5 0.000000 0.000000
6 1.000000 0.000000
7 0.000000 0.000000
8 0.000000 0.000000
9 0.000000 0.000000
10 0.000000 0.000000
模型结论
甲乙丙丁4人组队分别参加自由泳、蝶泳、仰泳、蛙泳的比赛,成绩为253.2s=4’13〞2 。
模型分析
当队员丁的蛙泳成绩有较大退步,只有1’15〞2;而戊的自由泳成绩进步到57〞5,对lingo程序进行修改,重新建模。
程序以及运行结果为
Model:
sets:
person/1..5/;
position/1..4/;
link(person,position):x,a;
endsets
data:
a=66.8,75.6,87,58.6,
57.2,66,66.4,53,
78,67.8,84.6,59.4,
70,74.2,75.2,57.2,
67.4,71,83.8,57.5;
enddata
min=@sum(link:xxa);
@for(person(i):@sum(position(j):x(i,j))<=1;);
@for(position(j):@sum(person(i):x(i,j))=1;);
@for(link:@bin(x));
end
Global optimal solution found.
Objective value: 257.7000
Objective bound: 257.7000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X( 1, 1) 0.000000 66.80000
X( 1, 2) 0.000000 75.60000
X( 1, 3) 0.000000 87.00000
X( 1, 4) 0.000000 58.60000
X( 2, 1) 1.000000 57.20000
X( 2, 2) 0.000000 66.00000
X( 2, 3) 0.000000 66.40000
X( 2, 4) 0.000000 53.00000
X( 3, 1) 0.000000 78.00000
X( 3, 2) 1.000000 67.80000
X( 3, 3) 0.000000 84.60000
X( 3, 4) 0.000000 59.40000
X( 4, 1) 0.000000 70.00000
X( 4, 2) 0.000000 74.20000
X( 4, 3) 1.000000 75.20000
X( 4, 4) 0.000000 57.20000
X( 5, 1) 0.000000 67.40000
X( 5, 2) 0.000000 71.00000
X( 5, 3) 0.000000 83.80000
X( 5, 4) 1.000000 57.50000
A( 1, 1) 66.80000 0.000000
A( 1, 2) 75.60000 0.000000
A( 1, 3) 87.00000 0.000000
A( 1, 4) 58.60000 0.000000
A( 2, 1) 57.20000 0.000000
A( 2, 2) 66.00000 0.000000
A( 2, 3) 66.40000 0.000000