For an open set $A\subset[0,1]^d$, denote the connected components of $A$ by $cc(A)$. Given a smooth symmetric function $f\colon[-1,1]^d\to\mathbb R$ with $f(0)>0$, I am interested in the optimization problem $$\sup_A \phi(A):=\sup_A \sum_{U\in cc(A)}\int_{U^2} f(x-y)\,dx\,dy,$$ where the sup is taken over all open subsets $A\subset[0,1]^d$. Note that the problem is trivial if $f\ge0$ in which case $\sup_A\phi(A)=\int_{([0,1]^d)^2}f(x-y)\,dx\,dy$.

Has this (or a similar problem) been studied in the literature? It seems to be a rather natural question but I feel that I searched for the wrong keywords. I am mainly interested in the existence of optimal $A$ and their properties (I think I convinced myself that optimal $A$ (if they exist) satisfy $\overline A=[0,1]^d $ due to $f(0)>0$).

1more comment