diff options
-rw-r--r-- | sumofsquares/canon.py | 4 | ||||
-rw-r--r-- | sumofsquares/problems.py | 2 | ||||
-rw-r--r-- | sumofsquares/solver/cvxopt.py | 9 | ||||
-rw-r--r-- | sumofsquares/solver/mosek.py | 1 | ||||
-rw-r--r-- | sumofsquares/solver/scs.py | 9 | ||||
-rw-r--r-- | sumofsquares/variable.py | 4 |
6 files changed, 13 insertions, 16 deletions
diff --git a/sumofsquares/canon.py b/sumofsquares/canon.py index d4c4a24..0874e2c 100644 --- a/sumofsquares/canon.py +++ b/sumofsquares/canon.py @@ -8,7 +8,7 @@ from dataclasses import replace from typing import Sequence from typing_extensions import override -from polymatrix.expression.from_ import Expression, from_state_monad +from polymatrix.expression.from_ import Expression from polymatrix.expressionstate import ExpressionState from polymatrix.statemonad import init_state_monad from polymatrix.polymatrix.mixins import PolyMatrixMixin @@ -18,7 +18,7 @@ from .abc import Constraint, Result from .constraints import NonNegative, PositiveSemiDefinite, ExponentialCone from .error import AlgebraicError from .problems import SOSProblem, InternalSOSProblem -from .variable import OptVariable, init_opt_variable_expr, from_name as opt_variable_from_name +from .variable import OptVariable, from_name as opt_variable_from_name from .utils import partition diff --git a/sumofsquares/problems.py b/sumofsquares/problems.py index 3fed54f..e7b9490 100644 --- a/sumofsquares/problems.py +++ b/sumofsquares/problems.py @@ -17,7 +17,7 @@ from typing_extensions import override from polymatrix.expression.expression import Expression, VariableExpression, init_expression from polymatrix.expressionstate import ExpressionState from polymatrix.polymatrix.mixins import PolyMatrixMixin -from polymatrix.polymatrix.index import MonomialIndex, VariableIndex +from polymatrix.polymatrix.index import MonomialIndex from polymatrix.variable import Variable from .abc import Problem, Constraint, Solver, Result diff --git a/sumofsquares/solver/cvxopt.py b/sumofsquares/solver/cvxopt.py index 6418a2d..87e0b0f 100644 --- a/sumofsquares/solver/cvxopt.py +++ b/sumofsquares/solver/cvxopt.py @@ -10,13 +10,8 @@ import math from collections import UserDict from typing import TYPE_CHECKING -import polymatrix as poly -from polymatrix.expression.expression import Expression -from polymatrix.polymatrix.index import MonomialIndex, VariableIndex - -from ..abc import Problem, SolverInfo -from ..constraints import NonNegative, EqualToZero, PositiveSemiDefinite, ExponentialCone -from ..error import NotSupportedBySolver, SolverError +from ..abc import SolverInfo +from ..error import SolverError from ..variable import OptVariable if TYPE_CHECKING: diff --git a/sumofsquares/solver/mosek.py b/sumofsquares/solver/mosek.py index a454e68..e0b73fc 100644 --- a/sumofsquares/solver/mosek.py +++ b/sumofsquares/solver/mosek.py @@ -24,6 +24,7 @@ def _streamprinter(text): MOSEK_ENV: mosek.Env | None = None + def setup(license_file: Path | str | None = None): """ Setup the MOSEK solver. If `license_file` is left unspecified, according to diff --git a/sumofsquares/solver/scs.py b/sumofsquares/solver/scs.py index 95629be..3106df2 100644 --- a/sumofsquares/solver/scs.py +++ b/sumofsquares/solver/scs.py @@ -3,16 +3,17 @@ Solve sumofsquares problems using SCS """ from __future__ import annotations -import sys import scs from collections import UserDict - -import polymatrix as poly +from typing import TYPE_CHECKING from ..abc import Problem, SolverInfo from ..variable import OptVariable +if TYPE_CHECKING: + from ..problems import ConicProblem + class SCSInfo(SolverInfo, UserDict): """ Dictionary returned by SCS. """ @@ -24,7 +25,7 @@ class SCSInfo(SolverInfo, UserDict): return self[key] -def solve_sos_cone(prob: Problem, verbose: bool = False, +def solve_sos_cone(prob: ConicProblem, verbose: bool = False, *args, **kwargs) -> tuple[dict[OptVariable, float], SCSInfo]: r""" Solve a conic problem in the cone of SOS polynomials diff --git a/sumofsquares/variable.py b/sumofsquares/variable.py index 28bbc97..2989732 100644 --- a/sumofsquares/variable.py +++ b/sumofsquares/variable.py @@ -20,9 +20,9 @@ from dataclassabc import dataclassabc from polymatrix.expression.expression import Expression, VariableExpression, init_variable_expression from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.expressionstate import ExpressionState -from polymatrix.polymatrix.abc import PolyMatrix -from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.polymatrix.index import PolyMatrixDict, PolyDict, MonomialIndex, VariableIndex +from polymatrix.polymatrix.init import init_poly_matrix +from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.variable import Variable |