From b70c15852716e98a88d1f465d310b5791fe8c56b Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 25 May 2024 12:25:49 +0200 Subject: Add comments --- sumofsquares/constraints.py | 16 ++++++++++++++++ sumofsquares/problems.py | 1 + 2 files changed, 17 insertions(+) diff --git a/sumofsquares/constraints.py b/sumofsquares/constraints.py index 3d681c5..b808bbb 100644 --- a/sumofsquares/constraints.py +++ b/sumofsquares/constraints.py @@ -69,6 +69,14 @@ class NonNegative(Constraint[E]): be written as a sum-of-squares, hence this constraint can also be understood as `expression` being SOS. """ + + # This was part of the docstring but is not implemented yet + # TODO: implement what is says below + # + # If the expression is a column vector, the interpretation is row-wise. In + # other words each row must be non-negative on the domain (or everywhere if + # not specified). + expression: E domain: BasicSemialgebraicSet[E] | None = None @@ -88,4 +96,12 @@ class PositiveSemiDefinite(Constraint[E]): @dataclassabc(frozen=True) class ExponentialCone(Constraint[E]): + r""" + This constraint expects a 3d row vector :math:`(x, y, z)`, and imposes that + the point is inside of the exponential cone. + + The expression may also be a :math:`n\times 2` matrix. In that case the + constraint is understood row-wise, or in other words, each row is taken as + a single point that must be inside of the exponential cone. + """ expression: E diff --git a/sumofsquares/problems.py b/sumofsquares/problems.py index 6161641..3fed54f 100644 --- a/sumofsquares/problems.py +++ b/sumofsquares/problems.py @@ -152,6 +152,7 @@ class SOSProblem(Problem): # result may not be used, this is necessary to account for the case of # variables that are only present in the constraints, which the state # object may not contain yet. + # TODO: Is there a more efficient way? There has to be a better way. for c in self.constraints: state, _ = c.expression.apply(state) -- cgit v1.2.1