  We present an encoding and hardware-independent formulation of optimization
problems for quantum computing. Using this generalized approach, we present an
extensive library of optimization problems and their various derived spin
encodings. Common building blocks that serve as a construction kit for building
these spin Hamiltonians are identified. This paves the way towards a fully
automatic construction of Hamiltonians for arbitrary discrete optimization
problems. The presented freedom in the problem formulation is a key step for
tailoring optimal spin Hamiltonians for different hardware platforms.
