API Reference
Defining Optimization Variables
sosopt.polymat.from_.define_variable
Defines a decision variable for the SOS Problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
DecisionVariableSymbol | str
|
The name assigned to the variable. This name needs to be unique. |
required |
size
|
int | MatrixExpression | None
|
The size of the decision variables. This is either given by an integer or derived from the shape of a polynomial expression. |
None
|
Returns:
Type | Description |
---|---|
VariableVectorSymbolExpression
|
A polynomial variable expression |
Example
Source code in sosopt\polymat\from_.py
sosopt.polymat.from_.define_polynomial
Defines of a fully parametrized polynomial -- involving the specification of a decision variable for each coefficient of the polynomial.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name assigned to the parametrized polynomial. This defines the name of the decision variable for each coefficient of the polynomial. |
required |
monomials
|
MonomialVectorExpression | None
|
Optional monomial vector that determines the structure of the polynomial matrix. If None, monomials are assumed to be a single element 1. |
None
|
n_rows
|
int | None
|
The number of rows of the resulting polynomial matrix. |
None
|
n_cols
|
int | None
|
The number of columns of the resulting polynomial matrix. |
None
|
like
|
MatrixExpression | None
|
Copy the number of rows and columns from the given polynomial expression. |
None
|
Returns:
Type | Description |
---|---|
StateMonad[MatrixExpression]
|
A polynomial expression where the coefficients are decision variables. |
Example
Source code in sosopt\polymat\from_.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
sosopt.polymat.from_.define_symmetric_matrix
Defines of a symmetric n x n matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name assigned to the parametrized polynomial. This defines the name of the decision variable for each coefficient of the polynomial. |
required |
monomials
|
MonomialVectorExpression | None
|
Optional monomial vector that determines the structure of the polynomial matrix. If None, monomials are assumed to be a single element 1. |
None
|
size
|
int | None
|
The number of rows of the resulting polynomial matrix. |
None
|
Returns:
Type | Description |
---|---|
StateMonad[MatrixExpression]
|
A polynomial expression where the coefficients are decision variables. |
Source code in sosopt\polymat\from_.py
sosopt.polymat.from_.define_multiplier
Defines a polynomial multiplier intended to be multiplied with a given polynomial (the multiplicand), ensuring that the resulting product does not exceed a specified degree.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name assigned to the multiplier polynomial variable. This defines the name of the decision variable for each coefficient of the multiplier. |
required |
degree
|
int | MatrixExpression
|
The maximum allowed degree for the product of the multiplicand and multiplier. |
required |
multiplicand
|
MatrixExpression | None
|
The polynomial to be multiplied with the multiplier. |
None
|
variables
|
VariableVectorExpression | tuple[int, ...]
|
The polynomial variables used to determine the degree of the resulting polynomial. |
required |
Returns:
Type | Description |
---|---|
StateMonad[ScalarPolynomialExpression]
|
A polynomial expression parameterized as a decision variable, representing the multiplier constrained by the specified degree. |
Example
Source code in sosopt\polymat\from_.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
Operations on Polynomial Expressions
sosopt.polymat.from_.sos_monomial_basis
Defines an SOS monomial basis \(Z(x)\) used for SOS decomposition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expression
|
MatrixExpression[State]
|
Defines the expression \(p(x)\) that can be written as \(p(x) = Z(x)^T Q Z(x)\) for some a monomial vector \(Z(x)\). |
required |
variables
|
VariableVectorExpression[State]
|
Defines the polynomial variables. |
required |
sparse_smr
|
bool | None
|
If True, no SOS decomposition variables are defined |
None
|
Source code in sosopt\polymat\from_.py
sosopt.polymat.from_.gram_matrix
Performs an SOS decomposition to retrieve the SMR from a polynomial expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expression
|
ScalarPolynomialExpression[State]
|
Defines the expression \(p(x)\) that can be written as \(p(x) = Z(x)^T Q Z(x)\) for some a monomial vector \(Z(x)\). |
required |
variables
|
VariableVectorExpression[State]
|
Defines the polynomial variables. |
required |
monomials
|
MonomialVectorExpression[State] | None
|
Defines the monomial vector \(Z(x)\). |
None
|
sparse_smr
|
bool | None
|
If True, no SOS decomposition variables are defined. |
None
|
Source code in sosopt\polymat\from_.py
Defining Sets
sosopt.semialgebraicset.set_
Define a semialgebraic set from a collection scalar polynomial expressions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
equal_zero
|
dict[str, VectorExpression]
|
A dictionary of polynomial expressions which evaluate to zero on the set. |
{}
|
greater_than_zero
|
dict[str, VectorExpression]
|
A dictionary of polynomial expressions which evaluate to a positive number on the set. |
{}
|
smaller_than_zero
|
dict[str, VectorExpression]
|
A dictionary of polynomial expressions which evaluate to a negative number on the set. |
{}
|
Returns:
Type | Description |
---|---|
SemialgebraicSet
|
A semi-algebraic set |
Source code in sosopt\semialgebraicset.py
Defining Polynomial Constraints
sosopt.polynomialconstraints.from_.zero_polynomial_constraint
This polynomial constraint ensures that a polynomial expression is zero as a polynomial: All coefficients of the polynomials must be zero.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | None
|
The name of the constraint. |
None
|
equal_to_zero
|
MatrixExpression
|
The polynomial expression whose coefficients must be zero. |
required |
Returns:
Type | Description |
---|---|
StateMonad[ZeroPolynomialConstraint]
|
A polynomial constraint |
Example
Source code in sosopt\polynomialconstraints\from_.py
sosopt.polynomialconstraints.from_.sos_constraint
This polynomial constraint ensures that a scalar polynomial expression belongs to the SOS Cone.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the constraint. |
required |
greater_than_zero
|
MatrixExpression | None
|
The polynomial expression that must be SOS. |
None
|
smaller_than_zero
|
MatrixExpression | None
|
The polynomial expression whose negative must be SOS. This argument is ignore if greater_than_zero is not None. |
None
|
Returns:
Type | Description |
---|---|
StateMonad[SumOfSqauresConstraint]
|
A polynomial constraint |
Example
Source code in sosopt\polynomialconstraints\from_.py
sosopt.polynomialconstraints.from_.sos_matrix_constraint
This polynomial constraint ensures a polynomial matrix expression belongs to the SOS Matrix Cone.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the constraint. |
required |
greater_than_zero
|
SymmetricMatrixExpression | None
|
The polynomial expression Q that must be SOS Matrix. This means that v^T Q v is SOS for an additional polynomial variable v. |
None
|
smaller_than_zero
|
SymmetricMatrixExpression | None
|
The polynomial expression whose negative must be SOS Matrix. This argument is ignore if greater_than_zero is not None. |
None
|
Returns:
Type | Description |
---|---|
StateMonad[SumOfSqauresConstraint]
|
A polynomial constraint |
Example
Source code in sosopt\polynomialconstraints\from_.py
sosopt.polynomialconstraints.from_.quadratic_module_constraint
This polynomial constraint defines a non-negativity condition on a subset of the states space (called the domain) using a quadratic module construction following Putinar's Positivstellensatz.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the constraint. |
required |
domain
|
SemialgebraicSet | None
|
Defined by a algebraic set. |
None
|
greater_than_zero
|
MatrixExpression | None
|
The polynomial expression that must be non-negative on the domain. |
None
|
smaller_than_zero
|
MatrixExpression | None
|
The polynomial expression that must be non-positive on the domain. This argument is ignore if greater_than_zero is not None. |
None
|
Returns:
Type | Description |
---|---|
StateMonad[QuadraticModuleConstraint]
|
A polynomial constraint |
Example
Source code in sosopt\polynomialconstraints\from_.py
Defining SDP constraints
sosopt.coneconstraints.from_.semi_definite_constraint
This constraint ensures that a symmetric matrix belongs to the positive semidefinite Cone.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the constraint. |
required |
greater_than_zero
|
SymmetricMatrixExpression
|
The symmetric matrix that must be positive semi-definite. |
required |
Returns:
Type | Description |
---|---|
StateMonad[SemiDefiniteConstraint]
|
A polynomial constraint |
Example
Source code in sosopt\coneconstraints\from_.py
sosopt.coneconstraints.from_.equality_constraint
This constraint ensures that all entries of the polynomial expression are zero.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the constraint. |
required |
equal_to_zero
|
VectorExpression
|
The polynomial expression that must be zero. |
required |
Returns:
Type | Description |
---|---|
StateMonad[EqualityConstraint]
|
A polynomial constraint |
Example
Source code in sosopt\coneconstraints\from_.py
Defining the SOS Optimization Problem
sosopt.sosproblem.init_sos_problem
Defines an SOS problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lin_cost
|
ScalarPolynomialExpression | None
|
Scalar expression \(c( heta)\) defining the linear cost. |
None
|
constraints
|
tuple[PolynomialConstraint | ConeConstraint, ...]
|
SOS and equality constraints |
required |
solver
|
SolverMixin
|
SDP solver selection (CVXOPT or MOSEK) |
required |
quad_cost
|
VectorExpression | None
|
Vector expression \(q( heta)\) defining the quadratic cost \(q( heta)^ op q( heta)\). |
None
|
Returns:
Type | Description |
---|---|
SOS Problem
|
A Sum-of-Squares (SOS) Problem |