生产计划问题与投资问题

生产计划问题与投资问题

清华大学肖勇波梁湧老师翻译的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 patented
2:  //five-leg tables. The basic version uses a wood top, requires
3:  //0.6 hour to assemble, and sells for a profit of $200. The
4:  //deluxe model takes 1.5 hours to assemble because of its glass
5:  //top, and sells for a profit of $350. Over the next week the
6:  //company has 300 legs, 50 wood tops, 35 glass tops,
7:  //and 63 hours of assembly available. Notip wishes
8:  //to determine a maximum profit production plan
9:  //assuming that everything produced can be sold.
10:
11:  max sum{j=1,..,n}c[j]x[j]
12:  subject to
13:     sum{j=1,..,n}a[i][j]x[j]<=b[i] | i=1,..,m
14:  where
15:     m,n are integers
16:     b[i] is a number|i=1,..,m
17:     c[j] is a number|j=1,..,n
18:     a[i][j] is a number|i=1,..,m;j=1,..,n
19:     x[j] is a variable of nonnegative number -->
20:             |j=1,..,n
21:  data
22:     m=4  // number of kinds of resources
23:     n=2  // number of product
24:     c={200 350}  // profits
25:     b={63 300 50 35} //availabilities
26:     a={
27:         0.6  1.5  //hours
28:              5    5    //legs
29:         1    0    //wood tops
30:         0    1    //glass tops
31:     }
================================================================
>>end of the file.
Parsing model:
1D
2R
3V
4O
5C
6S
7End.
..................................
number of variables=2
number of constraints=4
..................................
+Leapms>solve
The 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 to
2:  //decide how to divide up to $12 million between
3:  //domestic and foreign stocks. Domestic stocks
4:  //have been returning 11% per year and foreign
5:  //17%. Naturally, Wiley would like to maximize
6:  //the annual return from his investments. Still, he
7:  //wants to exercise some caution. No more that $10
8:  //million of the fund should go into domestic stocks
9:  //and no more than $7 million into foreign. Also, at
10:  //least half as much should be invested in foreign as
11:  //domestic, and at least half as much in domestic as
12:  //foreign to maintain some balance.
13:
14:  max sum{i=1,..,m}R[i]x[i]/100
15:  subject to
16:     sum{i=1,..,m}x[i]<=T
17:     x[i]<=B[i] | i=1,..,m
18:  where
19:     m is an integer
20:     T is a number
21:     R[i],B[i] are numbers|i=1,..,m
22:     x[i] is a variable of nonnegative number-->
23:             |i=1,..,m
24:  data
25:     m=2
26:     T=12
27:     R={11 17}
28:     B={10 7}
================================================================
>>end of the file.
Parsing model:
1D
2R
3V
4O
5C
6S
7End.
..................................
number of variables=2
number of constraints=3
..................................
+Leapms>solve
The LP is solved to optimal.
找到线性规划最优解.非零变量值和最优目标值如下:
    .........
    x1*=5
    x2*=7
    .........
    Objective*=1.74
    .........
+Leapms>

参考文献

 [1] Rardin R. L 著,肖勇波、梁湧译. 运筹学. 北京:机械工业出版社,2018

原文地址:https://www.cnblogs.com/leapms/p/10202073.html