yuanchenyang/SumOfSquares.py

Infeasible problems can create poorly designed picos problems

Closed this issue · 2 comments

The following code demonstrates that
SoS.py can set up a picos problem that
result in errors in cvxopt.
The SOS problems below are all infeasible,
however only the first problem gives an
error stating that the problem is infeasible.
Rach demo runs in under 10 seconds.

import sympy as sp
from SumOfSquares import SOSProblem

s,t,x,y,z = sp.symbols('s t x y z')
prob = SOSProblem()

demo = 1 # change this to 2, 3 or 4 to get the other outputs

if demo == 1: prob.add_sos_constraint(s*x**2-y**2,[x,y,z])
if demo == 2: prob.add_sos_constraint(s*x*y*z**4-x**2+t,[x,y,z])
if demo == 3: prob.add_sos_constraint((s*x**2-1)*y**2+t,[x,y])
if demo == 4: prob.add_sos_constraint((s*x**2-1)*y**2+t,[x,y,z])

prob.solve()

DEMO 1 OUTPUT:

Traceback (most recent call last):
File "/Users/.../demo.py", line 10, in
prob.solve()
File "/usr/local/lib/python3.9/site-packages/picos/modeling/problem.py", line 1922, in solve
raise SolutionFailure(3, "Primal solution state claimed {} "
picos.modeling.problem.SolutionFailure: Code 3: Primal solution state claimed empty but optimality is required (primals=True).

DEMO 2 OUTPUT:

Traceback (most recent call last):
File "/Users/.../demo.py", line 10, in
prob.solve()
File "/usr/local/lib/python3.9/site-packages/picos/modeling/problem.py", line 1895, in solve
solutions = self._strategy.execute(**extra_options)
File "/usr/local/lib/python3.9/site-packages/picos/modeling/strategy.py", line 153, in execute
solution = self.nodes[1].execute(**extra_options)
File "/usr/local/lib/python3.9/site-packages/picos/reforms/reform_options.py", line 107, in execute
return self.successor.execute()
File "/usr/local/lib/python3.9/site-packages/picos/solvers/solver.py", line 642, in execute
solution = self._solve()
File "/usr/local/lib/python3.9/site-packages/picos/solvers/solver_cvxopt.py", line 502, in _solve
result = cvxopt.solvers.conelp(
File "/usr/local/lib/python3.9/site-packages/cvxopt/coneprog.py", line 1395, in conelp
misc.update_scaling(W, lmbda, ds, dz)
File "/usr/local/lib/python3.9/site-packages/cvxopt/misc.py", line 612, in update_scaling
lapack.gesvd(work, lmbda, jobu = 'A', jobvt = 'A', m = m, n = m,
ArithmeticError: 19

DEMO 3 OUTPUT:

Traceback (most recent call last):
File "/Users/.../demo.py", line 25, in
prob.solve()
File "/usr/local/lib/python3.9/site-packages/picos/modeling/problem.py", line 1895, in solve
solutions = self._strategy.execute(**extra_options)
File "/usr/local/lib/python3.9/site-packages/picos/modeling/strategy.py", line 153, in execute
solution = self.nodes[1].execute(**extra_options)
File "/usr/local/lib/python3.9/site-packages/picos/reforms/reform_options.py", line 107, in execute
return self.successor.execute()
File "/usr/local/lib/python3.9/site-packages/picos/solvers/solver.py", line 642, in execute
solution = self._solve()
File "/usr/local/lib/python3.9/site-packages/picos/solvers/solver_cvxopt.py", line 502, in _solve
result = cvxopt.solvers.conelp(
File "/usr/local/lib/python3.9/site-packages/cvxopt/coneprog.py", line 1395, in conelp
misc.update_scaling(W, lmbda, ds, dz)
File "/usr/local/lib/python3.9/site-packages/cvxopt/misc.py", line 628, in update_scaling
a = 1.0 / math.sqrt(lmbda[ind+i])
ZeroDivisionError: float division by zero

Have you tried Mosek? It gives the same infeasibility error for all the examples above. I've only tested this library extensively with Mosek, and cvxopt's conic optimizer isn't as robust.

No I have not. Thank you for suggesting this. I'll give it a try.