diff options
-rw-r--r-- | sumofsquares/constraints.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sumofsquares/constraints.py b/sumofsquares/constraints.py index 41f2b14..37486e1 100644 --- a/sumofsquares/constraints.py +++ b/sumofsquares/constraints.py @@ -33,7 +33,8 @@ class ArchimedeanSet(Set): polynomials: tuple[Expression] def __str__(self): - return f"{self.__class__.__qualname__}({', '.join(map(str, self.polynomials))})" + polynomials = ', '.join(map(str, self.polynomials)) + return f"{self.__class__.__qualname__}({polynomials})" @dataclassabc(frozen=True) @@ -41,6 +42,10 @@ class EqualToZero(Constraint): """ Constrain an expression to be equal to zero. """ expression: Expression + @override + def __str__(self): + return f"{self.__class__.__qualname__}: {str(self.expression)}" + @dataclassabc(frozen=True) class NonNegative(Constraint): @@ -59,7 +64,7 @@ class NonNegative(Constraint): @override def __str__(self): - s = f"{self.__class__.__qualname__} {str(self.expression)}" + s = f"{self.__class__.__qualname__}: {str(self.expression)}" if self.domain: s += f"\n\t\t over {self.domain}" return s |