生产计划问题与投资问题
清华大学肖勇波梁湧老师翻译的Rardin教授的《运筹学》[1]已于今年年中出版,感谢机械工业出版社张有利老师的推荐和赠书。
问题
生产计划问题和投资问题见原书第二章的两个练习,习题2-1和习题2-2。
生产计划问题又叫混合生产问题(Mixed Production Problem),是经典的线型规划问题。
投资问题又叫投资组合问题,是金融背景上的一种背包问题。
+Leapms生成的两个问题的模型摘录
对任何问题,+Leapms都建议直接用+Leapms建模语言直接写出模型,并进行模型调试。
我们的经验是,模型调试能够发现模型的不足、促进建模的完美性,甚至可以促进对问题的更加深入的了解。当模型调试完毕,对模型的正确性有充分的信心后,+Leapms系统可生成模型摘录,包括数学概念模型(即使用标引符号表示的数学模型)和+Leapms源码供交流使用。
以下是两个问题的+Leapms模型摘录(pdf屏幕截图), 其中 模型"02-1.leap" 是生产计划问题, 模型"02-02"是投资问题:
求解过程
+Leapms>load Current directory is "ROOT". ......... 02-01.leap 02-02.leap 02-03.leap 02-39.leap .........please input the filename:02-01================================================================1: //2-1 The Notip Table Company sells two models of its patented2: //five-leg tables. The basic version uses a wood top, requires3: //0.6 hour to assemble, and sells for a profit of $200. The4: //deluxe model takes 1.5 hours to assemble because of its glass5: //top, and sells for a profit of $350. Over the next week the6: //company has 300 legs, 50 wood tops, 35 glass tops,7: //and 63 hours of assembly available. Notip wishes8: //to determine a maximum profit production plan9: //assuming that everything produced can be sold.10:11: max sum{j=1,..,n}c[j]x[j]12: subject to13: sum{j=1,..,n}a[i][j]x[j]<=b[i] | i=1,..,m14: where15: m,n are integers16: b[i] is a number|i=1,..,m17: c[j] is a number|j=1,..,n18: a[i][j] is a number|i=1,..,m;j=1,..,n19: x[j] is a variable of nonnegative number -->20: |j=1,..,n21: data22: m=4 // number of kinds of resources23: n=2 // number of product24: c={ 200 350} // profits25: b={ 63 300 50 35} //availabilities26: a={27: 0.6 1.5 //hours28: 5 5 //legs29: 1 0 //wood tops30: 0 1 //glass tops31: }================================================================>>end of the file.Parsing model:1D2R3V4O5C6S7End...................................number of variables=2number of constraints=4..................................+Leapms>solveThe LP is solved to optimal.找到线性规划最优解.非零变量值和最优目标值如下: ......... x1*=30 x2*=30 ......... Objective*=16500 .........+Leapms>load Current directory is "ROOT". ......... 02-01.leap 02-02.leap 02-03.leap 02-39.leap .........please input the filename:02-02================================================================1: //2-2 Wiley Wiz is a mutual fund manager trying to2: //decide how to divide up to $12 million between3: //domestic and foreign stocks. Domestic stocks4: //have been returning 11% per year and foreign5: //17%. Naturally, Wiley would like to maximize6: //the annual return from his investments. Still, he7: //wants to exercise some caution. No more that $108: //million of the fund should go into domestic stocks9: //and no more than $7 million into foreign. Also, at10: //least half as much should be invested in foreign as11: //domestic, and at least half as much in domestic as12: //foreign to maintain some balance.13:14: max sum{i=1,..,m}R[i]x[i]/10015: subject to16: sum{i=1,..,m}x[i]<=T17: x[i]<=B[i] | i=1,..,m18: where19: m is an integer20: T is a number21: R[i],B[i] are numbers|i=1,..,m22: x[i] is a variable of nonnegative number-->23: |i=1,..,m24: data25: m=226: T=1227: R={ 11 17}28: B={ 10 7}================================================================>>end of the file.Parsing model:1D2R3V4O5C6S7End...................................number of variables=2number of constraints=3..................................+Leapms>solveThe LP is solved to optimal.找到线性规划最优解.非零变量值和最优目标值如下: ......... x1*=5 x2*=7 ......... Objective*=1.74 .........+Leapms>
参考文献
[1] Rardin R. L 著,肖勇波、梁湧译. 运筹学. 北京:机械工业出版社,2018