Standard form
JuMP variables
PolyJuMP.Poly
— Typestruct Poly{PB<:AbstractPolynomialBasis} <: AbstractPoly
polynomial_basis::PB
end
Polynomial variable $v^\top p$ where $v$ is a vector of new decision variables and $p$ is a vector of polynomials for the basis polynomial_basis
.
JuMP Sets
Approximations of the cone of nonnegative polynomials:
SumOfSquares.NonnegPolyInnerCone
— Typestruct 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
.
SumOfSquares.SOSCone
— Typeconst SOSCone = NonnegPolyInnerCone{MOI.PositiveSemidefiniteConeTriangle}
Sum-of-squares cone; see NonnegPolyInnerCone
.
SumOfSquares.SDSOSCone
— Typeconst SDSOSCone = NonnegPolyInnerCone{ScaledDiagonallyDominantConeTriangle}
Scaled-diagonally-dominant-sum-of-squares cone; see (Ahmadi and Majumdar, 2017; Definition 2) and NonnegPolyInnerCone
.
SumOfSquares.DSOSCone
— Typeconst DSOSCone = NonnegPolyInnerCone{DiagonallyDominantConeTriangle}
Diagonally-dominant-sum-of-squares cone; see (Ahmadi and Majumdar, 2017; Definition 2) and NonnegPolyInnerCone
.
Approximations of the cone of positive semidefinite polynomial matrices:
SumOfSquares.PSDMatrixInnerCone
— Typestruct 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.
SumOfSquares.SOSMatrixCone
— Typeconst SOSMatrixCone = PSDMatrixInnerCone{MOI.PositiveSemidefiniteConeTriangle}
Sum-of-squares matrices cone; see (Blekherman et al., 2012; Section 3.3.2) and PSDMatrixInnerCone
.
Approximations of the cone of convex polynomials:
SumOfSquares.ConvexPolyInnerCone
— Typestruct 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}()
SumOfSquares.SOSConvexCone
— Typeconst SOSConvexCone = ConvexPolyInnerCone{MOI.PositiveSemidefiniteConeTriangle}
Sum-of-squares convex polynomials cone; see (Blekherman et al., 2012; Section 3.3.3) and ConvexPolyInnerCone
.
Approximations of the cone of copositive matrices:
SumOfSquares.CopositiveInner
— Typestruct CopositiveInner{S} <: PolyJuMP.PolynomialSet
# Inner approximation of the PSD cone, i.e. typically either
# `SOSCone`, `DSOSCone` or `SDSOSCone`,
psd_inner::S
end
A symmetric matrix $Q$ is copositive if $x^{\top} Q x \ge 0$ for all vector $x$ in the nonnegative orthant. Checking copositivity is a co-NP-complete problem (Murty and Kabadi, 1987) and this cone is only the inner approximation of the cone of copositive symmetric matrices given by Minknowski sum of psd_inner
and the cone of symmetric matrices with nonnegative entries (the diagonal entries can be chosen to be zero) (Blekherman et al., 2012; Lemma 3.164).
The matrix with nonnegative entries can be interpreted as lagrangian multipliers. For instance,
@polyvar x y
@constraint(model, x^2 - 2x*y + y^2 in CopositiveInner(SOSCone()))
is equivalent to
# Matrix that we require to be copositive
Q = [ 1 -1
-1 1]
λ = @variable(model, lower_bound=0)
# Symmetric matrix of nonnegative entries
Λ = [0 λ
λ 0]
using LinearAlgebra # For `Symmetric`
@constraint(model, Symmetric(Q - Λ) in PSDCone())
which is equivalent to
@polyvar x y
λ = @variable(model, lower_bound=0)
@constraint(model, x^2 - 2x*y + y^2 - 2*λ * x*y in SOSCone())
which is the same as, using the domain
keyword,
@polyvar x y
@constraint(model, x^2 - 2x*y + y^2 in SOSCone(), domain = @set x*y ≥ 0)
As an important difference with its equivalent forms, the GramMatrixAttribute
for the copositive constraint is given by matrix Q
while for the equivalent form using the domain
keyword, the value of the attribute would correspond to the the gram matrix in the psd_inner
cone, i.e. which should be equal to Q - Λ
.
SAGE cones:
PolyJuMP.SAGE.Polynomials
— Typestruct Polynomials{M<:Union{Nothing,Int,MP.AbstractMonomial}} <: PolyJuMP.PolynomialSet
Sums of AM/GM Exponential for polynomials.
PolyJuMP.SAGE.Signomials
— Typestruct Signomials{M<:Union{Nothing,Int,MP.AbstractMonomial}} <: PolyJuMP.PolynomialSet
Sums of AM/GM Exponential for signomials.
PolyJuMP.SAGE.SignomialsBridge
— TypeSignomialsBridge{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
PolyJuMP.SAGE.AGEBridge
— TypeAGEBridge{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
MOI Sets
Sum-of-Squares cones:
SumOfSquares.SOSPolynomialSet
— Typestruct SOSPolynomialSet{
D<:AbstractSemialgebraicSet,
B<:SA.ExplicitBasis,
C<:Certificate.AbstractCertificate,
} <: MOI.AbstractVectorSet
domain::D
basis::B
certificate::C
end
The Sum-of-Squares cone is the set of vectors of coefficients a
for basis
for which the polynomial is a sum-of-squares certificate
over domain
.
SumOfSquares.WeightedSOSCone
— Typestruct WeightedSOSCone{
M,
B<:SA.ExplicitBasis,
G<:SA.ExplicitBasis,
W<:MP.AbstractPolynomialLike,
} <: MOI.AbstractVectorSet
basis::B
gram_bases::Vector{G}
weights::Vector{W}
end
The weighted sum-of-squares cone is the set of vectors of coefficients a
in basis
that are the sum of weights[i]
multiplied by a gram matrix with basis gram_bases[i]
. The matrix cone type M
is used to decide in which cone the gram matrix is constrained, e.g., MOI.PositiveSemidefiniteConeTriangle
or SumOfSquares.ScaledDiagonallyDominantConeTriangle
.
See (Papp and Yıldız, 2017; Section 1.1) and (Kapelevich et al., 2023; Section 1).
Special cases of positive semidefinite cones:
SumOfSquares.EmptyCone
— Typestruct EmptyCone <: MOI.AbstractSymmetricMatrixSetTriangle end
Cone of positive semidefinite matrices of 0 rows and 0 columns. It is reformulated into no constraints which is useful as some solvers do not support positive semidefinite cones of dimension zero.
SumOfSquares.PositiveSemidefinite2x2ConeTriangle
— Typestruct PositiveSemidefinite2x2ConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle end
Cone of positive semidefinite matrices of 2 rows and 2 columns. It is reformulated into an MOI.RotatedSecondOrderCone
constraint, see for instance (Fawzi, 2018; Equation (1)).
Inner approximations of the PSD cone that do not require semidefinite programming:
SumOfSquares.DiagonallyDominantConeTriangle
— Typestruct DiagonallyDominantConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle
side_dimension::Int
end
See (Ahmadi and Majumdar, 2017; Definition 4) for a precise definition of the last two items.
SumOfSquares.ScaledDiagonallyDominantConeTriangle
— Typestruct ScaledDiagonallyDominantConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle
side_dimension::Int
end
See (Ahmadi and Majumdar, 2017; Definition 4) for a precise definition of the last two items.
Bridges
Bridges are automatically added using the following utilities:
PolyJuMP.bridgeable
— Functionbridgeable(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.
PolyJuMP.bridges
— Functionbridges(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.
bridges(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.
Bridges for polynomial optimization
PolyJuMP.ScalarPolynomialFunction
— Typestruct ScalarPolynomialFunction{T,P<:MP.AbstractPolynomial{T}} <: MOI.AbstractScalarFunction
polynomial::P
variables::Vector{MOI.VariableIndex}
end
Defines the polynomial function of the variables variables
where the variable variables(p)[i]
corresponds to variables[i]
.
PolyJuMP.Bridges.Objective.ToPolynomialBridge
— TypeToPolynomialBridge{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}
whereF
is aMOI.AbstractScalarFunction
for whichconvert(::Type{PolyJuMP.ScalarPolynomialFunction}, ::Type{F})
. That is for instance the case forMOI.VariableIndex
,MOI.ScalarAffineFunction
andMOI.ScalarQuadraticFunction
.
Target nodes
ToPolynomialBridge
creates:
- One objective node:
MOI.ObjectiveFunction{PolyJuMP.ScalarPolynomialFunction{T}}
PolyJuMP.Bridges.Constraint.ToPolynomialBridge
— TypeToPolynomialBridge{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
inS
whereF
is aMOI.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:
Sum-of-Squares bridges
SumOfSquares.Bridges.Constraint.ImageBridge
— TypeImageBridge{T,F,G,MT,MVT,CT} <: Bridges.Constraint.AbstractBridge
ImageBridge
implements a reformulation from SOSPolynomialSet{SemialgebraicSets.FullSpace}
into the positive semidefinite cone.
Let Σ
be the SOS cone of polynomials of degree 2d and S
be the PSD cone. There is a linear relation Σ = A(S)
. The linear relation reads: p
belongs to Σ
iff there exists q
in S
such that A(q) = p
. This allows defining a variable bridge that would create variables p
and substitute A(q)
for p
but this is not the purpose of this bridge. This bridge exploit the following alternative read: p
belongs to Σ
iff there exists q
in S
such that $q \in A^{-1}(p)$ where $A^{-1}$ is the preimage of p
. This preimage can be obtained as $A^\dagger p + \mathrm{ker}(A)$ where $A^\dagger$ is the pseudo-inverse of A
. It turns out that for polynomial bases indexed by monomials, A
is close to row echelon form so $A^\dagger$ and $\mathrm{ker}(A)$ can easily be obtained.
This is best described in an example. Consider the SOS constraint for the polynomial p = 2x^4 + 2x^3 * y - x^2 * y^2 + 5y^4
with gram basis b = [x^2, y^2, x * y]
of (Parrilo, 2003; Example 6.1). The product b * b'
is
\[\begin{bmatrix} x^4 & x^2 y^2 & x^3 y\\ x^2 y^2 & y^4 & x y^3\\ x^3 y & x y^3 & x^2 y^2 \end{bmatrix}\]
Except for the entries (1, 2)
and (3, 3)
, all entries are unique so the value of the corresponding gram matrix is given by the corresponding coefficient of p
. For the entries (1, 2)
and (3, 3)
, we let -λ
be the (1, 2)
and (3, 3)
entries and we add 2λ
for the (3, 3)
entry so as to parametrize entries for which the sum is the corresponding coefficient in p
, i.e., -1
. The gram matrix is therefore:
\[\begin{bmatrix} 2 & -\lambda & 1\\ -\lambda & 5 & 0\\ 1 & 0 & 2\lambda - 1 \end{bmatrix}\]
Source node
ImageBridge
supports:
H
inSOSPolynomialSet{SemialgebraicSets.FullSpace}
Target nodes
ImageBridge
creates one of the following, depending on the length of the gram basis:
F
inMOI.PositiveSemidefiniteConeTriangle
, for gram basis of length at least 3F
inSumOfSquares.PositiveSemidefinite2x2ConeTriangle
, for gram basis of length 2F
inMOI.Nonnegatives
, for gram basis of length 1F
inSumOfSquares.EmptyCone
, for empty gram basis
in addition to
- a constraint
G
inMOI.Zeros
in case there is a monomial ins.monomials
that cannot be obtained as product of elements in a gram basis.
Bridges for PSD cone approximations
SumOfSquares.Bridges.Variable.ScaledDiagonallyDominantBridge
— Typestruct ScaledDiagonallyDominantBridge{T} <: MOI.Bridges.Variable.AbstractBridge
side_dimension::Int
variables::Vector{Vector{MOI.VariableIndex}}
constraints::Vector{MOI.ConstraintIndex{
MOI.VectorOfVariables, SOS.PositiveSemidefinite2x2ConeTriangle}}
end
A matrix is SDD iff it is the sum of psd matrices Mij that are zero except for entries ii, ij and jj (Ahmadi and Majumdar, 2017; Lemma 9). This bridge substitute the constrained variables in SOS.ScaledDiagonallyDominantConeTriangle
into a sum of constrained variables in SOS.PositiveSemidefinite2x2ConeTriangle
.