【发布时间】:2020-07-01 03:38:00
【问题描述】:
所有 scipy 示例都使用旧版本,我正在寻找有关如何使用新版本的示例。
https://docs.scipy.org/doc/scipy/reference/optimize.linprog-simplex.html
我创建了一个超级简单的代码,它显示问题是无限的。任何帮助表示赞赏。
Minimize x - y
with
x >= 2
y <= 3
In standard form
-x - s1 = -2
y + s2 = 3
许多解决方案之一应该是 x = 2, y = 3
c = [1, -1]
A = [[-1, 0, -1, 0],[0, 1, 0, 1]]
b = [-2, 3]
linprog(c, method="simplex", options={'A': A, 'b': b})
result
------------------
con: array([], dtype=float64)
fun: -inf
message: 'The problem is (trivially) unbounded because there are no non-trivial constraints and a) at least one decision variable is unbounded above and its corresponding cost is negative, or b) at least one decision variable is unbounded below and its corresponding cost is positive. '
nit: 0
slack: array([], dtype=float64)
status: 3
success: False
x: array([ 0., inf])
【问题讨论】:
标签: python scipy-optimize