Consider the vertices of an n-dimensional cube. Distance between two vertices is measured as the minimum number of edges between the two vertices. Now consider a subset of these vertices. If we call the total set of vertices as 'T' and the subset as 'S' then our objective is to partition 'S' into two sets 'A' and 'B' and for both of these sets find vertices $x_A$ and $x_B$ from T such that the sum total of the distance between $x_A$ and the vertices of A and $x_B$ and the vertices of B should be a minimum.
How to approach this question?
Given that we know the distance relation for every pair of vertex, is it possible to know the minimum distance through some simple calculation?
To clarify, I am answering the following question:
For a subset $S$ of the vertex set of a graph $G$, let $G[S]$ denote the induced subraph on $S$.
Let $Q_n$ denote the $n$-th cube graph, and let $d(v,w)$ for $v,w \in V(Q_n)$ be the graph metric. Then your $T$ is just $V(Q_n)$, and you want to find a pair $(a,b)_{A\sqcup B} \in V(Q_n)^2$ so that:
"Fix a subset $S \subseteq V(Q_n)$, and let $A \sqcup B$ be a partition of $S$. Then:
$$\sum_{\alpha \in A} d(a,\alpha), \sum_{\beta \in B} d(b,\beta)$$
are both minimized, where the graph metric is taken over $Q_n[A]$ and $Q_n[B]$, respectively."
Notice that we only need be concerned with the distance in the induced subgraphs, because $a$ and $b$ must be in $A$ and $B$ respectively to achieve a minimum.
Then $a$ must be in the center of $Q_n[A]$, and the same for $b$.
To be specific, we define the eccentricity $\epsilon(v)$ of a vertex $v$ in $G$ to be:
$$\max_{w}\{d(v,w) : w \in G\}$$
The radius $r(G)$ of a graph is the minimum of all eccentricities, and the diameter $d(G)$ is the maximum.
The center of a graph Cent$(G) = \{v \in G : \epsilon(v) = r(G)\}$ are all the vertices of minimum eccentricities.
It follows that to minimize our formulae above, the vertices $a$ and $b$ must be in the respective centers of $Q_n[A]$ and $Q_n[B]$.
Provided $Q_n$ is not too large, this should be easy enough to compute with a program. I believe Mathematica has a built-in function to compute the center of the input graph.