北京工业大学数学建模选修第五次作业.docx
《北京工业大学数学建模选修第五次作业.docx》由会员分享,可在线阅读,更多相关《北京工业大学数学建模选修第五次作业.docx(14页珍藏版)》请在冰豆网上搜索。
北京工业大学数学建模选修第五次作业
数学建模第五次作业
一、设备更新问题
设
和
表示某台k龄机器的年收入、运行费用和折旧现值,购买一台新机器的费用每年都是I,则每项决策所产生的价值是:
编写lingo程序:
SETS:
nodes/A2,B1,B3,C1,C2,C4,D1,D2,D3,D5,E1,E2,E3,E4,E6,F1,F2,F3,F4,F5,G/;
arcs(nodes,nodes)/
A2,B3A2,B1
B3,C4B3,C1B1,C2B1,C1
C4,D5C4,D1C2,D3C2,D1C1,D2C1,D1
D5,E6D5,E1D3,E4D3,E1D2,E3D2,E1D1,E2D1,E1
E6,F1E4,F5E4,F1E3,F4E3,F1E2,F3E2,F1E1,F2E1,F1
F5,GF4,GF3,GF2,GF1,G/:
c,x;
ENDSETS
DATA:
c=17.3-20.2
15.7-30.218.4-0.2
13.8-50.217.3-20.218.4-0.2
12.2-70.215.7-30.217.3-20.218.4-0.2
-75.213.8-50.215.7-30.217.3-20.218.4-0.2
1030506080;
ENDDATA
n=@size(nodes);
max=@sum(arcs:
c*x);
@sum(arcs(i,j)|i#eq#1:
x(i,j))=1;
@sum(arcs(j,i)|i#eq#n:
x(j,i))=1;
@for(nodes(i)|i#ne#1#and#i#ne#n:
@sum(arcs(i,j):
x(i,j))-@sum(arcs(j,i):
x(j,i))=0
);
@for(arcs:
@bin(x));
运行结果:
Globaloptimalsolutionfound.
Objectivevalue:
72.60000
Objectivebound:
72.60000
Infeasibilities:
0.000000
Extendedsolversteps:
0
Totalsolveriterations:
0
ModelClass:
PILP
Totalvariables:
34
Nonlinearvariables:
0
Integervariables:
34
Totalconstraints:
22
Nonlinearconstraints:
0
Totalnonzeros:
102
Nonlinearnonzeros:
0
VariableValueReducedCost
N21.000000.000000
C(A2,B3)17.300000.000000
C(A2,B1)-20.200000.000000
C(B3,C4)15.700000.000000
C(B3,C1)-30.200000.000000
C(B1,C2)18.400000.000000
C(B1,C1)-0.20000000.000000
C(C4,D5)13.800000.000000
C(C4,D1)-50.200000.000000
C(C2,D3)17.300000.000000
C(C2,D1)-20.200000.000000
C(C1,D2)18.400000.000000
C(C1,D1)-0.20000000.000000
C(D5,E6)12.200000.000000
C(D5,E1)-70.200000.000000
C(D3,E4)15.700000.000000
C(D3,E1)-30.200000.000000
C(D2,E3)17.300000.000000
C(D2,E1)-20.200000.000000
C(D1,E2)18.400000.000000
C(D1,E1)-0.20000000.000000
C(E6,F1)-75.200000.000000
C(E4,F5)13.800000.000000
C(E4,F1)-50.200000.000000
C(E3,F4)15.700000.000000
C(E3,F1)-30.200000.000000
C(E2,F3)17.300000.000000
C(E2,F1)-20.200000.000000
C(E1,F2)18.400000.000000
C(E1,F1)-0.20000000.000000
C(F5,G)10.000000.000000
C(F4,G)30.000000.000000
C(F3,G)50.000000.000000
C(F2,G)60.000000.000000
C(F1,G)80.000000.000000
X(A2,B3)1.000000-17.30000
X(A2,B1)0.00000020.20000
X(B3,C4)0.000000-15.70000
X(B3,C1)1.00000030.20000
X(B1,C2)0.000000-18.40000
X(B1,C1)0.0000000.2000000
X(C4,D5)0.000000-13.80000
X(C4,D1)0.00000050.20000
X(C2,D3)0.000000-17.30000
X(C2,D1)0.00000020.20000
X(C1,D2)1.000000-18.40000
X(C1,D1)0.0000000.2000000
X(D5,E6)0.000000-12.20000
X(D5,E1)0.00000070.20000
X(D3,E4)0.000000-15.70000
X(D3,E1)0.00000030.20000
X(D2,E3)1.000000-17.30000
X(D2,E1)0.00000020.20000
X(D1,E2)0.000000-18.40000
X(D1,E1)0.0000000.2000000
X(E6,F1)0.00000075.20000
X(E4,F5)0.000000-13.80000
X(E4,F1)0.00000050.20000
X(E3,F4)0.000000-15.70000
X(E3,F1)1.00000030.20000
X(E2,F3)0.000000-17.30000
X(E2,F1)0.00000020.20000
X(E1,F2)0.000000-18.40000
X(E1,F1)0.0000000.2000000
X(F5,G)0.000000-10.00000
X(F4,G)0.000000-30.00000
X(F3,G)0.000000-50.00000
X(F2,G)0.000000-60.00000
X(F1,G)1.000000-80.00000
即第二年和第五年更新设备,其余年继续使用原有设备。
二、汽车租赁
总成本1526元
三、饮料厂的生产与检修计划
模型建立:
未来四周饮料的生产量分别记作x1,x2,x3,x4;记第1,2,3周末的库存量分别为y1,y2,y3;用wt=1表示检修安排在第t周(t=1,2,3,4)。
输入形式:
min=5.0*x1+5.1*x2+5.4*x3+5.5*x4+0.2*(y1+y2+y3);
x1-y1=15;
x2+y1-y2=25;
x3+y2-y3=35;
x4+y3=25;
x1+15*w1<=30;
x2+15*w2-5*w1<=40;
x3+15*w3-5*w2-5*w1<=45;
x4+15*w4-5*(w1+w2+w3)<=20;
w1+w2+w3+w4=1;
x1>=0;x2>=0;x3>=0;x4>=0;y1>=0;y2>=0;y3>=0;
@bin(w1);
@bin(w2);
@bin(w3);
@bin(w4);
运行结果:
Globaloptimalsolutionfoundatiteration:
0
Objectivevalue:
527.0000
VariableValueReducedCost
X115.000000.000000
X245.000000.000000
X315.000000.000000
X425.000000.000000
Y10.0000000.000000
Y220.000000.000000
Y30.0000000.1000000
W11.000000-0.5000000
W20.0000001.500000
W30.0000000.000000
W40.0000000.000000
RowSlackorSurplusDualPrice
1527.0000-1.000000
20.000000-5.000000
30.000000-5.200000
40.000000-5.400000
50.000000-5.500000
60.0000000.000000
70.0000000.1000000
835.000000.000000
90.0000000.000000
100.0000000.000000
1115.000000.000000
1245.000000.000000
1315.000000.000000
1425.000000.000000
150.0000000.000000
1620.000000.000000
170.0000000.000000
四、指派问题
设
(取0或1)为第i个工作是否由第j个工人完成,
为第i个工作是否由第j个工人完成的费用。
则建立如下数学模型:
编写lingo程序:
worker/1..4/;
work/A,B,C,D/;
assign(work,worker):
c,x;
ENDSETS
DATA:
c=50709070
50403020
99205060
20309970;
ENDDATA
min=@sum(assign:
c*x);
@for(work(i):
@sum(worker(j):
x(i,j))=1);
@for(worker(j):
@sum(work(i):
x(i,j))=1);
运行结果:
对于问题2,增加工人5,改变限制条件使每个工人至多一项工作。
编写lingo程序:
SETS:
worker/1..5/;
work/A,B,C,D/;
assign(work,worker):
c,x;
ENDSETS
DATA:
c=5070907060
5040302045
9920506030
2030997080;
ENDDATA
min=@sum(assign:
c*x);
@for(work(i):
@sum(worker(j):
x(i,j))=1);
@for(worker(j):
@sum(work(i):
x(i,j))<1);
运行结果:
结果显示增加工人戊后,总费用低于上费用。
故用工人戊替换工人丙。
对于问题3,增加工作E,改变限制条件使每项工作至多一个工人。
编写lingo程序:
SETS:
worker/1..4/;
work/A,B,C,D,E/;
assign(work,worker):
c,x;
ENDSETS
DATA:
c=50709070
50403020
99205060
20309970
20102080;
ENDDATA
min=@sum(assign:
c*x);
@for(work(i):
@sum(worker(j):
x(i,j))<1);
@for(worker(j):
@sum(work(i):
x(i,j))=1);
运行结果:
分析结果得出,增加工作E后,总费用低于原费用。
故E优先于工作A。
五、工件加工问题
六、最优通讯连线
七、旅行线路问题