1、北京工业大学数学建模选修第五次作业数学建模第五次作业一、 设备更新问题设, 和表示某台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,B3 A2,B1 B3,C4 B3,C1 B1,C2 B1,C1 C4,D5 C4,D1 C2,D3 C2,D1 C1,D2 C1,D1 D5,E6 D5,E1 D3,E4 D3,E1 D2,E3 D2
2、,E1 D1,E2 D1,E1 E6,F1 E4,F5 E4,F1 E3,F4 E3,F1 E2,F3 E2,F1 E1,F2 E1,F1 F5,G F4,G F3,G F2,G F1,G/:c,x;ENDSETSDATA: c = 17.3 -20.2 15.7 -30.2 18.4 -0.2 13.8 -50.2 17.3 -20.2 18.4 -0.2 12.2 -70.2 15.7 -30.2 17.3 -20.2 18.4 -0.2 -75.2 13.8 -50.2 15.7 -30.2 17.3 -20.2 18.4 -0.2 10 30 50 60 80;ENDDATAn = s
3、ize(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);运行结果: Global optimal solution found. Objective value: 72.60000 Objective bound: 72.60000 Infeasibilities: 0.000000
4、 Extended solver steps: 0 Total solver iterations: 0 Model Class: PILP Total variables: 34 Nonlinear variables: 0 Integer variables: 34 Total constraints: 22 Nonlinear constraints: 0 Total nonzeros: 102 Nonlinear nonzeros: 0 Variable Value Reduced Cost N 21.00000 0.000000 C( A2, B3) 17.30000 0.00000
5、0 C( A2, B1) -20.20000 0.000000 C( B3, C4) 15.70000 0.000000 C( B3, C1) -30.20000 0.000000 C( B1, C2) 18.40000 0.000000 C( B1, C1) -0.2000000 0.000000 C( C4, D5) 13.80000 0.000000 C( C4, D1) -50.20000 0.000000 C( C2, D3) 17.30000 0.000000 C( C2, D1) -20.20000 0.000000 C( C1, D2) 18.40000 0.000000 C(
6、 C1, D1) -0.2000000 0.000000 C( D5, E6) 12.20000 0.000000 C( D5, E1) -70.20000 0.000000 C( D3, E4) 15.70000 0.000000 C( D3, E1) -30.20000 0.000000 C( D2, E3) 17.30000 0.000000 C( D2, E1) -20.20000 0.000000 C( D1, E2) 18.40000 0.000000 C( D1, E1) -0.2000000 0.000000 C( E6, F1) -75.20000 0.000000 C( E
7、4, F5) 13.80000 0.000000 C( E4, F1) -50.20000 0.000000 C( E3, F4) 15.70000 0.000000 C( E3, F1) -30.20000 0.000000 C( E2, F3) 17.30000 0.000000 C( E2, F1) -20.20000 0.000000 C( E1, F2) 18.40000 0.000000 C( E1, F1) -0.2000000 0.000000 C( F5, G) 10.00000 0.000000 C( F4, G) 30.00000 0.000000 C( F3, G) 5
8、0.00000 0.000000 C( F2, G) 60.00000 0.000000 C( F1, G) 80.00000 0.000000 X( A2, B3) 1.000000 -17.30000 X( A2, B1) 0.000000 20.20000 X( B3, C4) 0.000000 -15.70000 X( B3, C1) 1.000000 30.20000 X( B1, C2) 0.000000 -18.40000 X( B1, C1) 0.000000 0.2000000 X( C4, D5) 0.000000 -13.80000 X( C4, D1) 0.000000
9、 50.20000 X( C2, D3) 0.000000 -17.30000 X( C2, D1) 0.000000 20.20000 X( C1, D2) 1.000000 -18.40000 X( C1, D1) 0.000000 0.2000000 X( D5, E6) 0.000000 -12.20000 X( D5, E1) 0.000000 70.20000 X( D3, E4) 0.000000 -15.70000 X( D3, E1) 0.000000 30.20000 X( D2, E3) 1.000000 -17.30000 X( D2, E1) 0.000000 20.
10、20000 X( D1, E2) 0.000000 -18.40000 X( D1, E1) 0.000000 0.2000000 X( E6, F1) 0.000000 75.20000 X( E4, F5) 0.000000 -13.80000 X( E4, F1) 0.000000 50.20000 X( E3, F4) 0.000000 -15.70000 X( E3, F1) 1.000000 30.20000 X( E2, F3) 0.000000 -17.30000 X( E2, F1) 0.000000 20.20000 X( E1, F2) 0.000000 -18.4000
11、0 X( E1, F1) 0.000000 0.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
12、周(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)=0;x2=0;x3=0;x4=0;y1=0;y2=0;y3=0;bin(w1);bin(w2);bin(w3);bin(w4);运行结果: Global optimal solution found at iteration: 0 Obje
13、ctive value: 527.0000 Variable Value Reduced Cost X1 15.00000 0.000000 X2 45.00000 0.000000 X3 15.00000 0.000000 X4 25.00000 0.000000 Y1 0.000000 0.000000 Y2 20.00000 0.000000 Y3 0.000000 0.1000000 W1 1.000000 -0.5000000 W2 0.000000 1.500000 W3 0.000000 0.000000 W4 0.000000 0.000000 Row Slack or Sur
14、plus Dual Price 1 527.0000 -1.000000 2 0.000000 -5.000000 3 0.000000 -5.200000 4 0.000000 -5.400000 5 0.000000 -5.500000 6 0.000000 0.000000 7 0.000000 0.1000000 8 35.00000 0.000000 9 0.000000 0.000000 10 0.000000 0.000000 11 15.00000 0.000000 12 45.00000 0.000000 13 15.00000 0.000000 14 25.00000 0.
15、000000 15 0.000000 0.000000 16 20.00000 0.000000 17 0.000000 0.000000四、 指派问题设 (取0或1)为第i个工作是否由第j个工人完成,为第i个工作是否由第j个工人完成的费用。则建立如下数学模型:编写lingo程序: worker/1.4/; work/A,B,C,D/; assign(work,worker):c,x;ENDSETSDATA:c = 50 70 90 70 50 40 30 20 99 20 50 60 20 30 99 70;ENDDATAmin=sum(assign:c*x);for(work(i): su
16、m(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;ENDSETSDATA:c = 50 70 90 70 60 50 40 30 20 45 99 20 50 60 30 20 30 99 70 80;ENDDATAmin=sum(assign:c*x);for(work(i): sum(worker(j):x(i,j)=1
17、);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;ENDSETSDATA:c = 50 70 90 70 50 40 30 20 99 20 50 60 20 30 99 70 20 10 20 80;ENDDATAmin=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。五、 工件加工问题六、 最优通讯连线七、 旅行线路问题
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1