This might be useful? I adapted some Python code (somewhat blindly) that generates combinations of a list of values, from here:
I realized later that my Python struggles with string join ( "+".join(c) ) and converting integers to strings could have been avoided using a ‘Type hint’ of ‘str’ instead of ‘int’. This also makes the code much more flexible since it will work with a list of characters or words as well as integers (or reals?).
This is a simple demo of the modified Combos Python component using characters:
[Combos_2021Jan15a]
Combos_2021Jan15a.gh (10.0 KB)
The slightly simplified Python:
from itertools impo…
The code generates 524K combinations in 3.5 seconds. Then I filter those that add up to 9.
5+4
5+2+2
4+3+2
3+3+3
3+2+2+2
assign panels_2023Sep5b.gh (33.1 KB)
Inserting CSet prior to Split (Text Split) was crucial to improving performance.
Split was producing ~five million results in 3.3 seconds but MA was taking 1.6 minutes