Optimization
An SDP optimizer package should first be installed to be able to solve the moment optimization programs. This can be done at the beginning of the session, with the following function:
MomentPolynomialOpt.mpo_optimizer — Function
mpo_optimizer(opt)Define the default optimizer opt for the optimization problems created by MomentPolynomialOpt
Example
using CSDP
mpo_optimizer(CSDP.Optimizer)mpo_optimizer(opt, args...)Define the default optimizer opt with its attribute args... for the optimization problems created by MomentPolynomialOpt
Example
using MosekTools
mpo_optimizer(Mosek.Optimizer, "QUIET" =>true)Solving Moment Optimization Programs
MomentPolynomialOpt.minimize — Function
v, M = minimize(f, [e1, e2, ...], [p1, p2, ...], X, d, optimizer)Compute the infimum of f under the constraints $e_i=0$ and $p_i \geq 0$ using a relaxation of order d on the moments in the variable X and the optimizer optimizer.
See optimize.
MomentPolynomialOpt.maximize — Function
v, M = maximize(f, [e1, e2, ...], [p1, p2, ...], X, d, optimizer)Similar to the function minimize but compute the supremun of f.
See optimize.
MomentPolynomialOpt.optimize — Function
v, M = optimize(sense, f, [e1, e2, ...], [p1, p2, ...], X, d)Compute the optimum of f under the constraints $e_i$ =0 and $p_i \geq 0$ using a relaxation of order d on the moments in the variable X.
- $f, e_i, p_i$ should be polynomials in the variables X.
- 'sense` is a Symbol in [:Inf, :inf, :Min,:min] or :Sup, :sup, :Max, :max
Xis a tuple of variablesdis the order of the relaxationoptimizeris the optimizer used to solve the moment relaxation. By default it isMPO[:optimizer].
If the problem is feasible and has minimizers, it outputs
- v: the optimum value
- M: the moment model of type JuMP.Model
Example
using MomentPolynomialOpt
X = @polyvar x1 x2
e1 = x1^2-2
e2 = (x2^2-3)*(x1*x2-2)
p1 = x1
p2 = 2-x2
v, M = optimize(:inf, -x1, [e1, e2], [p1, p2], X, 3)To recover the optimizers, see get_optimizers, get_measure, get_series.
v, M = optimize([(f, set) ...], X, d)Solve the moment program of relaxation of order d in the variables X, defined by the constraint or objective paires (f, set) where f is a polynomial and set is a string
- "inf", "sup" to define the objective.
- "=0" to define zero constraints:
- ">=0", "<=0" to define sign constraints
It outputs
- v: the optimal value
- M: the optimized moment program of type MOM.Model
Example
using MomentPolynomialOpt, DynamicPolynomials
X = @polyvar x1 x2
e1 = x1^2-2
e2 = (x2^2-3)*(x1*x2-2)
p1 = x1
p2 = 2-x2
v, M = optimize([(-x1, "inf"), (e1, "=0"), (e2, "=0"), (p1, ">=0"), (p2>=0)], X, 3)To recover the optimal values, see get_optimizers, get_measure, get_series.
Optimal solutions
MomentPolynomialOpt.get_optimizers — Function
get_optimizers(M, , t::Int64 = Inf)Return the optimal points of the moment program M, using moments of degree <=t (default: twice the order of the relaxation minus 2)
get_optimizers(M)
[1.41421 1.73205; 1.41421 1.41421; 1.41421 -1.73205]MomentPolynomialOpt.get_measure — Function
w, Xi = get_measure(M)Return the approximation of the moment sequence $\mu$ truncated to moments of degree <= t (default: twice the order of the relaxation minus 2), as weighted sum of Dirac measures: $\sum_{k=1}^{r} \omega_k \delta_{\xi_k}$ where
wis the vector of weights of the Dirac measures.Xiis matrix of $n\times r$ support points of the corresponding Dirac measures. The columnXi[:,i]is the support point $\xi_{i}$ of the ith Dirac measure and its weights isw[i].
w, Xi = get_measure(M)
([0.1541368146508854, 0.5889741915171074, 0.256888993597116], [1.4142135624216647 1.414213562080608 1.4142135620270329; -1.732052464639053 1.4141771454788292 1.7319839273833693])MomentPolynomialOpt.get_series — Function
get_series(M)Return the vector of $\nu$=M[:nu] series of optimal moments of the optimized moment program M.
Extended Moment Optimization Programs
MomentPolynomialOpt.annihilator — Function
K,I,P,B = annihilator(sigma::Series{R}, L, eqzero = is_zero)Compute a graded basis of the annihilator of the positive series $σ$ in the space spanned by the list of monomials L.
It outputs:
- K the graded basis
- I the initial monomials of K
- P the orthogonal basis
- B the monomial basis
MomentPolynomialOpt.polar_minimize — Function
v, M = polar_minimize(f, [h1, h2, ...], [g1, g2, ...], X, degree_approx, optimizer)Compute the infimum of the f (equality constraints hi == 0 and the sign constraints gi >= 0) on the moment side. It does that calling minimize(...), replacing the equality constraints [h1, h2, ...] with generators of the polar ideal.
f, hi, gi should be polynomials in the variables X.
If the problem is feasible and has minimizers, it outputs
- v: the minimum value
- M: the moment model of type MOM.Model
MomentPolynomialOpt.polar_ideal — Function
j = polar_ideal(f, [h1, h2, ...], [g1, g2, ...], X)Compute generators of the polar ideal associated with f, [h1, h2, ...], [g1, g2, ...] (equality constraints hi == 0 and the sign constraints gi >= 0) with respect to the variable vector X.
f, hi, gi should be polynomials in variables X.
MomentPolynomialOpt.preordering — Function
pg = preordering([g1, g2, ...])Compute all the product, without repetitions, of the gi's i.e. computes the generators (as a quadratic module) of the preordering O(g1, g2, ...).
Combined Moment Optimization Programs
MomentPolynomialOpt.min_ellipsoid — Function
Compute the minimal ellipsoid enclosing the point P of the semi-algebraic set defined by H[j]=0, G[k]>=0
It outputs the center c and the matrix U which columns are the principal axes of the ellipsoid.