This is the [quadratic unconstrained binary optimization (QUBO) problem][1], which is NP-hard. [1]: https://en.wikipedia.org/wiki/Quadratic_unconstrained_binary_optimization