Pattern Decomposition with Complex Combinatorial Constraints: Application to Materials Discovery