首先将约束条件和目标函数写成矩阵形式:

$$ \begin{aligned} \min_{\mathbf{x}} \quad &\mathbf{c}^T \mathbf{x} \ \text{s.t.} \quad &\mathbf{Ax} = \mathbf{b} \ &\mathbf{x} \geq \mathbf{0} \end{aligned} $$

其中,

$$ \mathbf{c} = \begin{bmatrix} -2 \ -3 \ 5 \ 0 \end{bmatrix}, \mathbf{A} = \begin{bmatrix} 1 & 1 & 1 & 0 \ 2 & -5 & 1 & -1 \end{bmatrix}, \mathbf{b} = \begin{bmatrix} 7 \ 0 \end{bmatrix}, \mathbf{x} = \begin{bmatrix} x_1 \ x_2 \ x_3 \ x_4 \end{bmatrix} $$

构造初始单纯形表:

$$ \begin{array}{|c|cccc|c|} \hline \text{基变量} & x_1 & x_2 & x_3 & x_4 & \text{常数项} \ \hline x_3 & 1 & 1 & 1 & 0 & 7 \ x_4 & 2 & -5 & 1 & -1 & 0 \ \hline \text{价值系数} & -2 & -3 & 5 & 0 & 0 \ \hline \end{array} $$

选择入基变量和出基变量。由于 $x_3$ 和 $x_4$ 是基变量,因此只需要考虑它们所对应的列。根据单纯形法的规则,选择一个价值系数为负数且绝对值最大的变量作为入基变量,然后选择一个离基变量,使得对应的系数在新的解中为 $0$。计算出各个变量的系数,得到:

$$ \begin{array}{|c|cccc|c|} \hline \text{基变量} & x_1 & x_2 & x_3 & x_4 & \text{常数项} \ \hline x_1 & 0.2 & 0.6 & 0.2 & 0.2 & 1.4 \ x_4 & 0.8 & -3.4 & 0.2 & 0.2 & -2.8 \ \hline \text{价值系数} & -1.6 & -2.2 & 5.8 & 0 & -11.2 \ \hline \end{array} $$

由于价值系数仍有负数,需要继续迭代。选择入基变量 $x_2$,出基变量 $x_1$,得到:

$$ \begin{array}{|c|cccc|c|} \hline \text{基变量} & x_1 & x_2 & x_3 & x_4 & \text{常数项} \ \hline x_2 & 0.33 & 0 & 0.33 & 0.17 & 2.33 \ x_4 & 0.67 & 0 & 0.33 & 0.17 & -1.33 \ \hline \text{价值系数} & 0 & -2.67 & 6 & 0.67 & -15.33 \ \hline \end{array} $$

此时所有的价值系数均为非负数,因此得到最优解 $\mathbf{x}^* = [0, 2.33, 4.67, 0]$,最优目标值为 $-11.33$。

用单纯性法帮我求解Min -2x1-3x2+5x3 st x1+x2+x3=7 2x1-5x2+x3-x4=0 X1x2x3x4≥0

原文地址: https://www.cveoy.top/t/topic/bEEH 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录