数学建模(3)非线性规划模型
本文最后更新于 2025年9月19日 星期五 10:48
非线性规划模型[1]
\[ \begin{gather} \min z=x_1^2+x_2^2-4x_1+4 \\ \text{s.t.} \begin{cases} -x_1+x_2-2\leq0 \\ x_1^2-x_2+1\leq0 \\ x_1,x_2\geq0 \end{cases} \end{gather} \]
1 | |
彩电问题
1 | |
- 灵敏度分析
1 | |
二次规划
\[ \begin{gather} \min -x_1^2-0.3x_1x_2-2x_2^2+98x_1+277x_2 \\ \text{s.t.} \begin{cases} x_1+x_2\leq100 \\ x_1-x_2\leq0 \\ x_1,x_2\geq0 \end{cases} \end{gather} \]
矩阵化转化为
\[ \begin{gather} \min \begin{pmatrix} x_1 & x_2 \end{pmatrix} \begin{pmatrix} -1 & -0.15 \\ -0.15 & -2 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} + \begin{pmatrix} 98 & 277 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} \\ \text{s.t.} \begin{cases} \begin{pmatrix} 1 & 1 \\ 1 & -2 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} \leq \begin{pmatrix} 100 \\ 0 \end{pmatrix} \\ x_1,x_2\geq0 \end{cases} \end{gather} \]
1 | |
极值与极值点
求 \(f(x,y)=x^3-y^3+3x^2+3y^2-9x\) 在 \((0,0)\) 附近的极值。
1 | |
求 \(f(x)=100(x_2-x_1^2)^2+(1-x_1)^2\) 的极小点。
1 | |
fmincon
\[ \begin{gather} \min z=x_1^2+x_2^2+4x_3^2+8 \\ \text{s.t.} \begin{cases} x_1^2-x_2+x_3^2\geq0 \\ x_1+x_2^2+x_3^2\leq20 \\ -x_1-x_2^2+2=0 \\ x_2+2x_3^2=3 \\ x_1,x_2,x_3\geq0 \end{cases} \end{gather} \]
1 | |
Lagrange 乘数法与 KKT 条件
求约束极值函数
https://github.com/guofei9987/scikit-opt
- 安装 sko.GA:
1 | |
【例 1】三台火电机组的运行成本(单位:t/h)与出力限制(单位:MW)分别如下:
\[ \begin{gather} F_{G1}=4+0.3P_{G1}+0.0007P_{G1}^2, & 100\leq P_{G1}\leq 200 \\ F_{G2}=3+0.32P_{G2}+0.0004P_{G2}^2, & 120\leq P_{G2}\leq 250 \\ F_{G3}=3.5+0.3P_{G3}+0.00045P_{G3}^2, & 150\leq P_{G3}\leq 300 \end{gather} \]
当负荷为\(700\)MW 时,求经济调度的结果。
- 方法一:scipy
1 | |
- 输出:
1 | |
- 方法二:遗传算法
1 | |
- 输出:
1 | |
【例 2】某公司有 6 个建筑工地要开工,每个工地的位置(用平面坐标系 \(a,b\) 表示,距离单位:千米)及水泥日用量 \(d\)(吨)由下表给出。规划设立两个料场位于 A、B,日储量各为 \(20\) 吨。假设从料场到工地之间均有直线道路相连,试确定料场的位置,并制定每天的供应计划,即从 A、B 两料场分别向各工地运送多少吨水泥,使总的吨千米数最小。
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| a | 1.25 | 8.75 | 0.5 | 5.75 | 3 | 7.25 |
| b | 1.25 | 0.75 | 4.75 | 5 | 6.5 | 7.25 |
| d | 3 | 5 | 4 | 7 | 6 | 11 |
\[ \begin{gather} \min f=\sum_{i=1}^2\sum_{j=1}^6w_{ij}\sqrt{(x_i-a_j)^2+(y_i-b_j)^2} \\ \text{s.t.} \begin{cases} \sum_{i=1}^2x_{ij}\geq d_j \\ \sum_{j=1}^6x_{ij}\leq e_i \end{cases} \end{gather} \]
参考文献
- 司守奎,孙玺菁. 数学建模算法与应用(第 3 版). ↩︎