algorithmic modeling for Rhino
These two algorithms is a trial to create a system for permutations and combinations
it depends on a mathematical operation called factorial
I wish if David can add the operation to the expression editor
N! = 5! = 5 * 4 * 3 * 2 * 1
credit to this video series
https://www.youtube.com/watch?v=hJRXKq2GEo8&index=5&list=LL...
It helps find how many variations you can generate per group from a pool of selectable items.
I had my own version also
Tags:
Version 02
In case N = n
Attached
Implementation with letters for Permutations Only
successful iteration (enhanced)
it took 8000 iterations(about 5 min) to find this;
for a pool of 8 characters(a,b,c,d,e,f,g,h), with 3 spaces each time([][][])
336 possible permutations
56 possible combinations
I've previously used the itertools module in Python for this type of combinatorial generation. It's pretty neat and has both permutations, combinations and combinations with replacement. Might be helpful if you need to implement such functions in C#/VB.
Here's a quick example. Notice how the solve time is super quick, but outputting the results is the actual heavy bit, just FYI.
Hi Anders, thank you for the contribution, I was really looking for that option (Python) as it is super fast
but with the grasshopper-Anemone option, I can easily implement it within graphical and geometrical iterations easily(as you saw in last option I was able to extract the combination letters)
I just enhanced speed a bit by the Anemone's option (output after the last) in Loop-End
I will be working on developing it further
I am interested in implementing it on graphical and topological iterations now
something like the examples of finding possible plans configurations or finding colour similarities in random coloured panels, etc.
Hi again Anders, I tested your algorithm,
The combination engine looks fine,
But it seems like the permutation engine has got an error
First, it supposes to generate branches of 3 items each time
Second, it's supposed to generate 336 items, not the whole 40k iterations
Am I right? What do you think is the problem?
Afraid I don't quite follow, forgot to add what/where? The combinations function takes an integer as its second argument, that determines how many elements from the input to list to combine. The permutation functions returns all possible permutations. Anywho, it's been awhile since I used these, so might be remembering this wrong.
Edit: Oh wait, got it, you mean I didn't also use the CombinationLength as the second argument when calling the permutations function right? Didn't forget, just implemented the minimal working calls (i.e. permutations does not require a second argument and combinations do). Hope that makes sense :)
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2021 Created by Scott Davidson. Powered by