Let $Q \in \R^{n \times n}$ be an upper triangular matrix of weights. One weight $Q_{ij}$ for each pair of indices $\{i, j\} \subseteq \{1, ..., n\}$ with $i < j$.
Let $f_Q: \{0, 1\}^n \rarr \R$ be a function such that for each $x \in \{0, 1\}^n$
$$ f_Q(x) = x^{T} Qx = \sum_{i=1}^n \sum_{j=1}^n Q_{ij}x_i x_j $$
Weight $Q_{ij}$ contributes to the sum if $x_i$ and $x_j$ are 1.
Task: find a binary vector $x^* \in \{0, 1\}^n$ that minimizes $f_Q$:
Let $\{1, ..., n\}$ be a set of cities.
Let $d_{ij}$ be the distance between cities $i$ and $j$.
Task: find the shortest possible route that visits all of the $n$ cities exactly once and returns to the origin city.
Binary variables:
Objective function: