Decomposition in Multidimensional Boolean-Optimization Problems with Sparse Matrices