I am struggling with using itertools permutations and combinations together. Ultimately, I am trying to create a matrix of possible combinations of Customers across various permutations of machines. I believe I have the combinations piece, but have not been able to add permutations to the script.
Here's my code so far:
import itertools
Mach = [1,2,3,4]
Cust = [1,2,3,4,5,6,7,8,9,10,11,12]
a = len(Cust)
for n in range(a):
print list(itertools.combinations(Cust,n))
n = n+1
Ideally, I would like to solve all possible outputs of:
1 - 1,2,3
2 - 4,5,6
3 - 7,8,9
4 - 10,11,12
Any help or direction would be appreciated.
Update: Forgive my ignorance, using Product is not necessarily providing the results that I was driving towards. What am I trying to do is create a list of Customers on Machines, with each Customer only reflected on one machine (at a time), and then iteratively creating another matrix of this combination; for all possible combinations. I believe this is a combination, not a permutation problem, as for the output, I do consider 1: 1, 2, 3 and 1: 3, 2, 1 to be the same.
Example: (Cust1, Mach1); (Cust2, Mach1); (Cust3, Mach2); (Cust4, Mach2); (Cust5, Mach2); (Cust6, Mach3); (Cust7, Mach3); (Cust8, Mach3); (Cust9, Mach3); (Cust10, Mach3); (Cust11, Mach4); (Cust12, Mach4)
Followed by (as an example): (Cust1, Mach1); (Cust2, Mach2); (Cust3, Mach2); (Cust4, Mach2); (Cust5, Mach2); (Cust6, Mach3); (Cust7, Mach3); (Cust8, Mach3); (Cust9, Mach3); (Cust10, Mach4); (Cust11, Mach4); (Cust12, Mach4)
etc...