Optimization
JuMP.set_optimizer
MomentTools.get_measure
MomentTools.get_minimizers
MomentTools.get_series
MomentTools.maximize
MomentTools.minimize
MomentTools.optimize
MomentTools.polar_minimize
Solving moment programs
JuMP.set_optimizer
— Functionv, M = JuMP.set_optimizer(M, optimizer)
Set the optimizer of the moment program M
to the dual optimizer of optimizer
.
MomentTools.minimize
— Functionv, 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 M
.
$f, e_i, p_i$ 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
Example
using MomentTools
X = @polyvar x1 x2
e1 = x1^2-2
e2 = (x2^2-3)*(x1*x2-2)
p1 = x1
p2 = 2-x2
v, M = minimize(-x1, [e1, e2], [p1, p2], X, 3)
To recover the optimal values, see get_minimizers
, get_measure
, get_series
.
MomentTools.polar_minimize
— Functionv, 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
MomentTools.maximize
— Functionv, M = maximize(f, [e1, e2, ...], [p1, p2, ...], X, d, optimizer)
Similar to the function minimize
but compute the supremun of f
.
MomentTools.optimize
— Functionv, M = optimize(M)
Run the optimizer on the moment program M
and output the objective_value v
and the moment program M
. If the optimization program has no value, it returns nothing
and M
.
v, M = optimize([(f, set), ...], X, d, optimizer)
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 MomentTools
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_minimizers
, get_measure
, get_series
.
Optimal solutions
MomentTools.get_minimizers
— Functionget_minimizers(M)
Return the minimizer points of the optimized moment program M
.
get_minimizer(M)
[1.41421 1.73205; 1.41421 1.41421; 1.41421 -1.73205]
MomentTools.get_measure
— Functionw, Xi = get_measure(M, lambda = [(-1)^(k-1) for k in 1:M[:nu]])
Return the approximation of the moment sequence $\sum_{i=1}^{\nu} \lambda_i \mu_i$ as weighted sum of Dirac measures: $\sum_{k=1}^{r} \omega_k \delta_{\xi_k}$ where
w
is the vector of weights of the Dirac measures.Xi
is 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])
MomentTools.get_series
— Functionget_series(M)
Return the vector of $\nu$=M[:nu]
series of optimal moments of the optimized moment program M
.