我正在尝试使用 cvxpy(以及因此 cvxopt)在具有 28 个节点和 37 条线路的相对简单的网络中对最佳功率流进行建模,但得到“Rank(A) < p 或 Rank([G; A]) < n “ 错误。
(使用相同的代码,我可以找到具有 4 个节点和 4 条线的更简单的网络的最佳解决方案。)
我已经非常仔细地检查了约束并没有不一致(使用我在 Stack Overflow 上对这个问题的回答: Check constraints are ok in cvxpy with actual values)
这是回溯:
File "main.py", line 201, in test_simple_optimisation
p, bids, offers = optimize_flow(bids, offers, lines, nodes, injections_from_schedule, shift_factors, admittance.T)
File "main.py", line 143, in optimize_flow
p.solve()
File "build/bdist.macosx-10.8-intel/egg/cvxpy/programs.py", line 169, in solve
obj,valid = solve_prog(new_p,quiet)
File "build/bdist.macosx-10.8-intel/egg/cvxpy/procedures/solve_prog.py", line 44, in solve_prog
sol = call_solver(p_expanded,quiet)
File "build/bdist.macosx-10.8-intel/egg/cvxpy/procedures/call_solver.py", line 78, in call_solver
r = solvers.conelp(c,G,h,dims,A,b)
File "/Library/Python/2.7/site-packages/cvxopt/coneprog.py", line 687, in conelp
raise ValueError("Rank(A) < p or Rank([G; A]) < n")
ValueError: Rank(A) < p or Rank([G; A]) < n
当我查看 /Library/Python/2.7/site-packages/cvxopt/coneprog.py",第 687 行时,它实际上是在挽救一个算术错误
685 try: f = kktsolver(W)
686 except ArithmeticError:..
687 raise ValueError("Rank(A) < p or Rank([G; A]) < n")
那有意义吗?为什么会出现算术错误,例如OverflowError
, ZeroDivisionError
, FloatingPointError
,除非 cvxpy 扩展了 ArithmeticError 意味着问题描述不当,即 Rank(A) < p 或 Rank([G; A]) < n"?