数学建模全部作业.docx
《数学建模全部作业.docx》由会员分享,可在线阅读,更多相关《数学建模全部作业.docx(85页珍藏版)》请在冰豆网上搜索。
![数学建模全部作业.docx](https://file1.bdocx.com/fileroot1/2022-12/14/bd4aac58-a5c0-4588-9a8c-24e5674b627f/bd4aac58-a5c0-4588-9a8c-24e5674b627f1.gif)
数学建模全部作业
一、图论(组合优化)和排列论实验
解:
设cij表示i年开始到j-1年结束购车的总消费,则有:
C12=2.5+0.3-2.0=0.8,C13=2.5+0.3+0.5-1.6=1.7,C14=2.5+0.3+0.5+0.8-1.3=2.8,C15=2.5+0.3+0.5+0.8+1.2-1.1=4.2,C23=2.6+0.3-2.0=0.9,C24=2.6+0.3+0.5-1.6=1.8,C25=2.6+0.3+0.5+0.8-1.3=2.9,C34=2.8+0.3-2.0=1.1,C35=2.8+0.3+0.5-1.6=2,C45=3.1+0.3-2.0=1.4;
建模如下:
sets:
nodes/1..5/;
arcs(nodes,nodes)|&1#lt#&2:
c,x;
endsets
data:
c=0.81.72.84.2
0.91.82.9
1.12.0
1.4;
enddata
n=@size(nodes);
min=@sum(arcs:
c*x);
@for(nodes(i)|i#ne#1#and#i#ne#n:
@sum(arcs(i,j):
x(i,j))=@sum(arcs(j,i):
x(j,i))
);
@sum(arcs(i,j)|i#eq#1:
x(i,j))=1;
LINGO运行如下:
Globaloptimalsolutionfound.
Objectivevalue:
3.700000
Totalsolveriterations:
0
VariableValueReducedCost
X(1,2)1.0000000.000000
X(2,5)1.0000000.000000
由计算结果分析可得,其最短路径为1->2->5,最小花费为3.7万元。
即:
该单位应该在第一年购买新设备,年末卖掉设备;第二年初更换新设备,一直用到第四年年末,再卖出。
(1)假设每个季度分别生产
万盒除臭剂,
为第一季度后剩余量,
为第二季度后的剩余量,
为第三季度后的剩余量,
为第四季度后的剩余量。
其数学模型为:
Lingo语句:
model:
min=5*x1+5*x2+6*x3+6*x4+y1+y2+y3+y4;
x1>=10;x1<=14;
y1=x1-10;
x2+y1>=14;x2<=15;
y2=x2+y1-14;
x3+y2>=20;x3<=15;
y3=x3+y2-20;
x4+y3>=8;x4<=13;
y4=x4+y3-8;
end
Lingo软件的计算结果:
Globaloptimalsolutionfound.
Objectivevalue:
292.0000
Totalsolveriterations:
0
VariableValueReducedCost
X114.000000.000000
X215.000000.000000
X315.000000.000000
X48.0000000.000000
Y14.0000000.000000
Y25.0000000.000000
Y30.0000000.000000
Y40.0000007.000000
RowSlackorSurplusDualPrice
1292.0000-1.000000
24.0000000.000000
30.0000000.000000
40.0000005.000000
55.0000000.000000
60.0000001.000000
70.0000006.000000
80.000000-2.000000
90.0000001.000000
100.0000005.000000
110.0000000.000000
125.0000000.000000
130.0000006.000000
由计算结果可得第一个季度应生产14万盒,第二季度应该生产15万盒,第三季度应该生产15万盒,第四季度应该生产8万盒除臭剂。
最低费用为292万元。
(2)在其他条件不改变的情况下将第一季度的生产量由14万盒变为13万盒时没有可行方案。
数学模型:
Lingo语句:
model:
sets:
buyer/1..4/:
need;
producer/1..4/:
provide;
matrix(producer,buyer):
c,x;
endsets
min=@sum(matrix:
c*x);
@for(buyer(j):
@sum(producer(i):
x(i,j))=need(j));
@for(producer(i):
@sum(buyer(j):
x(i,j))<=provide(i));
z=@sum(matrix:
c*x);
data:
need=1014208;
provide=13151513;
c=5678
8567
12967
151296;
enddata
end
Lingo软件的计算结果:
Globaloptimalsolutionfound.
Objectivevalue:
294.0000
Totalsolveriterations:
6
VariableValueReducedCost
Z294.00000.000000
NEED
(1)10.000000.000000
NEED
(2)14.000000.000000
NEED(3)20.000000.000000
NEED(4)8.0000000.000000
PROVIDE
(1)13.000000.000000
PROVIDE
(2)15.000000.000000
PROVIDE(3)15.000000.000000
PROVIDE(4)13.000000.000000
C(1,1)5.0000000.000000
C(1,2)6.0000000.000000
C(1,3)7.0000000.000000
C(1,4)8.0000000.000000
C(2,1)8.0000000.000000
C(2,2)5.0000000.000000
C(2,3)6.0000000.000000
C(2,4)7.0000000.000000
C(3,1)12.000000.000000
C(3,2)9.0000000.000000
C(3,3)6.0000000.000000
C(3,4)7.0000000.000000
C(4,1)15.000000.000000
C(4,2)12.000000.000000
C(4,3)9.0000000.000000
C(4,4)6.0000000.000000
X(1,1)10.000000.000000
X(1,2)3.0000000.000000
X(1,3)0.0000000.000000
X(1,4)0.0000004.000000
X(2,1)0.0000004.000000
X(2,2)11.000000.000000
X(2,3)4.0000000.000000
X(2,4)0.0000004.000000
X(3,1)0.0000008.000000
X(3,2)0.0000004.000000
X(3,3)15.000000.000000
X(3,4)0.0000004.000000
X(4,1)0.0000008.000000
X(4,2)0.0000004.000000
X(4,3)1.0000000.000000
X(4,4)8.0000000.000000
RowSlackorSurplusDualPrice
1294.0000-1.000000
20.000000-7.000000
30.000000-8.000000
40.000000-9.000000
50.000000-6.000000
60.0000002.000000
70.0000003.000000
80.0000003.000000
94.0000000.000000
100.0000000.000000
由计算结果分析可得:
第一季度生产
万盒;第二季度生产
万盒;第三季度生产
万盒;第四季度生产
万盒。
最低费用为294万元。
(3)如果不允许延期交货,需要工人加班。
假设第
季度有
万盒除臭剂是加班生产的,则有
。
数学模型如下:
Lingo语句:
model:
sets:
buyer/1..4/:
need;
producer/1..4/:
provide;
matrix(producer,buyer):
c,x,y;
endsets
min=@sum(matrix:
c*(x+1.2*y));
@for(buyer(j):
@sum(producer(i):
x(i,j)+y(i,j))=need(j));
@for(producer(i):
@sum(buyer(j):
x(i,j))<=provide(i));
@for(producer(i):
@sum(buyer(j):
y(i,j))<=2);
z=@sum(matrix:
c*(x+1.2*y));
data:
need=1014208;
provide=13151513;
c=5678
99567
999967
9999996;
enddata
end
Lingo软件的计算结果:
Globaloptimalsolutionfound.
Objectivevalue:
292.0000
Totalsolveriterations:
13
VariableValueReducedCost
Z292.00000.000000
NEED
(1)10.000000.000000
NEED
(2)14.000000.000000
NEED(3)20.000000.000000
NEED(4)8.0000000.000000
PROVIDE
(1)13.000000.000000
PROVIDE
(2)15.000000.000000
PROVIDE(3)15.000000.000000
PROVIDE(4)13.000000.000000
C(1,1)5.0000000.000000
C(1,2)6.0000000.000000
C(1,3)7.0000000.000000
C(1,4)8.0000000.000000
C(2,1)99.000000.000000
C(2,2)5.0000000.000000
C(2,3)6.0000000.000000
C(2,4)7.0000000.000000
C(3,1)99.000000.000000
C(3,2)99.000000.000000
C(3,3)6.0000000.000000
C(3,4)7.0000000.000000
C(4,1)99.000000.000000
C(4,2)99.000000.000000
C(4,3)99.000000.000000
C(4,4)6.0000000.000000
X(1,1)10.000000.000000
X(1,2)2.0000000.000000
X(1,3)0.0000000.000000
X(1,4)0.0000002.000000
X(2,1)0.00000095.00000
X(2,2)10.000000.000000
X(2,3)5.0000000.000000
X(2,4)0.0000002.000000
X(3,1)0.00000095.00000
X(3,2)0.00000094.00000
X(3,3)15.000000.000000
X(3,4)0.0000002.000000
X(4,1)0.00000094.00000
X(4,2)0.00000093.00000
X(4,3)0.00000092.00000
X(4,4)8.0000000.000000
Y(1,1)0.0000001.000000
Y(1,2)0.0000001.200000
Y(1,3)0.0000001.400000
Y(1,4)0.0000003.600000
Y(2,1)0.000000113.8000
Y(2,2)2.0000000.000000
Y(2,3)0.0000000.2000000
Y(2,4)0.0000002.400000
Y(3,1)0.000000113.8000
Y(3,2)0.000000112.8000
Y(3,3)0.0000000.2000000
Y(3,4)0.0000002.400000
Y(4,1)0.000000113.8000
Y(4,2)0.000000112.8000
Y(4,3)0.000000111.8000
Y(4,4)0.0000001.200000
RowSlackorSurplusDualPrice
1292.0000-1.000000
20.000000-5.000000
30.000000-6.000000
40.000000-7.000000
50.000000-6.000000
61.0000000.000000
70.0000001.000000
80.0000001.000000
95.0000000.000000
102.0000000.000000
110.0000000.000000
122.0000000.000000
132.0000000.000000
140.0000000.000000
由计算结果分析可得:
第一季度生产
万盒,
说明不加班生产;第二季度生产
万盒,
说明需要加班生产2万盒;第三季度生产
万盒,
说明不加班生产;第四季度生产
万盒,
说明不加班生产。
最低费用为292万元。
(4)既考虑可以延期交货,也考虑可以加班。
数学模型如下:
Lingo语句:
model:
sets:
buyer/1..4/:
need;
producer/1..4/:
provide;
matrix(producer,buyer):
c,x,y;
endsets
min=@sum(matrix:
c*(x+1.2*y));
@for(buyer(j):
@sum(producer(i):
x(i,j)+y(i,j))=need(j));
@for(producer(i):
@sum(buyer(j):
x(i,j))<=provide(i));
@for(producer(i):
@sum(buyer(j):
y(i,j))<=2);
z=@sum(matrix:
c*(x+1.2*y));
data:
need=1014208;
provide=13151513;
c=5678
8567
12967
151296;
enddata
end
Lingo软件的计算结果:
Globaloptimalsolutionfound.
Objectivevalue:
292.0000
Totalsolveriterations:
14
VariableValueReducedCost
Z292.00000.000000
NEED
(1)10.000000.000000
NEED
(2)14.000000.000000
NEED(3)20.000000.000000
NEED(4)8.0000000.000000
PROVIDE
(1)13.000000.000000
PROVIDE
(2)15.000000.000000
PROVIDE(3)15.000000.000000
PROVIDE(4)13.000000.000000
C(1,1)5.0000000.000000
C(1,2)6.0000000.000000
C(1,3)7.0000000.000000
C(1,4)8.0000000.000000
C(2,1)8.0000000.000000
C(2,2)5.0000000.000000
C(2,3)6.0000000.000000
C(2,4)7.0000000.000000
C(3,1)12.000000.000000
C(3,2)9.0000000.000000
C(3,3)6.0000000.000000
C(3,4)7.0000000.000000
C(4,1)15.000000.000000
C(4,2)12.000000.000000
C(4,3)9.0000000.000000
C(4,4)6.0000000.000000
X(1,1)10.000000.000000
X(1,2)3.0000000.000000
X(1,3)0.0000000.000000
X(1,4)0.0000002.000000
X(2,1)0.0000004.000000
X(2,2)10.000000.000000
X(2,3)5.0000000.000000
X(2,4)0.0000002.000000
X(3,1)0.0000008.000000
X(3,2)0.0000004.000000
X(3,3)15.000000.000000
X(3,4)0.0000002.000000
X(4,1)0.00000010.00000
X(4,2)0.0000006.000000
X(4,3)0.0000002.000000
X(4,4)8.0000000.000000
Y(1,1)0.0000001.000000
Y(1,2)0.0000001.200000
Y(1,3)0.0000001.400000
Y(1,4)0.0000003.600000
Y(2,1)0.0000004.600000
Y(2,2)1.0000000.000000
Y(2,3)0.0000000.2000000
Y(2,4)0.0000002.400000
Y(3,1)0.0000009.400000
Y(3,2)0.0000004.800000
Y(3,3)0.0000000.2000000
Y(3,4)0.0000002.400000
Y(4,1)0.00000013.00000
Y(4,2)0.0000008.400000
Y(4,3)0.0000003.800000
Y(4,4)0.0000001.200000
RowSlackorSurplusDualPrice
1292.0000-1.000000
20.000000-5.000000
30.000000-6.000000
40.000000-7.000000
50.000000-6.000000
60.0000000.000000
70.0000001.000000
80.0000001.000000
95.0000000.000000
102.0000000.000000
111.0000000.000000
122.0000000.000000
132.0000000.000000
140.0000000.000000
由计算结果分析可得:
第一季度生产
万盒,
说明不加班生产;第二季度生产
万盒,
说明需要加班生产1万盒;第三季度生产
万盒,
说明不加班生产;第四季度生产
万盒,
说明不加班生产。
最低费用为292万元。
解答:
分析题意可知,此为工作少于人数的情况。
假设决策变量为
,当第
个人
采用第
种泳姿
时,决策变量
,否则,
;用
表示第
个人采用第
种泳姿时所花费的时间,因此,数学模型如下:
Lingo语句:
model:
sets:
person/Zhao,Qian,Li,Wang,Zhang,Sun/;
swim/Die,Yang,Wa,ZiYou/;
assign(person,swim):
t,x;
endsets
data:
t=54.7,58.2,52.1,53.6,56.4,59.8,
62.2,63.4,58.2,56.5,59.7,61.5,
69.1,70.5,65.3,67.8,68.4,71.3,
52.2,53.8