Sparse polynomial optimization using correlative sparsity

A motivating toy example

One approach for exploiting sparsity in polynomial optimization is based on correlative sparsity and proposed by Waki, Kim, Kojima and Muramatsu. We motivate this approach by considering the following problem,

\begin{array}{ll} \text{minimize} & x_1 - x_2 + x_3 - (x_1^3 + x_2^3 + x_3^3)\\ \text{subject to} & -1 \leq x_1 x_2 \leq 1\\ & -1 \leq x_2 x_3 \leq 1\\ & x_1^2 \leq 1\\ & x_2^2 \leq 1\\ & x_3^2 \leq 1\\ \end{array}

We first setup and solve the standard second-order moment relaxation


In [1]:
using Polyopt

In [2]:
x1,x2,x3 = variables(["x1","x2","x3"]);

In [3]:
f = x1-x2+x3 - (x1^3+x2^3+x3^3);

In [4]:
g = [-1-x1*x2, 1-x1*x2,
      -1-x2*x3, 1-x2*x3,
       1-x1^2,
       1-x2^2,
       1-x3^2 ];

In [5]:
prob = momentprob(2, f, g);

In [6]:
X, Z, t, y, solsta = solve_mosek(prob);


Open file 'polyopt.task'
Problem
  Name                   :                 
  Objective sense        : max             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 35              
  Cones                  : 0               
  Scalar variables       : 1               
  Matrix variables       : 8               
  Integer variables      : 0               

Optimizer started.
Conic interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries                  : 0                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.00    
Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 35
Optimizer  - Cones                  : 1
Optimizer  - Scalar variables       : 2                 conic                  : 2               
Optimizer  - Semi-definite variables: 8                 scalarized             : 125             
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 630               after factor           : 630             
Factor     - dense dim.             : 0                 flops                  : 3.20e+04        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   4.0e+00  1.0e+00  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.01  
1   7.5e-01  1.9e-01  2.3e-01  9.86e-02   6.983593587e-02   -2.689428125e-01  1.9e-01  0.01  
2   1.3e-01  3.2e-02  4.2e-02  -8.46e-02  -3.752456365e-02  -5.018030372e-01  3.2e-02  0.01  
3   2.2e-02  5.6e-03  1.7e-02  7.26e-01   -1.750653219e+00  -1.832230908e+00  5.6e-03  0.01  
4   6.2e-04  1.6e-04  3.0e-03  9.80e-01   -1.995403808e+00  -1.997547547e+00  1.6e-04  0.01  
5   2.4e-05  6.0e-06  6.1e-04  1.01e+00   -1.999875052e+00  -1.999949321e+00  6.0e-06  0.01  
6   6.0e-07  1.5e-07  1.1e-04  1.02e+00   -1.999997848e+00  -1.999999282e+00  1.5e-07  0.02  
7   2.6e-08  6.4e-09  2.3e-05  1.02e+00   -1.999999918e+00  -1.999999973e+00  6.4e-09  0.02  
8   4.6e-10  3.9e-10  3.3e-06  9.97e-01   -1.999999999e+00  -2.000000000e+00  1.2e-10  0.02  
9   5.0e-12  2.9e-08  2.7e-07  1.00e+00   -2.000000000e+00  -2.000000000e+00  7.8e-13  0.02  
Interior-point optimizer terminated. Time: 0.02. 

Optimizer terminated. Time: 0.04    

Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: -2.0000000000e+00   nrm: 5e+00    Viol.  con: 2e-11    var: 0e+00    barvar: 0e+00  
  Dual.    obj: -2.0000000000e+00   nrm: 2e+00    Viol.  con: 0e+00    var: 7e-13    barvar: 1e-12  

We inspect the solution


In [7]:
[ prob.basis y ]


Out[7]:
35×2 Array{Polyopt.Poly{Float64},2}:
 1.0         1.0 
 x3          -1.0
 x3^2        1.0 
 x3^3        -1.0
 x3^4        1.0 
 x2          1.0 
 x2*x3       -1.0
 x2*x3^2     1.0 
 x2*x3^3     -1.0
 x2^2        1.0 
 x2^2*x3     -1.0
 x2^2*x3^2   1.0 
 x2^3        1.0 
 ⋮               
 x1*x2^2*x3  1.0 
 x1*x2^3     -1.0
 x1^2        1.0 
 x1^2*x3     -1.0
 x1^2*x3^2   1.0 
 x1^2*x2     1.0 
 x1^2*x2*x3  -1.0
 x1^2*x2^2   1.0 
 x1^3        -1.0
 x1^3*x3     1.0 
 x1^3*x2     -1.0
 x1^4        1.0 

which is feasible


In [8]:
xo = Polyopt.vectorize([x1,x2,x3],4)*y


Out[8]:
3-element Array{Float64,1}:
 -1.0
  1.0
 -1.0

In [9]:
[ Polyopt.evalpoly(gi, xo) for gi=g ]


Out[9]:
7-element Array{Float64,1}:
 -4.53271e-12
  2.0        
 -4.53271e-12
  2.0        
  4.80793e-12
  4.25748e-12
  4.80793e-12

so we have found an optimal solution.

Correlative sparsity

The correlative sparsity pattern $C$ is a symmetric matrix with the number variables as dimension. An element $C_{ij}$ is nonzero if either

  • $i=j$, i.e., we include the diagonal.
  • $x_i$ and $x_j$ appear in the same term of the objective function.
  • $x_i$ and $x_j$ both appear in a constraint $g(x)\geq 0$ or $h(x)=0$.

For the simple example, let us recall


In [10]:
f


Out[10]:
x3-x3^3-x2-x2^3+x1-x1^3

In [11]:
g


Out[11]:
7-element Array{Polyopt.Poly{Int64},1}:
 -1-x1*x2
 1-x1*x2 
 -1-x2*x3
 1-x2*x3 
 1-x1^2  
 1-x2^2  
 1-x3^2  

Let us compute the correlative sparsity pattern


In [12]:
C = Polyopt.correlative_sparsity(f, g);

In [13]:
full(C)


Out[13]:
3×3 Array{Int64,2}:
 1  1  0
 1  1  1
 0  1  1

This is a chordal matrix with 2 cliques,


In [14]:
K = Array{Int,1}[ [1,2], [2,3] ]


Out[14]:
2-element Array{Array{Int64,1},1}:
 [1,2]
 [2,3]

A weaker chordal moment relaxation formed over the cliques

In the standard moment relaxation we consider a monomial basis vector


In [15]:
u = monomials(2, [x1,x2,x3])


Out[15]:
10-element Array{Polyopt.Poly{Int64},1}:
 1    
 x3   
 x3^2 
 x2   
 x2*x3
 x2^2 
 x1   
 x1*x3
 x1*x2
 x1^2 

and the second-order moment matrix $M_2(y)\succeq 0$ corresponds to


In [16]:
u*u'


Out[16]:
10×10 Array{Polyopt.Poly{Int64},2}:
 1      x3        x3^2        x2        …  x1*x3       x1*x2       x1^2      
 x3     x3^2      x3^3        x2*x3        x1*x3^2     x1*x2*x3    x1^2*x3   
 x3^2   x3^3      x3^4        x2*x3^2      x1*x3^3     x1*x2*x3^2  x1^2*x3^2 
 x2     x2*x3     x2*x3^2     x2^2         x1*x2*x3    x1*x2^2     x1^2*x2   
 x2*x3  x2*x3^2   x2*x3^3     x2^2*x3      x1*x2*x3^2  x1*x2^2*x3  x1^2*x2*x3
 x2^2   x2^2*x3   x2^2*x3^2   x2^3      …  x1*x2^2*x3  x1*x2^3     x1^2*x2^2 
 x1     x1*x3     x1*x3^2     x1*x2        x1^2*x3     x1^2*x2     x1^3      
 x1*x3  x1*x3^2   x1*x3^3     x1*x2*x3     x1^2*x3^2   x1^2*x2*x3  x1^3*x3   
 x1*x2  x1*x2*x3  x1*x2*x3^2  x1*x2^2      x1^2*x2*x3  x1^2*x2^2   x1^3*x2   
 x1^2   x1^2*x3   x1^2*x3^2   x1^2*x2      x1^3*x3     x1^3*x2     x1^4      

In the chordal relaxation we consider basis vectors formed over the cliques


In [17]:
uk = [ monomials(2, [x1,x2,x3][ki]) for ki=K ]


Out[17]:
2-element Array{Array{Polyopt.Poly{Int64},1},1}:
 Polyopt.Poly{Int64}[1,x2,x2^2,x1,x1*x2,x1^2]
 Polyopt.Poly{Int64}[1,x3,x3^2,x2,x2*x3,x2^2]

and the moment constraint $M_2(y)\succeq 0$ is replaced by two smaller constraints $M_2(y, K_i)\succeq 0$ corresponding to


In [18]:
uk[1]*uk[1]'


Out[18]:
6×6 Array{Polyopt.Poly{Int64},2}:
 1      x2       x2^2       x1       x1*x2      x1^2     
 x2     x2^2     x2^3       x1*x2    x1*x2^2    x1^2*x2  
 x2^2   x2^3     x2^4       x1*x2^2  x1*x2^3    x1^2*x2^2
 x1     x1*x2    x1*x2^2    x1^2     x1^2*x2    x1^3     
 x1*x2  x1*x2^2  x1*x2^3    x1^2*x2  x1^2*x2^2  x1^3*x2  
 x1^2   x1^2*x2  x1^2*x2^2  x1^3     x1^3*x2    x1^4     

In [19]:
uk[2]*uk[2]'


Out[19]:
6×6 Array{Polyopt.Poly{Int64},2}:
 1      x3       x3^2       x2       x2*x3      x2^2     
 x3     x3^2     x3^3       x2*x3    x2*x3^2    x2^2*x3  
 x3^2   x3^3     x3^4       x2*x3^2  x2*x3^3    x2^2*x3^2
 x2     x2*x3    x2*x3^2    x2^2     x2^2*x3    x2^3     
 x2*x3  x2*x3^2  x2*x3^3    x2^2*x3  x2^2*x3^2  x2^3*x3  
 x2^2   x2^2*x3  x2^2*x3^2  x2^3     x2^3*x3    x2^4     

Similarly we consider the localization matrices for $g_i(x)\geq 0$. For the standard second-order moment relexation we have


In [20]:
v = monomials(1, [x1,x2,x3])


Out[20]:
4-element Array{Polyopt.Poly{Int64},1}:
 1 
 x3
 x2
 x1

In [21]:
g[1]


Out[21]:
-1-x1*x2

and the localization matrix for $g_1(x) \geq 0$ is $M_1(g_1 y)\succeq 0$ corresponding to


In [22]:
g[1]*v*v'


Out[22]:
4×4 Array{Polyopt.Poly{Int64},2}:
 -1-x1*x2      -x3-x1*x2*x3       -x2-x1*x2^2        -x1-x1^2*x2      
 -x3-x1*x2*x3  -x3^2-x1*x2*x3^2   -x2*x3-x1*x2^2*x3  -x1*x3-x1^2*x2*x3
 -x2-x1*x2^2   -x2*x3-x1*x2^2*x3  -x2^2-x1*x2^3      -x1*x2-x1^2*x2^2 
 -x1-x1^2*x2   -x1*x3-x1^2*x2*x3  -x1*x2-x1^2*x2^2   -x1^2-x1^3*x2    

In the chordal relaxation we have


In [23]:
vk = [ monomials(1, [x1,x2,x3][ki]) for ki=K ]


Out[23]:
2-element Array{Array{Polyopt.Poly{Int64},1},1}:
 Polyopt.Poly{Int64}[1,x2,x1]
 Polyopt.Poly{Int64}[1,x3,x2]

and we replace $M_1(g_1 y)\succeq 0$ by $M_1(g_1 y, K_1)\succeq 0$ corresponding to


In [24]:
g[1]*vk[1]*vk[1]'


Out[24]:
3×3 Array{Polyopt.Poly{Int64},2}:
 -1-x1*x2     -x2-x1*x2^2       -x1-x1^2*x2     
 -x2-x1*x2^2  -x2^2-x1*x2^3     -x1*x2-x1^2*x2^2
 -x1-x1^2*x2  -x1*x2-x1^2*x2^2  -x1^2-x1^3*x2   

Similarly we replace $M_1(g_2y)$ by


In [25]:
g[2]*vk[1]*vk[1]'


Out[25]:
3×3 Array{Polyopt.Poly{Int64},2}:
 1-x1*x2     x2-x1*x2^2       x1-x1^2*x2     
 x2-x1*x2^2  x2^2-x1*x2^3     x1*x2-x1^2*x2^2
 x1-x1^2*x2  x1*x2-x1^2*x2^2  x1^2-x1^3*x2   

and so on. The function $g_6(x)=1-x_2^2$ belongs to both clique 1 and 2, so we replace $M_1(g_6 y)\succeq 0$ by two smaller inequalities


In [26]:
g[6]*vk[1]*vk[1]'


Out[26]:
3×3 Array{Polyopt.Poly{Int64},2}:
 1-x2^2      x2-x2^3        x1-x1*x2^2    
 x2-x2^3     x2^2-x2^4      x1*x2-x1*x2^3 
 x1-x1*x2^2  x1*x2-x1*x2^3  x1^2-x1^2*x2^2

and


In [27]:
g[6]*vk[2]*vk[2]'


Out[27]:
3×3 Array{Polyopt.Poly{Int64},2}:
 1-x2^2      x3-x2^2*x3      x2-x2^3      
 x3-x2^2*x3  x3^2-x2^2*x3^2  x2*x3-x2^3*x3
 x2-x2^3     x2*x3-x2^3*x3   x2^2-x2^4    

Solving the chordal moment relaxation

We form the chordal moment relaxation as


In [28]:
probc = Polyopt.momentprob_chordal(2, K, f, g);

and we solve it as


In [29]:
Xc, Zc, tc, yc, solstac = solve_mosek(probc);


Open file 'polyopt.task'
Problem
  Name                   :                 
  Objective sense        : max             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 25              
  Cones                  : 0               
  Scalar variables       : 1               
  Matrix variables       : 10              
  Integer variables      : 0               

Optimizer started.
Conic interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries                  : 0                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.00    
Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 25
Optimizer  - Cones                  : 1
Optimizer  - Scalar variables       : 2                 conic                  : 2               
Optimizer  - Semi-definite variables: 10                scalarized             : 90              
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 225               after factor           : 225             
Factor     - dense dim.             : 0                 flops                  : 8.80e+03        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   6.0e+00  1.0e+00  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.00  
1   1.3e+00  2.2e-01  3.0e-01  2.31e-01   -9.994338811e-02  -3.218612660e-01  2.2e-01  0.00  
2   2.1e-01  3.4e-02  5.7e-02  1.15e-01   -3.792799213e-01  -6.488751127e-01  3.4e-02  0.00  
3   2.6e-02  4.4e-03  2.3e-02  8.22e-01   -1.902834038e+00  -1.927988979e+00  4.4e-03  0.00  
4   4.0e-04  6.7e-05  2.8e-03  9.72e-01   -1.998891996e+00  -1.999277110e+00  6.7e-05  0.00  
5   5.6e-06  9.4e-07  3.3e-04  1.00e+00   -1.999987471e+00  -1.999992683e+00  9.4e-07  0.00  
6   3.3e-08  5.5e-09  2.8e-05  1.00e+00   -1.999999947e+00  -1.999999970e+00  5.5e-09  0.00  
7   8.0e-09  3.0e-10  5.8e-06  1.03e+00   -2.000000000e+00  -2.000000000e+00  1.2e-10  0.00  
Interior-point optimizer terminated. Time: 0.00. 

Optimizer terminated. Time: 0.01    

Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: -1.9999999996e+00   nrm: 5e+00    Viol.  con: 2e-08    var: 0e+00    barvar: 0e+00  
  Dual.    obj: -1.9999999997e+00   nrm: 2e+00    Viol.  con: 0e+00    var: 3e-10    barvar: 8e-10  

In [30]:
full([ probc.basis yc ])


Out[30]:
35×2 Array{Polyopt.Poly{Float64},2}:
 1.0         1.0 
 x3          -1.0
 x3^2        1.0 
 x3^3        -1.0
 x3^4        1.0 
 x2          1.0 
 x2*x3       -1.0
 x2*x3^2     1.0 
 x2*x3^3     -1.0
 x2^2        1.0 
 x2^2*x3     -1.0
 x2^2*x3^2   1.0 
 x2^3        1.0 
 ⋮               
 x1*x2^2*x3  0.0 
 x1*x2^3     -1.0
 x1^2        1.0 
 x1^2*x3     0.0 
 x1^2*x3^2   0.0 
 x1^2*x2     1.0 
 x1^2*x2*x3  0.0 
 x1^2*x2^2   1.0 
 x1^3        -1.0
 x1^3*x3     0.0 
 x1^3*x2     -1.0
 x1^4        1.0 

In this case we also recover the optimal value at the second order relaxation. In general this is not always the case, except when all polynomials are quadratic, but under mild assumptions the hierarchy of chordal moment relaxations converges to the optimal solution (just as the regular moment relaxations).

Duality and sums-of-squares certificates

The sums-of-squares certificate is also evaluted over the cliques, in this case we have


In [31]:
r = dot(uk[1], Xc[1]*uk[1]) + dot(uk[2], Xc[2]*uk[2]) + 
        g[1]*dot(vk[1], Xc[3]*vk[1]) +
        g[2]*dot(vk[1], Xc[4]*vk[1]) +
        g[3]*dot(vk[2], Xc[5]*vk[2]) +
        g[4]*dot(vk[2], Xc[6]*vk[2]) +
        g[5]*dot(vk[1], Xc[7]*vk[1]) +
        g[6]*(dot(vk[1], Xc[8]*vk[1]) + dot(vk[2], Xc[9]*vk[2])) +
        g[7]*dot(vk[2], Xc[10]*vk[2]);

In [32]:
truncate( f - tc - r, 1e-6 )


Out[32]:
0.0

Chordal embedding

When the correlative sparsity pattern is non-chordal it is difficult to find the cliques (it is NP-hard in general). In that case we embed the correlative sparsity pattern in a larger chordal graph for which we can easily detect the cliques. The chordal embedding procedure essentially corresponds to a symbolic Cholesky factorization of the correlative sparsity pattern, and the amount of generated fill-in depends on the quality of a symmetric matrix reordering (performed by CHOLMOD).

To demonstrate this procedure we consider a problem from http://gamsworld.org/global/globallib/ex5_4_2.htm, where we have rescaled the problem such that $x_i\leq 1$ to make the relaxations easier to solve.


In [33]:
x1,x2,x3,x4,x5,x6,x7,x8 = variables(["x1","x2","x3","x4","x5","x6","x7","x8"]);

In [34]:
f = x1 + x2 + x3;

In [35]:
g = [ 400/1000 - (x4 + x6),
      300/1000 - (-x4 + x5 + x7),
      100/1000 - (-x5 + x8),
      .083333 - (0.01*x1 - 10*x1*x6 + 0.83333*x4),      
      -(x2*x4 - x2*x7 - 0.125*x4 + 0.125*x5),
      -0.125 - (x3*x5 - x3*x8 - 0.25*x5),
      x1-100/10000, 1-x1, 
      x2-1000/10000, 1-x2, 
      x3-1000/10000, 1-x3, 
      x4-10/1000, 1-x4, 
      x5-10/1000, 1-x5, 
      x6-10/1000, 1-x6, 
      x7-10/1000, 1-x7, 
      x8-10/1000, 1-x8 ];

For reference, let us first solve the third-order standard moment relaxation.


In [36]:
prob = momentprob(3, f, g);

In [37]:
X, Z, t, y, solsta = solve_mosek(prob);


Open file 'polyopt.task'
Problem
  Name                   :                 
  Objective sense        : max             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 3003            
  Cones                  : 0               
  Scalar variables       : 1               
  Matrix variables       : 23              
  Integer variables      : 0               

Optimizer started.
Conic interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries                  : 0                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.00    
Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 3003
Optimizer  - Cones                  : 1
Optimizer  - Scalar variables       : 2                 conic                  : 2               
Optimizer  - Semi-definite variables: 23                scalarized             : 36465           
Factor     - setup time             : 1.26              dense det. time        : 0.00            
Factor     - ML order time          : 0.37              GP order time          : 0.00            
Factor     - nonzeros before factor : 4.51e+06          after factor           : 4.51e+06        
Factor     - dense dim.             : 0                 flops                  : 9.62e+09        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   9.5e+00  1.0e+00  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  1.31  
1   5.9e+00  6.3e-01  1.2e+00  1.26e+00   -5.317978953e-02  1.531240147e-01   6.3e-01  2.59  
2   3.1e+00  3.2e-01  1.2e+00  2.23e+00   3.242736877e-01   3.937298576e-01   3.2e-01  3.79  
3   7.8e-01  8.2e-02  1.1e+00  1.97e+00   3.714819022e-01   3.840126058e-01   8.2e-02  5.15  
4   4.0e-01  4.2e-02  5.7e-01  7.44e-01   5.018060987e-01   5.091824536e-01   4.2e-02  6.36  
5   7.8e-02  8.2e-03  1.9e-01  7.51e-01   6.923207970e-01   6.937191037e-01   8.2e-03  7.64  
6   1.2e-02  1.2e-03  9.0e-02  6.80e-01   7.531309526e-01   7.534978957e-01   1.2e-03  8.92  
7   6.5e-03  6.8e-04  6.0e-02  8.71e-01   7.528432105e-01   7.530442937e-01   6.8e-04  10.11 
8   7.8e-04  8.2e-05  1.8e-02  9.66e-01   7.512592003e-01   7.512784806e-01   8.2e-05  11.45 
9   6.6e-04  7.0e-05  1.6e-02  8.14e-01   7.513600282e-01   7.513766701e-01   7.0e-05  12.65 
10  6.5e-05  6.8e-06  4.9e-03  9.92e-01   7.512305510e-01   7.512321823e-01   6.8e-06  13.84 
11  1.1e-08  1.1e-09  6.6e-05  9.99e-01   7.512226024e-01   7.512226027e-01   1.1e-09  15.17 
12  2.8e-11  3.0e-09  4.4e-16  1.00e+00   7.512226037e-01   7.512226037e-01   3.9e-16  16.52 
Interior-point optimizer terminated. Time: 16.52. 

Optimizer terminated. Time: 16.52   

Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: 7.5122260367e-01    nrm: 1e+01    Viol.  con: 1e-11    var: 0e+00    barvar: 6e-17  
  Dual.    obj: 7.5122260367e-01    nrm: 3e+00    Viol.  con: 0e+00    var: 3e-16    barvar: 2e-09  

and the extracted solution


In [38]:
[ prob.basis y ]


Out[38]:
3003×2 Array{Polyopt.Poly{Float64},2}:
 1.0         1.0         
 x8          0.380589    
 x8^2        0.144848    
 x8^3        0.0551275   
 x8^4        0.0209809   
 x8^5        0.0079851   
 x8^6        2.23736     
 x7          0.284471    
 x7*x8       0.108267    
 x7*x8^2     0.041205    
 x7*x8^3     0.0156822   
 x7*x8^4     0.00596846  
 x7*x8^5     -0.000457154
 ⋮                       
 x1^4*x2*x4  -0.213214   
 x1^4*x2*x3  0.00180014  
 x1^4*x2^2   0.766096    
 x1^5        1.1422e-5   
 x1^5*x8     0.00618647  
 x1^5*x7     0.00911014  
 x1^5*x6     0.132243    
 x1^5*x5     0.0175621   
 x1^5*x4     0.0169488   
 x1^5*x3     0.011129    
 x1^5*x2     0.0139941   
 x1^6        2.12709     

is feasible


In [39]:
xo = Polyopt.vectorize([x1,x2,x3,x4,x5,x6,x7,x8],6)*y


Out[39]:
8-element Array{Float64,1}:
 0.102695
 0.1     
 0.548528
 0.26506 
 0.280589
 0.13494 
 0.284471
 0.380589

In [40]:
[ Polyopt.evalpoly(gi, xo) for gi=g ]


Out[40]:
22-element Array{Float64,1}:
  7.38298e-15
  2.38698e-15
  2.10942e-15
 -1.16573e-15
 -7.84095e-16
 -1.7486e-15 
  0.0926948  
  0.897305   
  8.00748e-15
  0.9        
  0.448528   
  0.451472   
  0.25506    
  0.73494    
  0.270589   
  0.719411   
  0.12494    
  0.86506    
  0.274471   
  0.715529   
  0.370589   
  0.619411   

Now, let us form the chordal moment relaxation using a chordal embedding,


In [41]:
probc = momentprob_chordalembedding(3, f, g);

In [42]:
Xc, Zc, tc, yc, solstac = solve_mosek(probc);


Open file 'polyopt.task'
Problem
  Name                   :                 
  Objective sense        : max             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 364             
  Cones                  : 0               
  Scalar variables       : 1               
  Matrix variables       : 29              
  Integer variables      : 0               

Optimizer started.
Conic interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries                  : 0                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.00    
Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 364
Optimizer  - Cones                  : 1
Optimizer  - Scalar variables       : 2                 conic                  : 2               
Optimizer  - Semi-definite variables: 29                scalarized             : 3130            
Factor     - setup time             : 0.01              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 2.92e+04          after factor           : 2.92e+04        
Factor     - dense dim.             : 0                 flops                  : 6.10e+06        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.3e+01  1.0e+00  1.0e+00  0.00e+00   0.000000000e+00   0.000000000e+00   1.0e+00  0.01  
1   5.3e+00  3.9e-01  1.1e+00  1.40e+00   5.234775856e-02   2.057445265e-01   3.9e-01  0.02  
2   1.6e+00  1.2e-01  6.2e-01  1.82e+00   3.507855701e-01   3.738369339e-01   1.2e-01  0.03  
3   7.0e-01  5.2e-02  3.8e-01  1.50e+00   3.482869992e-01   3.540661460e-01   5.2e-02  0.04  
4   2.6e-01  1.9e-02  1.8e-01  8.84e-01   4.172594672e-01   4.171160016e-01   1.9e-02  0.04  
5   1.0e-01  7.6e-03  8.3e-02  4.68e-01   5.542761603e-01   5.523928806e-01   7.6e-03  0.05  
6   3.1e-02  2.3e-03  4.4e-02  6.25e-01   6.807350918e-01   6.802570459e-01   2.3e-03  0.06  
7   1.6e-02  1.2e-03  3.0e-02  7.28e-01   7.201121827e-01   7.198240970e-01   1.2e-03  0.07  
8   5.4e-03  4.0e-04  1.7e-02  8.66e-01   7.390786835e-01   7.389813396e-01   4.0e-04  0.08  
9   2.6e-03  2.0e-04  1.1e-02  8.67e-01   7.465047041e-01   7.464412479e-01   2.0e-04  0.09  
10  4.5e-04  3.4e-05  4.6e-03  9.55e-01   7.503255064e-01   7.503138166e-01   3.4e-05  0.10  
11  7.1e-05  5.3e-06  1.8e-03  9.71e-01   7.511066254e-01   7.511044815e-01   5.3e-06  0.11  
12  8.0e-07  6.0e-08  1.9e-04  9.96e-01   7.512211827e-01   7.512211563e-01   6.0e-08  0.12  
13  4.1e-08  3.0e-09  4.1e-05  9.97e-01   7.512225269e-01   7.512225255e-01   3.0e-09  0.12  
14  1.5e-08  8.0e-10  5.0e-06  9.93e-01   7.512226079e-01   7.512226077e-01   8.5e-11  0.13  
Interior-point optimizer terminated. Time: 0.13. 

Optimizer terminated. Time: 0.13    

Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: 7.5122260786e-01    nrm: 1e+01    Viol.  con: 2e-08    var: 0e+00    barvar: 0e+00  
  Dual.    obj: 7.5122260775e-01    nrm: 5e+00    Viol.  con: 0e+00    var: 1e-10    barvar: 1e-09  

In [43]:
full([ prob.basis y yc ])


Out[43]:
3003×3 Array{Polyopt.Poly{Float64},2}:
 1.0         1.0           1.0       
 x8          0.380589      0.380589  
 x8^2        0.144848      0.144848  
 x8^3        0.0551275     0.0551274 
 x8^4        0.0209809     0.0209809 
 x8^5        0.0079851     0.00798508
 x8^6        2.23736       3.53713   
 x7          0.284471      0.284471  
 x7*x8       0.108267      0.0       
 x7*x8^2     0.041205      0.0       
 x7*x8^3     0.0156822     0.0       
 x7*x8^4     0.00596846    0.0       
 x7*x8^5     -0.000457154  0.0       
 ⋮                                   
 x1^4*x2*x4  -0.213214     0.0       
 x1^4*x2*x3  0.00180014    0.0       
 x1^4*x2^2   0.766096      0.0       
 x1^5        1.1422e-5     1.14246e-5
 x1^5*x8     0.00618647    0.0       
 x1^5*x7     0.00911014    0.0       
 x1^5*x6     0.132243      0.24959   
 x1^5*x5     0.0175621     0.0       
 x1^5*x4     0.0169488     0.00735863
 x1^5*x3     0.011129      0.0       
 x1^5*x2     0.0139941     0.0       
 x1^6        2.12709       2.61665   

In [ ]: