Given a binary vector $x$, I need to efficiently construct a matrix $A$ such that $x$ is a global minimizer of $z^TAz$ over binary $z$'s. I need the diagonal elements to be positive.
given a binary point, design a quadratic which is minimized at that point!
82 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
You want to minimize $$\sum_j (z_j-x_j)^2.$$ Expanding this will yield a quadratic part, a linear part, and a constant part. You can omit the constant part because shifting an objective by a constant does not affect optimality. To avoid the linear part, rewrite $z_j$ as $z_j^2$ and combine it with the quadratic part.
As @RobertIsrael noted, this approach yields objective function $$\sum_j (1-2x_j)z_j^2,$$ which does not have positive diagonal elements when $x_j=1$. If you allow a linear part of the objective, you can use the fact that $z$ is binary to add any multiple of $z_j^2-z_j$ without changing the objective value. In particular, taking $\lambda_j > 1-2x_j$ and adding $$\sum_j \lambda_j (z_j^2-z_j)$$ yields positive diagonal elements.
Suppose the system is of dimension $d$, let $f_A(z)=z^\textsf{T}Az$ and let $n$ be the number of $1$'s in $x$, we have the following cases:
$(1)\ n=0:$ Let $A=I$, the idenetity matrix, then $f_A(z)=z_1^2+\cdots+z_d^2$ is minimised at $x=0$.
$(2)\ n=1:$ No such $A$ exists. Indeed, suppose only the $j$-th element of $x$ is $1$, then $f_A(x)=A_{jj}>0$ since $A$ has positive diagonal elements. But then $x$ is not the minimiser since $f_A(0)=0$ for all $A$.
$(3)\ n\geq2:$ Let $i_1,i_2,...,i_n$ be the indices of non-zero elements in $x$, sorted in increasing order. Let $S$ be the index set below $$S=\{(i_1,i_2),(i_3,i_4),...,(i_{n-1},i_n)\}\ \text{if $n$ is even;}$$ $$S=\{(i_1,i_2),(i_2,i_3),...,(i_{n-1},i_n)\}\ \text{if $n$ is odd}.$$ We define $A$ as follows:
For example,
By such construction, $x$ is the unique minimiser of $f_A$. Indeed, if $A$ is as above then $$f_A(z)=P_1(z)+P_2(z)\text{ where }P_1=\sum_{j=1}^dz_j^2\text{ and }P_2=-3\sum_{(j,k)\in S}z_jz_k.$$
Note that
This shows $x$ is the unique minimiser.
There might be better constructions, but the above method seems to make $A$ as sparse as possible, and the algorithm complexity is $\mathcal O(d)$ which should be efficient enough.