Which Python package is suitable for solving the following mixed integer optimization problem?

81 Views Asked by At

Assume I have given a matrix $A=\mathbb R^{d \times n}$. I want to minimize the following:

$$\min \left \| \begin{bmatrix} a_{11} & \dots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{d1} & \dots & a_{dn} \end{bmatrix}-\begin{bmatrix} x_{11} & \dots & x_{1d} & c_1 \\ \vdots & \ddots & \vdots &\vdots \\ x_{d1} & \dots & x_{dd} & c_d \end{bmatrix}\begin{bmatrix} a_{11} & \dots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{d1} & \dots & a_{dn} \\ 1 & \dots & 1 \end{bmatrix}\right \|_2^2 $$

subject to $c_1,\ldots, c_d \in \mathbb R$, $x_{11}, \ldots, x_{dd}=0$, $x_{ij}\in\{0,1\}$ for $i \neq j$ and $\text{trace}(e^X)=d$, where $$X=\begin{bmatrix} x_{11} & \dots & x_{1d} \\ \vdots & \ddots & \vdots \\ x_{d1} & \dots & x_{dd} \end{bmatrix}.$$

We can obviously rewrite this. By a slight abuse of notation, we can define $x_{i,d+1}:=c_i$ and rewrite the problem the following way:

$$\min \sum\limits_{i=1}^d\sum\limits_{j=1}^n(a_{ij}-\sum\limits_{k=1}^{d+1}x_{ik}a_{kj})^2$$ subject to $c_1,\ldots, c_d \in \mathbb R$, $x_{11}, \ldots, x_{dd}=0$, $x_{ij}\in\{0,1\}$ for $i \neq j$ and $\text{trace}(e^X)=d$.

Now I am currently trying to implement this in Python. Cvxopt or scipy optimize do not manage any integer programming. I thought of the package mip and pulp; But as far as I am concerned, pulp only allows integer linear programming, so I am quite puzzled on how to implement the condition $\text{trace}(e^X)=d$ in any of the two. Can anyone help?