diff options
author | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2024-02-19 13:46:41 +0100 |
---|---|---|
committer | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2024-02-19 13:46:41 +0100 |
commit | 428f058aad1389e6ac2a8dc5666a177b3dcf5e8d (patch) | |
tree | ffda9421eadc6fd5cad11b952c9e0242852f79da | |
parent | integrate changes from polymatrix library (diff) | |
download | sumofsquares-428f058aad1389e6ac2a8dc5666a177b3dcf5e8d.tar.gz sumofsquares-428f058aad1389e6ac2a8dc5666a177b3dcf5e8d.zip |
flatten package structure for better readibility
27 files changed, 92 insertions, 522 deletions
diff --git a/sumofsquares/__init__.py b/sumofsquares/__init__.py index fb40a64..48b8e85 100644 --- a/sumofsquares/__init__.py +++ b/sumofsquares/__init__.py @@ -1,9 +1,3 @@ -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr - -from sumofsquares.init.initsosexpr import init_sos_expr, init_param_expr, init_param_expr_from_reference -from sumofsquares.init.initenergyfunction import init_energy_function -from sumofsquares.init.initenergyfunction2 import init_energy_function2 -from sumofsquares.init.initinteriorconstraint import init_interior_constraint -from sumofsquares.init.initputinarepsilon import init_putinar_epsilon - +from sumofsquares.abc import ParamSOSExpr, SOSExpr +from sumofsquares.init import init_sos_expr, init_param_expr, init_param_expr_from_reference, init_putinar_epsilon from sumofsquares.cvxopt import solve_cone, solve_cone2, solve_sos_problem, solve_sos_problem2 diff --git a/sumofsquares/abc/sosexpr.py b/sumofsquares/abc.py index 03e0b5d..03e0b5d 100644 --- a/sumofsquares/abc/sosexpr.py +++ b/sumofsquares/abc.py diff --git a/sumofsquares/abc/__init__.py b/sumofsquares/abc/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/sumofsquares/abc/__init__.py +++ /dev/null diff --git a/sumofsquares/cvxopt.py b/sumofsquares/cvxopt.py index f27212d..93346c3 100644 --- a/sumofsquares/cvxopt.py +++ b/sumofsquares/cvxopt.py @@ -3,8 +3,8 @@ import cvxopt import polymatrix import numpy as np import math -from sumofsquares.abc.sosexpr import ParamSOSExpr +from sumofsquares.abc import ParamSOSExpr from sumofsquares.sosconstraint.abc import SOSConstraint diff --git a/sumofsquares/impl/sosexprimpl.py b/sumofsquares/impl.py index c48143b..b58b674 100644 --- a/sumofsquares/impl/sosexprimpl.py +++ b/sumofsquares/impl.py @@ -1,7 +1,10 @@ import dataclassabc +import polymatrix -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr from sumofsquares.sosexprbase.abc import ParamSOSExprBase, SOSExprBase +from sumofsquares.sosconstraint.abc import SOSConstraint +from sumofsquares.mixins.putinarepsilonmixin import PutinarEpsilonMixin +from sumofsquares.abc import ParamSOSExpr, SOSExpr @dataclassabc.dataclassabc(frozen=True) @@ -25,3 +28,12 @@ class ParamSOSExprImpl(ParamSOSExpr): def __hash__(self): return hash(self.underlying) + + +@dataclassabc.dataclassabc(frozen=True) +class PutinarEpsilonImpl(PutinarEpsilonMixin): + name: str + epsilon: ParamSOSExpr + gamma: dict[str, ParamSOSExpr] + sos_constraints: tuple[SOSConstraint] + condition: SOSExpr diff --git a/sumofsquares/impl/__init__.py b/sumofsquares/impl/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/sumofsquares/impl/__init__.py +++ /dev/null diff --git a/sumofsquares/impl/energyfunction2impl.py b/sumofsquares/impl/energyfunction2impl.py deleted file mode 100644 index 7e6b091..0000000 --- a/sumofsquares/impl/energyfunction2impl.py +++ /dev/null @@ -1,19 +0,0 @@ -import dataclassabc -import polymatrix - -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr -from sumofsquares.mixins.energyfunction2mixin import EnergyFunction2Mixin -from sumofsquares.sosconstraint.abc import SOSConstraint - - -@dataclassabc.dataclassabc(frozen=True) -class EnergyFunction2Impl(EnergyFunction2Mixin): - name: str - h: SOSExpr - h_dot: SOSExpr - epsilon: ParamSOSExpr - gamma_b: ParamSOSExpr - gamma_roi: list[ParamSOSExpr] - # gamma_w_inner: ParamSOSExpr | None - # gamma_w_outer: ParamSOSExpr | None - sos_constraints: tuple[SOSConstraint] diff --git a/sumofsquares/impl/energyfunctionimpl.py b/sumofsquares/impl/energyfunctionimpl.py deleted file mode 100644 index 058ae58..0000000 --- a/sumofsquares/impl/energyfunctionimpl.py +++ /dev/null @@ -1,19 +0,0 @@ -import dataclassabc -import polymatrix - -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr -from sumofsquares.sosconstraint.abc import SOSConstraint -from sumofsquares.mixins.energyfunctionmixin import EnergyFunctionMixin - - -@dataclassabc.dataclassabc(frozen=True) -class EnergyFunctionImpl(EnergyFunctionMixin): - name: str - h: SOSExpr - h_dot: SOSExpr - epsilon: ParamSOSExpr - gamma_b: ParamSOSExpr - gamma_roi: ParamSOSExpr | None - gamma_w_inner: ParamSOSExpr | None - gamma_w_outer: ParamSOSExpr | None - sos_constraints: tuple[SOSConstraint] diff --git a/sumofsquares/impl/interiorconstraintimpl.py b/sumofsquares/impl/interiorconstraintimpl.py deleted file mode 100644 index ac76c19..0000000 --- a/sumofsquares/impl/interiorconstraintimpl.py +++ /dev/null @@ -1,14 +0,0 @@ -import dataclassabc -import polymatrix - -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr -from sumofsquares.mixins.energyfunction2mixin import EnergyFunction2Mixin -from sumofsquares.mixins.interiorconstraintmixin import InteriorConstraintMixin -from sumofsquares.sosconstraint.abc import SOSConstraint - - -@dataclassabc.dataclassabc(frozen=True) -class InteriorConstraintImpl(InteriorConstraintMixin): - name: str - gamma: ParamSOSExpr | None - sos_constraints: tuple[SOSConstraint] diff --git a/sumofsquares/impl/putinarepsilonimpl.py b/sumofsquares/impl/putinarepsilonimpl.py deleted file mode 100644 index dfba3f0..0000000 --- a/sumofsquares/impl/putinarepsilonimpl.py +++ /dev/null @@ -1,15 +0,0 @@ -import dataclassabc -import polymatrix - -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr -from sumofsquares.mixins.putinarepsilonmixin import PutinarEpsilonMixin -from sumofsquares.sosconstraint.abc import SOSConstraint - - -@dataclassabc.dataclassabc(frozen=True) -class PutinarEpsilonImpl(PutinarEpsilonMixin): - name: str - epsilon: ParamSOSExpr - gamma: dict[str, ParamSOSExpr] - sos_constraints: tuple[SOSConstraint] - condition: SOSExpr diff --git a/sumofsquares/init/initsosexpr.py b/sumofsquares/init.py index 214bb0d..c36d2aa 100644 --- a/sumofsquares/init/initsosexpr.py +++ b/sumofsquares/init.py @@ -1,10 +1,10 @@ import polymatrix -from sumofsquares.abc.sosexpr import SOSExpr -from sumofsquares.impl.sosexprimpl import ParamSOSExprImpl, SOSExprImpl -from sumofsquares.mixins.sosexprmixin import SOSExprMixin -from sumofsquares.sosexprbase.init.initsosexprbase import init_param_sos_expr_base, init_sos_expr_base from sumofsquares.sosexprbase.mixins.parametermixin import ParameterMixin +from sumofsquares.sosexprbase.init import init_param_sos_expr_base, init_sos_expr_base +from sumofsquares.mixins.sosexprmixin import SOSExprMixin +from sumofsquares.abc import SOSExpr +from sumofsquares.impl import ParamSOSExprImpl, SOSExprImpl, PutinarEpsilonImpl def init_sos_expr( @@ -83,3 +83,66 @@ def init_param_expr_from_reference( ) +def init_putinar_epsilon( + name: str, + f0: SOSExpr, + fi: dict[str, SOSExpr | polymatrix.Expression] = None, + gi: dict[str, SOSExpr | polymatrix.Expression] = None, + epsilon_min: SOSExpr | None = None, + decrease_rate: SOSExpr | polymatrix.Expression | None = None, +): + sos_constraints = tuple() + + condition = f0 + + def gen_gamma(fi): + for key, val in fi.items(): + yield key, init_param_expr_from_reference( + name=f'gamma_{key}_{name}', + reference=f0, + multiplicand=val, + ) + + if fi is None: + gamma_fi = {} + + else: + gamma_fi = dict(gen_gamma(fi)) + + for key, gamma_i in gamma_fi.items(): + sos_constraints += gamma_i.sos_constraints + condition = condition - gamma_i * fi[key] + + if gi is None: + gamma_gi = {} + + else: + gamma_gi = dict(gen_gamma(gi)) + + for key, gamma_i in gamma_gi.items(): + condition = condition - gamma_i * gi[key] + + if epsilon_min is None: + epsilon = None + + else: + epsilon = init_param_expr( + name=f'epsilon_{name}', + variables=f0.variables, + ) + + sos_constraints += (epsilon - epsilon_min).sos_constraints + condition += epsilon + + if decrease_rate is not None: + condition -= decrease_rate + + sos_constraints += condition.sos_constraints + + return PutinarEpsilonImpl( + name=name, + epsilon=epsilon, + gamma=gamma_fi | gamma_gi, + sos_constraints=sos_constraints, + condition=condition, + ) diff --git a/sumofsquares/init/initenergyfunction.py b/sumofsquares/init/initenergyfunction.py deleted file mode 100644 index 8b2f1bf..0000000 --- a/sumofsquares/init/initenergyfunction.py +++ /dev/null @@ -1,101 +0,0 @@ -import polymatrix - -from sumofsquares.abc.sosexpr import SOSExpr -from sumofsquares.impl.energyfunctionimpl import EnergyFunctionImpl -from sumofsquares.init.initsosexpr import init_param_expr, init_param_expr_from_reference, init_sos_expr - - -def init_energy_function( - name: str, - h: SOSExpr, - x_dot: SOSExpr, - positive_b: bool, - epsilon_min: SOSExpr | None = None, - roi: SOSExpr | polymatrix.Expression | None = None, - decrease_rate: SOSExpr | polymatrix.Expression | None = None, - w_outer: SOSExpr | polymatrix.Expression | None = None, - w_inner: SOSExpr | polymatrix.Expression | None = None, -): - sos_constraints = tuple() - - nh = h.diff().T - h_dot = (nh.T @ x_dot).cache() - - gamma_b = init_param_expr_from_reference( - name=f'gamma_b_{name}', - reference=h_dot, - multiplicand=h, - ) - if positive_b: - sos_constraints += gamma_b.sos_constraints - - energy_expr = -h_dot - energy_expr -= gamma_b * h - - if epsilon_min is None: - epsilon = None - - else: - epsilon = init_param_expr( - name=f'epsilon_{name}', - variables=h.variables, - ) - - sos_constraints += (epsilon - epsilon_min).sos_constraints - energy_expr += epsilon - - if roi is None: - gamma_roi = None, - - else: - gamma_roi = init_param_expr_from_reference( - name=f'gamma_roi_{name}', - reference=h_dot, - multiplicand=roi, - ) - sos_constraints += gamma_roi.sos_constraints - - energy_expr += gamma_roi * roi - - if decrease_rate is not None: - energy_expr -= decrease_rate - - sos_constraints += energy_expr.sos_constraints - - if w_outer is None: - gamma_w_outer = None - - else: - gamma_w_outer = init_param_expr_from_reference( - name=f'gamma_w_outer_{name}', - reference=h, - multiplicand=w_outer, - ) - - sos_constraints += gamma_w_outer.sos_constraints - sos_constraints += (h - gamma_w_outer * w_outer).sos_constraints - - if w_inner is None: - gamma_w_inner = None - - else: - gamma_w_inner = init_param_expr_from_reference( - name=f'gamma_w_inner_{name}', - reference=h, - multiplicand=w_inner, - ) - - sos_constraints += gamma_w_inner.sos_constraints - sos_constraints += (gamma_w_inner * w_inner - h).sos_constraints - - return EnergyFunctionImpl( - name=name, - h=h, - h_dot=h_dot, - epsilon=epsilon, - gamma_roi=gamma_roi, - gamma_b=gamma_b, - gamma_w_outer=gamma_w_outer, - gamma_w_inner=gamma_w_inner, - sos_constraints=sos_constraints, - ) diff --git a/sumofsquares/init/initenergyfunction2.py b/sumofsquares/init/initenergyfunction2.py deleted file mode 100644 index 785ef87..0000000 --- a/sumofsquares/init/initenergyfunction2.py +++ /dev/null @@ -1,110 +0,0 @@ -import polymatrix - -from sumofsquares.abc.sosexpr import SOSExpr -from sumofsquares.impl.energyfunction2impl import EnergyFunction2Impl -from sumofsquares.init.initsosexpr import init_param_expr, init_param_expr_from_reference - - -def init_energy_function2( - name: str, - # h: SOSExpr, - # x_dot: SOSExpr, - cond: SOSExpr, - h: SOSExpr, - positive_b: bool, - epsilon_min: SOSExpr | None = None, - roi: list[SOSExpr | polymatrix.Expression] = None, - decrease_rate: SOSExpr | polymatrix.Expression | None = None, - # w_outer: SOSExpr | polymatrix.Expression | None = None, - # w_inner: SOSExpr | polymatrix.Expression | None = None, -): - sos_constraints = tuple() - - cond = cond.cache() - - # nh = h.diff().T - # h_dot = (nh.T @ x_dot).cache() - - gamma_b = init_param_expr_from_reference( - name=f'gamma_b_{name}', - reference=cond, - multiplicand=h, - ) - if positive_b: - sos_constraints += gamma_b.sos_constraints - - energy_expr = -cond - energy_expr -= gamma_b * h - - if epsilon_min is None: - epsilon = None - - else: - epsilon = init_param_expr( - name=f'epsilon_{name}', - variables=h.variables, - ) - - sos_constraints += (epsilon - epsilon_min).sos_constraints - energy_expr += epsilon - - if roi is None: - gamma_roi = None, - - else: - def gen_gamma_roi(): - for idx, roi_i in enumerate(roi): - yield init_param_expr_from_reference( - name=f'gamma_roi{idx}_{name}', - reference=cond, - multiplicand=roi_i, - ) - gamma_roi = tuple(gen_gamma_roi()) - - for gamma_roi_i, roi_i in zip(gamma_roi, roi): - sos_constraints += gamma_roi_i.sos_constraints - - energy_expr += gamma_roi_i * roi_i - - if decrease_rate is not None: - energy_expr -= decrease_rate - - sos_constraints += energy_expr.sos_constraints - - # if w_outer is None: - # gamma_w_outer = None - - # else: - # gamma_w_outer = init_param_expr_from_reference( - # name=f'gamma_w_outer_{name}', - # reference=h, - # multiplicand=w_outer, - # ) - - # sos_constraints += gamma_w_outer.sos_constraints - # sos_constraints += (h - gamma_w_outer * w_outer).sos_constraints - - # if w_inner is None: - # gamma_w_inner = None - - # else: - # gamma_w_inner = init_param_expr_from_reference( - # name=f'gamma_w_inner_{name}', - # reference=h, - # multiplicand=w_inner, - # ) - - # sos_constraints += gamma_w_inner.sos_constraints - # sos_constraints += (gamma_w_inner * w_inner - h).sos_constraints - - return EnergyFunction2Impl( - name=name, - h=h, - h_dot=cond, - epsilon=epsilon, - gamma_roi=gamma_roi, - gamma_b=gamma_b, - # gamma_w_outer=gamma_w_outer, - # gamma_w_inner=gamma_w_inner, - sos_constraints=sos_constraints, - ) diff --git a/sumofsquares/init/initinteriorconstraint.py b/sumofsquares/init/initinteriorconstraint.py deleted file mode 100644 index 3daa44e..0000000 --- a/sumofsquares/init/initinteriorconstraint.py +++ /dev/null @@ -1,28 +0,0 @@ -import polymatrix - -from sumofsquares.abc.sosexpr import SOSExpr -from sumofsquares.impl.interiorconstraintimpl import InteriorConstraintImpl -from sumofsquares.init.initsosexpr import init_param_expr_from_reference - - -def init_interior_constraint( - name: str, - h: SOSExpr, - w: SOSExpr | polymatrix.Expression, -): - sos_constraints = tuple() - - gamma = init_param_expr_from_reference( - name=f'gamma_{name}', - reference=h, - multiplicand=w, - ) - - sos_constraints += gamma.sos_constraints - sos_constraints += (h - gamma * w).sos_constraints - - return InteriorConstraintImpl( - name=name, - gamma=gamma, - sos_constraints=sos_constraints, - ) diff --git a/sumofsquares/init/initputinarepsilon.py b/sumofsquares/init/initputinarepsilon.py deleted file mode 100644 index 6a4ccb2..0000000 --- a/sumofsquares/init/initputinarepsilon.py +++ /dev/null @@ -1,71 +0,0 @@ -import polymatrix - -from sumofsquares.abc.sosexpr import SOSExpr -from sumofsquares.impl.energyfunction2impl import EnergyFunction2Impl -from sumofsquares.impl.putinarepsilonimpl import PutinarEpsilonImpl -from sumofsquares.init.initsosexpr import init_param_expr, init_param_expr_from_reference - - -def init_putinar_epsilon( - name: str, - f0: SOSExpr, - fi: dict[str, SOSExpr | polymatrix.Expression] = None, - gi: dict[str, SOSExpr | polymatrix.Expression] = None, - epsilon_min: SOSExpr | None = None, - decrease_rate: SOSExpr | polymatrix.Expression | None = None, -): - sos_constraints = tuple() - - condition = f0 - - def gen_gamma(fi): - for key, val in fi.items(): - yield key, init_param_expr_from_reference( - name=f'gamma_{key}_{name}', - reference=f0, - multiplicand=val, - ) - - if fi is None: - gamma_fi = {} - - else: - gamma_fi = dict(gen_gamma(fi)) - - for key, gamma_i in gamma_fi.items(): - sos_constraints += gamma_i.sos_constraints - condition = condition - gamma_i * fi[key] - - if gi is None: - gamma_gi = {} - - else: - gamma_gi = dict(gen_gamma(gi)) - - for key, gamma_i in gamma_gi.items(): - condition = condition - gamma_i * gi[key] - - if epsilon_min is None: - epsilon = None - - else: - epsilon = init_param_expr( - name=f'epsilon_{name}', - variables=f0.variables, - ) - - sos_constraints += (epsilon - epsilon_min).sos_constraints - condition += epsilon - - if decrease_rate is not None: - condition -= decrease_rate - - sos_constraints += condition.sos_constraints - - return PutinarEpsilonImpl( - name=name, - epsilon=epsilon, - gamma=gamma_fi | gamma_gi, - sos_constraints=sos_constraints, - condition=condition, - ) diff --git a/sumofsquares/mixins/energyfunction2mixin.py b/sumofsquares/mixins/energyfunction2mixin.py deleted file mode 100644 index f96abb6..0000000 --- a/sumofsquares/mixins/energyfunction2mixin.py +++ /dev/null @@ -1,53 +0,0 @@ -import abc -import polymatrix - -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr -from sumofsquares.mixins.getsosconstraintmixin import GetSOSConstraintMixin -from sumofsquares.sosconstraint.abc import SOSConstraint - - -class EnergyFunction2Mixin(GetSOSConstraintMixin, abc.ABC): - @property - @abc.abstractmethod - def name(self) -> str: - ... - - @property - @abc.abstractmethod - def h(self) -> SOSExpr: - ... - - @property - @abc.abstractmethod - def h_dot(self) -> SOSExpr: - ... - - # @property - # @abc.abstractmethod - # def variables(self) -> polymatrix.Expression: - # ... - - @property - @abc.abstractmethod - def epsilon(self) -> ParamSOSExpr: - ... - - @property - @abc.abstractmethod - def gamma_b(self) -> ParamSOSExpr: - ... - - @property - @abc.abstractmethod - def gamma_roi(self) -> list[ParamSOSExpr]: - ... - - # @property - # @abc.abstractmethod - # def gamma_w_outer(self) -> ParamSOSExpr | None: - # ... - - # @property - # @abc.abstractmethod - # def gamma_w_inner(self) -> ParamSOSExpr | None: - # ... diff --git a/sumofsquares/mixins/energyfunctionmixin.py b/sumofsquares/mixins/energyfunctionmixin.py deleted file mode 100644 index f73f225..0000000 --- a/sumofsquares/mixins/energyfunctionmixin.py +++ /dev/null @@ -1,53 +0,0 @@ -import abc -import polymatrix - -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr -from sumofsquares.mixins.getsosconstraintmixin import GetSOSConstraintMixin -from sumofsquares.sosconstraint.abc import SOSConstraint - - -class EnergyFunctionMixin(GetSOSConstraintMixin, abc.ABC): - @property - @abc.abstractmethod - def name(self) -> str: - ... - - @property - @abc.abstractmethod - def h(self) -> SOSExpr: - ... - - @property - @abc.abstractmethod - def h_dot(self) -> SOSExpr: - ... - - # @property - # @abc.abstractmethod - # def variables(self) -> polymatrix.Expression: - # ... - - @property - @abc.abstractmethod - def epsilon(self) -> ParamSOSExpr: - ... - - @property - @abc.abstractmethod - def gamma_b(self) -> ParamSOSExpr: - ... - - @property - @abc.abstractmethod - def gamma_roi(self) -> ParamSOSExpr | None: - ... - - @property - @abc.abstractmethod - def gamma_w_outer(self) -> ParamSOSExpr | None: - ... - - @property - @abc.abstractmethod - def gamma_w_inner(self) -> ParamSOSExpr | None: - ... diff --git a/sumofsquares/mixins/interiorconstraintmixin.py b/sumofsquares/mixins/interiorconstraintmixin.py deleted file mode 100644 index 781a3d4..0000000 --- a/sumofsquares/mixins/interiorconstraintmixin.py +++ /dev/null @@ -1,21 +0,0 @@ -import abc - -from sumofsquares.abc.sosexpr import ParamSOSExpr -from sumofsquares.mixins.getsosconstraintmixin import GetSOSConstraintMixin - - -class InteriorConstraintMixin(GetSOSConstraintMixin, abc.ABC): - @property - @abc.abstractmethod - def name(self) -> str: - ... - - # @property - # @abc.abstractmethod - # def h(self) -> SOSExpr: - # ... - - @property - @abc.abstractmethod - def gamma(self) -> ParamSOSExpr | None: - ... diff --git a/sumofsquares/mixins/putinarepsilonmixin.py b/sumofsquares/mixins/putinarepsilonmixin.py index 6c1cd53..7f08f18 100644 --- a/sumofsquares/mixins/putinarepsilonmixin.py +++ b/sumofsquares/mixins/putinarepsilonmixin.py @@ -1,7 +1,7 @@ import abc import polymatrix -from sumofsquares.abc.sosexpr import ParamSOSExpr, SOSExpr +from sumofsquares.abc import ParamSOSExpr, SOSExpr from sumofsquares.mixins.getsosconstraintmixin import GetSOSConstraintMixin from sumofsquares.sosconstraint.abc import SOSConstraint diff --git a/sumofsquares/mixins/sosexprmixin.py b/sumofsquares/mixins/sosexprmixin.py index f3d4dc9..ed3fa65 100644 --- a/sumofsquares/mixins/sosexprmixin.py +++ b/sumofsquares/mixins/sosexprmixin.py @@ -2,7 +2,7 @@ import abc import polymatrix from sumofsquares.sosconstraint.abc import SOSConstraint -from sumofsquares.sosconstraint.initsosconstraint import init_sos_constraint +from sumofsquares.sosconstraint.init import init_sos_constraint from sumofsquares.mixins.getsosconstraintmixin import GetSOSConstraintMixin from sumofsquares.sosexprbase.abc import SOSExprBase diff --git a/sumofsquares/mixins/sosexpropmixin.py b/sumofsquares/mixins/sosexpropmixin.py index ce75bbc..bce2a02 100644 --- a/sumofsquares/mixins/sosexpropmixin.py +++ b/sumofsquares/mixins/sosexpropmixin.py @@ -5,7 +5,7 @@ import polymatrix import polymatrix.expression.from_ from sumofsquares.mixins.sosexprmixin import SOSExprMixin -from sumofsquares.sosexprbase.init.initsosexprbase import init_sos_expr_base +from sumofsquares.sosexprbase.init import init_sos_expr_base class SOSExprOPMixin(SOSExprMixin): diff --git a/sumofsquares/sosconstraint/abc.py b/sumofsquares/sosconstraint/abc.py index 5ce0b47..1894b94 100644 --- a/sumofsquares/sosconstraint/abc.py +++ b/sumofsquares/sosconstraint/abc.py @@ -1,4 +1,4 @@ -from sumofsquares.sosconstraint.sosconstraintmixin import SOSConstraintMixin +from sumofsquares.sosconstraint.mixins import SOSConstraintMixin class SOSConstraint(SOSConstraintMixin): diff --git a/sumofsquares/sosconstraint/initsosconstraint.py b/sumofsquares/sosconstraint/init.py index 68a2f25..68a2f25 100644 --- a/sumofsquares/sosconstraint/initsosconstraint.py +++ b/sumofsquares/sosconstraint/init.py diff --git a/sumofsquares/sosconstraint/sosconstraintmixin.py b/sumofsquares/sosconstraint/mixins.py index be49620..be49620 100644 --- a/sumofsquares/sosconstraint/sosconstraintmixin.py +++ b/sumofsquares/sosconstraint/mixins.py diff --git a/sumofsquares/sosexprbase/abc.py b/sumofsquares/sosexprbase/abc.py index c979919..e6b6d89 100644 --- a/sumofsquares/sosexprbase/abc.py +++ b/sumofsquares/sosexprbase/abc.py @@ -1,4 +1,5 @@ import abc + from sumofsquares.sosexprbase.mixins.selfdependencemixin import SelfDependenceMixin from sumofsquares.sosexprbase.mixins.sosexprbasemixin import SOSExprBaseMixin from sumofsquares.sosexprbase.mixins.exprfrommonommixin import ExprFromMonomMixin diff --git a/sumofsquares/sosexprbase/init/initsosexprbase.py b/sumofsquares/sosexprbase/init.py index f8f97fd..f8f97fd 100644 --- a/sumofsquares/sosexprbase/init/initsosexprbase.py +++ b/sumofsquares/sosexprbase/init.py diff --git a/sumofsquares/sosexprbase/mixins/parametermixin.py b/sumofsquares/sosexprbase/mixins/parametermixin.py index 3df6ab4..61755a5 100644 --- a/sumofsquares/sosexprbase/mixins/parametermixin.py +++ b/sumofsquares/sosexprbase/mixins/parametermixin.py @@ -3,6 +3,10 @@ import polymatrix class ParameterMixin(abc.ABC): + """ + + """ + @property @abc.abstractmethod def name(self) -> str: |