-2

I have 3 different product (A, B, C) to produce.
The quantities to produce are fix: A=3, B=3, C=2. So all together 8 products.
The problem is that I only have 2 preparation lines for 3 production lines each for a specific product: LineA, LineB, LineC.
The preparation lines can prepare all 3 type of products That means that I can only have 2 active production lines, the 3rd one is idle for that shift.
The duration of each working shift is equal.

So all together I'll have 4 working shifts (8 products / 2 preparation lines)

My question is: How can I write a algorithm which shows me all possible permutations. The output would be something similar to this (this is just one permutation, I'd need all possibilities to see the idle shifts) :

LineA LineB LineC
  A     B     -
  A     -     C
  -     B     C
  A     B     -

EDIT:
The actual lists for the above mentioned output are:

AAA
BBB
CC

EDIT2
The itertools functions are not working here as they are not taking into account the finite number of items in each list. I have a finite number of items so I need a list of list of all possible permutations/combination (in this example I would need n times of 4x3 matrix)
First I would need a first combination (like drawn in the example) than I would need all the possible combination of that.
Of course as the number is increasing there will be a bigger n for a ?x3 matrix
You can also forget the empty values, so in this case the result for the above mentioned example would be n times of a 4x2 matrix

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Gabor
  • 1,409
  • 1
  • 14
  • 24
  • 1
    Does this answer your question? [How to generate all permutations of a list?](https://stackoverflow.com/questions/104420/how-to-generate-all-permutations-of-a-list) – mkrieger1 Sep 10 '21 at 08:13
  • Unfortunately no, because I have 3 different lists of variable length and each list (production line) can only contain his own specific value (product) or nothing. So in my example (if I counted well) I will have 12 pieces of 4 by 3 matrices – Gabor Sep 10 '21 at 08:21
  • 1
    it will better if you could share the actual list – Sabil Sep 10 '21 at 08:22

1 Answers1

0

If I am not overlooking something, the set of combinations A,B,C,- is constant. It is exactly those from your example. I cannot see a way to produce the numbers required any other way. So what you have to do is produce all permutations of the 4(3) production states you showed. If preparation lines are allowed to be idle, then things get markedly more interesting.

AndreasT
  • 9,417
  • 11
  • 46
  • 60
  • Yes, the set of combination (distinct values) are constant, but the number of values of each lists are not (i.e. There are different number of repetitions of empty values) – Gabor Sep 10 '21 at 08:30