struct DiagonallyDominantConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle
+(-α) + (-1)y² + (2)xy + (-1)x² + (1)y³ + (1)x³ is SOS
See this notebook for a detailed example.
The dual of a polynomial constraint cref
is a moment serie μ
as defined in MultivariateMoments. The dual can be obtained with the dual
function as with classical dual values in JuMP.
μ = dual(cref)
By dual of a Sum-of-Squares constraint, we may mean different things and the meaning chosen for dual
function was chosen for consistency with the definition of the JuMP dual
function to ensure that generic code will work as expected with Sum-of-Squares constraints. In a Sum-of-Squares constraint, a polynomial $p$ is constraint to be SOS in some domain defined by polynomial q_i
. So p(x)
is constrained to be equal to s(x) = s_0(x) + s_1(x) * q_1(x) + s_2(x) * q_2(x) + ...
where the s_i(x)
polynomials are Sum-of-Squares. The dual of the equality constraint between p(x)
and s(x)
is given by SumOfSquares.MultivariateMoments.moments
.
μ = moments(cref)
Note that the dual
and moments
may give different results. For instance, the output of dual
only contains the moments corresponding to monomials of p
while the output of moments
may give the moments of other monomials if s(x)
has more monomials than p(x)
. Besides, if the domain contains polynomial, equalities, only the remainder of p(x) - s(x)
modulo the ideal is constrained to be zero, see Corollary 2 of [CLO13]. In that case, the output moments
is the dual of the constraint on the remainder so some monomials may have different moments with dual
or moments
.
The dual of the Sum-of-Squares constraint on s_0(x)
, commonly referred to as the the matrix of moments can be obtained using moment_matrix
:
ν = moment_matrix(cref)
The atomic_measure
function of MultivariateMoments can be used to check if there exists an atomic measure (i.e. a measure that is a sum of Dirac measures) that has the moments given in the the moment matrix ν
. This can be used for instance in polynomial optimization (see this notebook) or stability analysis (see this notebook).
[BPT12] Blekherman, G.; Parrilo, P. A. & Thomas, R. R. Semidefinite Optimization and Convex Algebraic Geometry. Society for Industrial and Applied Mathematics, 2012.
[CLO13] Cox, D., Little, J., & OShea, D. Ideals, varieties, and algorithms: an introduction to computational algebraic geometry and commutative algebra. Springer Science & Business Media, 2013.
[AM17] Ahmadi, A. A. & Majumdar, A. DSOS and SDSOS Optimization: More Tractable Alternatives to Sum of Squares and Semidefinite Optimization. ArXiv e-prints, 2017.
Default choice for the maxdegree
keyword:
default_maxdegree(monos, domain)
Return the default maxdegree
to use for certifying a polynomial with monomials monos
to be Sum-of-Squares over the domain domain
. By default, the maximum of the maxdegree of monos
and of all multipliers of the domain are used so that at least constant multipliers can be used with a Putinar certificate.
sourceSpecial case that is second-order cone representable:
struct PositiveSemidefinite2x2ConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle end
Cone of positive semidefinite matrices of 2 rows and 2 columns.
sourceInner approximations of the PSD cone that do not require semidefinite programming:
struct DiagonallyDominantConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle
side_dimension::Int
end
See Definition 4 of [AM17] for a precise definition of the last two items.
[AM17] Ahmadi, A. A. & Majumdar, A. DSOS and SDSOS Optimization: More Tractable Alternatives to Sum of Squares and Semidefinite Optimization ArXiv e-prints, 2017.
sourcestruct ScaledDiagonallyDominantConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle
side_dimension::Int
end
See Definition 4 of [AM17] for a precise definition of the last two items.
[AM17] Ahmadi, A. A. & Majumdar, A. DSOS and SDSOS Optimization: More Tractable Alternatives to Sum of Squares and Semidefinite Optimization ArXiv e-prints, 2017.
sourceApproximations of the cone of nonnegative polynomials:
struct NonnegPolyInnerCone{MCT <: MOI.AbstractVectorSet}
-end
Inner approximation of the cone of nonnegative polynomials defined by the set of polynomials of the form
X^\top Q X
where X
is a vector of monomials and Q
is a symmetric matrix that belongs to the cone psd_inner
.
sourceconst SDSOSCone = NonnegPolyInnerCone{ScaledDiagonallyDominantConeTriangle}
Scaled-diagonally-dominant-sum-of-squares cone; see [Definition 2, AM17] and NonnegPolyInnerCone
.
[AM17] Ahmadi, A. A. & Majumdar, A. DSOS and SDSOS Optimization: More Tractable Alternatives to Sum of Squares and Semidefinite Optimization ArXiv e-prints, 2017.
sourceconst DSOSCone = NonnegPolyInnerCone{DiagonallyDominantConeTriangle}
Diagonally-dominant-sum-of-squares cone; see [Definition 2, AM17] and NonnegPolyInnerCone
.
[AM17] Ahmadi, A. A. & Majumdar, A. DSOS and SDSOS Optimization: More Tractable Alternatives to Sum of Squares and Semidefinite Optimization ArXiv e-prints, 2017.
sourceApproximations of the cone of positive semidefinite polynomial matrices:
struct PSDMatrixInnerCone{MCT <: MOI.AbstractVectorSet} <: PolyJuMP.PolynomialSet
-end
Inner approximation of the cone of polynomial matrices P(x)
that are positive semidefinite for any x
defined by the set of $n \times n$ polynomial matrices such that the polynomial $y^\top P(x) y$ belongs to NonnegPolyInnerCone{MCT}
where y
is a vector of $n$ auxiliary polynomial variables.
sourceconst SOSMatrixCone = PSDMatrixInnerCone{MOI.PositiveSemidefiniteConeTriangle}
Sum-of-squares matrices cone; see [Section 3.3.2, BPT12] and PSDMatrixInnerCone
.
[BPT12] Blekherman, G.; Parrilo, P. A. & Thomas, R. R. Semidefinite Optimization and Convex Algebraic Geometry. Society for Industrial and Applied Mathematics, 2012.
sourceApproximations of the cone of convex polynomials:
struct ConvexPolyInnerCone{MCT} <: PolyJuMP.PolynomialSet end
Inner approximation of the set of convex polynomials defined by the set of polynomials such that their hessian belongs to to the set PSDMatrixInnerCone{MCT}()
sourceconst SOSConvexCone = ConvexPolyInnerCone{MOI.PositiveSemidefiniteConeTriangle}
Sum-of-squares convex polynomials cone; see [Section 3.3.3, BPT12] and ConvexPolyInnerCone
.
[BPT12] Blekherman, G.; Parrilo, P. A. & Thomas, R. R. Semidefinite Optimization and Convex Algebraic Geometry. Society for Industrial and Applied Mathematics, 2012.
sourceApproximations of the cone of copositive matrices:
struct CopositiveInner{S} <: PolyJuMP.PolynomialSet
+end
Inner approximation of the cone of nonnegative polynomials defined by the set of polynomials of the form
X^\top Q X
where X
is a vector of monomials and Q
is a symmetric matrix that belongs to the cone psd_inner
.
sourceconst SDSOSCone = NonnegPolyInnerCone{ScaledDiagonallyDominantConeTriangle}
Scaled-diagonally-dominant-sum-of-squares cone; see [Definition 2, AM17] and NonnegPolyInnerCone
.
[AM17] Ahmadi, A. A. & Majumdar, A. DSOS and SDSOS Optimization: More Tractable Alternatives to Sum of Squares and Semidefinite Optimization ArXiv e-prints, 2017.
sourceconst DSOSCone = NonnegPolyInnerCone{DiagonallyDominantConeTriangle}
Diagonally-dominant-sum-of-squares cone; see [Definition 2, AM17] and NonnegPolyInnerCone
.
[AM17] Ahmadi, A. A. & Majumdar, A. DSOS and SDSOS Optimization: More Tractable Alternatives to Sum of Squares and Semidefinite Optimization ArXiv e-prints, 2017.
sourceApproximations of the cone of positive semidefinite polynomial matrices:
struct PSDMatrixInnerCone{MCT <: MOI.AbstractVectorSet} <: PolyJuMP.PolynomialSet
+end
Inner approximation of the cone of polynomial matrices P(x)
that are positive semidefinite for any x
defined by the set of $n \times n$ polynomial matrices such that the polynomial $y^\top P(x) y$ belongs to NonnegPolyInnerCone{MCT}
where y
is a vector of $n$ auxiliary polynomial variables.
sourceconst SOSMatrixCone = PSDMatrixInnerCone{MOI.PositiveSemidefiniteConeTriangle}
Sum-of-squares matrices cone; see [Section 3.3.2, BPT12] and PSDMatrixInnerCone
.
[BPT12] Blekherman, G.; Parrilo, P. A. & Thomas, R. R. Semidefinite Optimization and Convex Algebraic Geometry. Society for Industrial and Applied Mathematics, 2012.
sourceApproximations of the cone of convex polynomials:
struct ConvexPolyInnerCone{MCT} <: PolyJuMP.PolynomialSet end
Inner approximation of the set of convex polynomials defined by the set of polynomials such that their hessian belongs to to the set PSDMatrixInnerCone{MCT}()
sourceconst SOSConvexCone = ConvexPolyInnerCone{MOI.PositiveSemidefiniteConeTriangle}
Sum-of-squares convex polynomials cone; see [Section 3.3.3, BPT12] and ConvexPolyInnerCone
.
[BPT12] Blekherman, G.; Parrilo, P. A. & Thomas, R. R. Semidefinite Optimization and Convex Algebraic Geometry. Society for Industrial and Applied Mathematics, 2012.
sourceApproximations of the cone of copositive matrices:
struct CopositiveInner{S} <: PolyJuMP.PolynomialSet
# Inner approximation of the PSD cone, i.e. typically either
# `SOSCone`, `DSOSCone` or `SDSOSCone`,
psd_inner::S
@@ -141,13 +141,13 @@
Q::MT
basis::B
end
Gram matrix $x^\top Q x$ where Q
is a symmetric matrix indexed by the vector of polynomials of the basis basis
.
sourceGramMatrixAttribute(N)
-GramMatrixAttribute()
A constraint attribute for the GramMatrix
of a constraint, that is, the positive semidefinite matrix Q
indexed by the monomials in the vector X
such that $X^\top Q X$ is the sum-of-squares certificate of the constraint.
sourcegram_operate(::typeof(+), p::GramMatrix, q::GramMatrix)
Computes the Gram matrix equal to the sum between p
and q
. On the opposite, p + q
gives a polynomial equal to p + q
. The polynomial p + q
can also be obtained by polynomial(gram_operate(+, p, q))
.
sourcegram_operate(/, p::GramMatrix, α)
Computes the Gram matrix equal to p / α
. On the opposite, p / α
gives a polynomial equal to p / α
. The polynomial p / α
can also be obtained by polynomial(gram_operate(/, p, α))
.
sourceMomentMatrixAttribute(N)
-MomentMatrixAttribute()
A constraint attribute fot the MomentMatrix
of a constraint.
sourcecertificate_monomials(cref::JuMP.ConstraintRef)
Return the monomials of certificate_basis
. If the basis if not MultivariateBases.AbstractMonomialBasis
, an error is thrown.
sourceLagrangianMultipliers(N)
-LagrangianMultipliers()
A constraint attribute fot the LagrangianMultipliers
associated to the inequalities of the domain of a constraint. There is one multiplier per inequality and no multiplier for equalities as the equalities are handled by reducing the polynomials over the ideal they generate instead of explicitely creating multipliers.
sourcestruct SOSDecomposition{T, PT}
Represents a Sum-of-Squares decomposition without domain.
sourcestruct SOSDecompositionWithDomain{T, PT, S}
Represents a Sum-of-Squares decomposition on a basic semi-algebraic domain.
sourcestruct SOSDecompositionAttribute
+GramMatrixAttribute()
A constraint attribute for the GramMatrix
of a constraint, that is, the positive semidefinite matrix Q
indexed by the monomials in the vector X
such that $X^\top Q X$ is the sum-of-squares certificate of the constraint.
sourcegram_operate(::typeof(+), p::GramMatrix, q::GramMatrix)
Computes the Gram matrix equal to the sum between p
and q
. On the opposite, p + q
gives a polynomial equal to p + q
. The polynomial p + q
can also be obtained by polynomial(gram_operate(+, p, q))
.
sourcegram_operate(/, p::GramMatrix, α)
Computes the Gram matrix equal to p / α
. On the opposite, p / α
gives a polynomial equal to p / α
. The polynomial p / α
can also be obtained by polynomial(gram_operate(/, p, α))
.
sourceMomentMatrixAttribute(N)
+MomentMatrixAttribute()
A constraint attribute fot the MomentMatrix
of a constraint.
sourcecertificate_monomials(cref::JuMP.ConstraintRef)
Return the monomials of certificate_basis
. If the basis if not MultivariateBases.AbstractMonomialBasis
, an error is thrown.
sourceLagrangianMultipliers(N)
+LagrangianMultipliers()
A constraint attribute fot the LagrangianMultipliers
associated to the inequalities of the domain of a constraint. There is one multiplier per inequality and no multiplier for equalities as the equalities are handled by reducing the polynomials over the ideal they generate instead of explicitely creating multipliers.
sourcestruct SOSDecomposition{T, PT}
Represents a Sum-of-Squares decomposition without domain.
sourcestruct SOSDecompositionWithDomain{T, PT, S}
Represents a Sum-of-Squares decomposition on a basic semi-algebraic domain.
sourcestruct SOSDecompositionAttribute
ranktol::Real
dec::MultivariateMoments.LowRankLDLTAlgorithm
result_index::Int
-end
A constraint attribute for the SOSDecomposition
of a constraint. By default, it is computed using SOSDecomposition(gram, ranktol, dec)
where gram
is the value of the GramMatrixAttribute
.
sourcesos_decomposition(cref::JuMP.ConstraintRef, K<:AbstractBasicSemialgebraicSet)
Return representation in the quadraic module associated with K.
sourceBridges are automatically added using the following utilities:
bridgeable(c::JuMP.AbstractConstraint, S::Type{<:MOI.AbstractSet})
Wrap the constraint c
in JuMP.BridgeableConstraint
s that may be needed to bridge variables constrained in S
on creation.
bridgeable(c::JuMP.AbstractConstraint, F::Type{<:MOI.AbstractFunction},
+end
A constraint attribute for the SOSDecomposition
of a constraint. By default, it is computed using SOSDecomposition(gram, ranktol, dec)
where gram
is the value of the GramMatrixAttribute
.
sourcesos_decomposition(cref::JuMP.ConstraintRef, K<:AbstractBasicSemialgebraicSet)
Return representation in the quadraic module associated with K.
sourceBridges are automatically added using the following utilities:
bridgeable(c::JuMP.AbstractConstraint, S::Type{<:MOI.AbstractSet})
Wrap the constraint c
in JuMP.BridgeableConstraint
s that may be needed to bridge variables constrained in S
on creation.
bridgeable(c::JuMP.AbstractConstraint, F::Type{<:MOI.AbstractFunction},
S::Type{<:MOI.AbstractSet})
Wrap the constraint c
in JuMP.BridgeableConstraint
s that may be needed to bridge F
-in-S
constraints.
sourcebridges(F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})
Return a list of bridges that may be needed to bridge F
-in-S
constraints but not the bridges that may be needed by constraints added by the bridges.
sourcebridges(S::Type{<:MOI.AbstractSet})
Return a list of bridges that may be needed to bridge variables constrained in S
on creation but not the bridges that may be needed by constraints added by the bridges.
sourceChordal extension:
neighbors(G::Graph, node::Int}
Return neighbors of node
in G
.
sourcefill_in(G::Graph{T}, i::T}
Return number of edges that need to be added to make the neighbors of i
a clique.
sourceis_clique(G::Graph{T}, x::Vector{T})
Return a Bool
indication whether x
is a clique in G
.
sourcestruct LabelledGraph{T}
n2int::Dict{T,Int}
int2n::Vector{T}
@@ -158,4 +158,4 @@
end
Defines the polynomial function of the variables variables
where the variable variables(p)[i]
corresponds to variables[i]
.
sourceToPolynomialBridge{T}
ToPolynomialBridge
implements the following reformulations:
- $\min \{f(x)\}$ into $\min\{p(x)\}$
- $\max \{f(x)\}$ into $\max\{p(x)\}$
where $f(x)$ is a scalar function and $p(x)$ is a polynomial.
Source node
ToPolynomialBridge
supports:
MOI.ObjectiveFunction{F}
where F
is a MOI.AbstractScalarFunction
for which convert(::Type{PolyJuMP.ScalarPolynomialFunction}, ::Type{F})
. That is for instance the case for MOI.VariableIndex
, MOI.ScalarAffineFunction
and MOI.ScalarQuadraticFunction
.
Target nodes
ToPolynomialBridge
creates:
- One objective node:
MOI.ObjectiveFunction{PolyJuMP.ScalarPolynomialFunction{T}}
sourceToPolynomialBridge{T,S} <: Bridges.Constraint.AbstractBridge
ToPolynomialBridge
implements the following reformulations:
- $f(x) \in S$ into $p(x) \in S$ where $f(x)$ is a scalar function and $p(x)$ is a polynomial.
Source node
ToPolynomialBridge
supports:
F
in S
where F
is a MOI.AbstractScalarFunction
for which
convert(::Type{PolyJuMP.ScalarPolynomialFunction}, ::Type{F})
. That is for instance the case for MOI.VariableIndex
, MOI.ScalarAffineFunction
and MOI.ScalarQuadraticFunction
.
Target nodes
ToPolynomialBridge
creates:
sourceTo use the SAGE cone in place of the Sum-of-Squares cone for an inequality constraints between polynomials, use the following:
import PolyJuMP
PolyJuMP.setpolymodule!(model, PolyJuMP.SAGE)
struct Polynomials{M<:Union{Nothing,Int,MP.AbstractMonomial}} <: PolyJuMP.PolynomialSet
Sums of AM/GM Exponential for polynomials.
sourcestruct Decomposition{T, PT}
Represents a SAGE decomposition.
sourcestruct Signomials{M<:Union{Nothing,Int,MP.AbstractMonomial}} <: PolyJuMP.PolynomialSet
Sums of AM/GM Exponential for signomials.
sourcestruct DecompositionAttribute{T} <: MOI.AbstractConstraintAttribute
tol::T
-end
A constraint attribute for the Decomposition
of a constraint.
sourceSignomialsBridge{T,S,P,F} <: MOI.Bridges.Constraint.AbstractBridge
We use the Signomials Representative SR
equation of [MCW21].
[MCW20] Riley Murray, Venkat Chandrasekaran, Adam Wierman "Newton Polytopes and Relative Entropy Optimization" https://arxiv.org/abs/1810.01614 [MCW21] Murray, Riley, Venkat Chandrasekaran, and Adam Wierman. "Signomials and polynomial optimization via relative entropy and partial dualization." Mathematical Programming Computation 13 (2021): 257-295. https://arxiv.org/pdf/1907.00814.pdf
sourceAGEBridge{T,F,G,H} <: MOI.Bridges.Constraint.AbstractBridge
The nonnegativity of x ≥ 0
in
∑ ci x^αi ≥ -c0 x^α0
can be reformulated as
∑ ci exp(αi'y) ≥ -β exp(α0'y)
In any case, it is shown to be equivalent to
∃ ν ≥ 0 s.t. D(ν, exp(1)*c) ≤ β, ∑ νi αi = α0 ∑ νi [CP16, (3)]
where N(ν, λ) = ∑ νj log(νj/λj)
is the relative entropy function. The constant exp(1)
can also be moved out of D
into
∃ ν ≥ 0 s.t. D(ν, c) - ∑ νi ≤ β, ∑ νi αi = α0 ∑ νi [MCW21, (2)]
The relative entropy cone in MOI is (u, v, w)
such that D(w, v) ≥ u
. Therefore, we can either encode (β, exp(1)*c, ν)
[CP16, (3)] or (β + ∑ νi, c, ν)
[MCW21, (2)]. In this bridge, we use the second formulation.
A direct application of the Arithmetic-Geometric mean inequality gives
∃ ν ≥ 0 s.t. D(ν, exp(1)*c) ≤ -log(-β), ∑ νi αi = α0, ∑ νi = 1 [CP16, (4)]
which is not jointly convex in (ν, c, β). The key to get the convex formulation [CP16, (3)] or [MCW21, (2)] instead is to use the convex conjugacy between the exponential and the negative entropy functions [CP16, (iv)].
[CP16] Chandrasekaran, Venkat, and Parikshit Shah. "Relative entropy relaxations for signomial optimization." SIAM Journal on Optimization 26.2 (2016): 1147-1173. [MCW21] Murray, Riley, Venkat Chandrasekaran, and Adam Wierman. "Signomials and polynomial optimization via relative entropy and partial dualization." Mathematical Programming Computation 13 (2021): 257-295. https://arxiv.org/pdf/1907.00814.pdf
sourceorthogonal_transformation_to(A, B)
Return an orthogonal transformation U
such that A = U' * B * U
Given Schur decompositions A = Z_A * S_A * Z_A'
B = Z_B * S_B * Z_B'
Since P' * S_A * P = D' * S_B * D
, we have A = Z_A * P * Z_B' * B * Z_B * P' * Z_A'
source_reorder!(F::LinearAlgebra.Schur{T}) where {T}
Given a Schur decomposition of a, reorder it so that its eigenvalues are in in increasing order.
Note that if T<:Real
, F.Schur
is quasi upper triangular. By (quasi), we mean that there may be nonzero entries in S[i+1,i]
representing complex conjugates. In that case, the complex conjugate are permuted together. If T<:Complex
, then S
is triangular.
source_rotate_complex(A::AbstractMatrix{T}, B::AbstractMatrix{T}; tol = Base.rtoldefault(real(T))) where {T}
Given (quasi) upper triangular matrix A
and B
that have the eigenvalues in the same order except the complex pairs which may need to be (signed) permuted, returns an othogonal matrix P
such that P' * A * P
and B
have matching low triangular part. The upper triangular part will be dealt with by _sign_diag
.
By (quasi), we mean that if S
is a Matrix{<:Real}
, then there may be nonzero entries in S[i+1,i]
representing complex conjugates. If S
is a Matrix{<:Complex}
, then S
is upper triangular so there is nothing to do.
source_subs_ensure_moi_order(p::PolyJuMP.ScalarPolynomialFunction, old, new)
Substitutes old MP.variables(p.polynomial)
with new vars, while re-sorting the MOI p.variables
to get them in the correct order after substitution.
source