Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Linprog可以解LP原矩阵,但不能解对偶矩阵?_Python_Optimization_Scipy - Fatal编程技术网

Python Linprog可以解LP原矩阵,但不能解对偶矩阵?

Python Linprog可以解LP原矩阵,但不能解对偶矩阵?,python,optimization,scipy,Python,Optimization,Scipy,我能够用矩阵A_ub用scipy linprog解决以下最小化问题: A_ub = [[ 1 10 0 3] [ 6 2 3 6] [ 3 5 4 2] [ 4 9 2 2]] 及 最小化问题是c=[-1,-1,-1](即范数1的负数)。 从scipy调用linprog将得到以下结果(如预期的那样): 然而,我还需要找到问题的双重解决方案 根据我对极大极小定理的理解,上述问题等价于: scipy.optimize.linpr

我能够用矩阵A_ub用scipy linprog解决以下最小化问题:

A_ub = [[ 1 10  0  3]
        [ 6  2  3  6]
        [ 3  5  4  2]
        [ 4  9  2  2]]

最小化问题是
c=[-1,-1,-1]
(即范数1的负数)。 从scipy调用linprog将得到以下结果(如预期的那样):

然而,我还需要找到问题的双重解决方案

根据我对极大极小定理的理解,上述问题等价于:

scipy.optimize.linprog(-b_ub, A_ub=A_ub.T, b_ub=c)
但是,运行此命令会导致错误:

     con: array([], dtype=float64)
     fun: 0.0
 message: "Phase 1 of the simplex method failed to find a feasible solution. The pseudo-objective function evaluates to 4.0e+00 which exceeds the required tolerance of 1e-12 for a solution to be considered 'close enough' to zero to be a basic solution. Consider increasing the tolerance to be greater than 4.0e+00. If this tolerance is unacceptably  large the problem may be infeasible."
     nit: 0
   slack: array([-1., -1., -1., -1.])
  status: 2
 success: False
   x: array([0., 0., 0., 0.])
如果我将公差增加到一个大值(10),那么它确实会以一个解决方案终止,但我认为这是不正确的,因为函数值与原始值不同。 我真的很感谢任何关于这个问题的帮助和提示,以及如何找到双重问题的解决方案

最好的,
你好。

我打电话给linprog是个错误

问题的双重性质应该是:

minimizing b_ub
s.t
-A_transpose *x <= c
     con: array([], dtype=float64)
     fun: 0.0
 message: "Phase 1 of the simplex method failed to find a feasible solution. The pseudo-objective function evaluates to 4.0e+00 which exceeds the required tolerance of 1e-12 for a solution to be considered 'close enough' to zero to be a basic solution. Consider increasing the tolerance to be greater than 4.0e+00. If this tolerance is unacceptably  large the problem may be infeasible."
     nit: 0
   slack: array([-1., -1., -1., -1.])
  status: 2
 success: False
   x: array([0., 0., 0., 0.])
minimizing b_ub
s.t
-A_transpose *x <= c
linprog(b_ub, -A_transpose, c)