summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-25 12:25:49 +0200
committerNao Pross <np@0hm.ch>2024-05-25 12:25:49 +0200
commitb70c15852716e98a88d1f465d310b5791fe8c56b (patch)
treefe5578c8a1988231443e62e9767cc6e90f81fbdc
parentDelete obsolete expression extension module (diff)
downloadsumofsquares-b70c15852716e98a88d1f465d310b5791fe8c56b.tar.gz
sumofsquares-b70c15852716e98a88d1f465d310b5791fe8c56b.zip
Add comments
Diffstat (limited to '')
-rw-r--r--sumofsquares/constraints.py16
-rw-r--r--sumofsquares/problems.py1
2 files changed, 17 insertions, 0 deletions
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)