summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sumofsquares/problems.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/sumofsquares/problems.py b/sumofsquares/problems.py
index cd182df..fb25fd9 100644
--- a/sumofsquares/problems.py
+++ b/sumofsquares/problems.py
@@ -309,6 +309,17 @@ class InternalSOSProblem(Problem):
polynomial_symbols: Sequence[Symbol]
solver: Solver
+ def __str__(self):
+ n = len(self.constraints)
+ s = f"Internal SumOfSquares Problem ({self.__class__.__qualname__}):\n\n" \
+ f"minimize {self.cost}\n" \
+ f"subject to ({n} constraint{'s' if n > 1 else ''})\n"
+
+ for i, c in enumerate(self.constraints):
+ s += f"nr. {i}:\n{str(c)}\n\n"
+
+ return s
+
def to_conic_problem(self, state: ExpressionState, verbose: bool = False) -> ConicProblem:
"""
Convert the SOS problem into a Conic program.