Hi,
How could I achieve this? From two separate lists, obtain the list of permutations but with each pair stored in a different tree branch.
However, the order matters, I want to first pick an item from the first list (example, 1) and then go through the second list (example, a, b, c, d) to generate 1a, 1b, 1c, 1d. Only then jump to the second item of the first list (2) to generate 2a, 2b, 2c, 2d and so on.
Thanks!
ftzuk
(Ftzuk)
March 20, 2025, 4:42pm
2
Oops I misread your post. Anyway.
Thanks a lot! Quite simple actually!
The white group adds labels showing the dimensions of each permutation. Note that some of them are simply 90 degree rotations of others, it would be interesting to remove those eh?
[permutations_2020Nov22a]
permutations_2020Nov22a.gh (28.2 KB)
The list of permutations below with some in bold noting that they are just rotated 90 degrees.
{0;0}
X=10, Y=10, Z=10
X=20, Y=10, Z=10
X=30, Y=10, Z=10
X=10, Y=20, Z=10
X=20, Y=20, Z=10
X=30, Y=20, Z=10
X=10, Y=30, Z=10
X=20, Y=30, Z=10
X=3…
Nothing random about permutations unless you make it so. CrossRef component does that or you can use this little bit of Python:
__author__ = "Joseph Oster"
__version__ = "2021.06.06"
from itertools import permutations
perm = permutations(vals, len(vals))
perms = []
for c in list(perm):
perms.append("+".join(c))
P = perms
[permutations_2024Jul15a]
permutations_2024Jul15a.gh (10.0 KB)
To randomize, you can jitter the list of permutations and perhaps use a SubSet (Sub List) of them…
__author__ = "Joseph Oster"
__version__ = "2021.06.06"
from itertools import permutations
perm = permutations(vals, len(vals))
perms = []
for c in list(perm):
perms.append("+".join(c))
P = perms