summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sumofsquares/constraints.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/sumofsquares/constraints.py b/sumofsquares/constraints.py
index 844cc37..f287a23 100644
--- a/sumofsquares/constraints.py
+++ b/sumofsquares/constraints.py
@@ -54,7 +54,7 @@ class EqualToZero(Constraint[E]):
@override
def __str__(self):
- return f"{self.__class__.__qualname__}: {str(self.expression)}"
+ return f"{str(self.expression)} = 0"
@dataclassabc(frozen=True)
@@ -82,7 +82,7 @@ class NonNegative(Constraint[E]):
@override
def __str__(self):
- s = f"{self.__class__.__qualname__}: {str(self.expression)}"
+ s = f"{str(self.expression)} >= 0"
if self.domain:
s += f"\n\t\t over {self.domain}"
return s
@@ -93,6 +93,10 @@ class PositiveSemiDefinite(Constraint[E]):
""" Constrain a matrix to be positive semidefinite. """
expression: E
+ @override
+ def __str__(self):
+ return f"{str(self.expression)} is PSD"
+
@dataclassabc(frozen=True)
class ExponentialCone(Constraint[E]):
@@ -106,6 +110,10 @@ class ExponentialCone(Constraint[E]):
"""
expression: E
+ @override
+ def __str__(self):
+ return f"{str(self.expression)} in ExpCone"
+
# TODO: Create missing classes below and add support in
# - SOSProblem.apply