Combinatorics and Complexity of Partition Functions