Grasshopper

algorithmic modeling for Rhino

[QUESTION] How many components and parameters has GH currently?

I have this small question to GH development team (of course only built-in components). Is there any option to see this data? I'm preparing a presentation comparing standard script languages and GH and this data could be useful. Other thing that I want to calculate is how many combinations (only possible and "legal" combinations) are possible with all built-in components.

Best regards.

Views: 824

Replies to This Discussion

You can examine all loaded objects at runtime by accessing the Instances.ComponentServer. For example, paste this in a default C# component:

A = string.Format("Grasshopper has cached {0} object proxies", Instances.ComponentServer.ObjectProxies.Count);

Those proxies will include all parameters, special objects (like Scribble and Sketch) and all components, including all legacy and test components which are not otherwise accessible through the interface. I get 858 on my current install which has no 3rd party components loaded but which does have a few more than the latest public release.

You can further examine each proxy to see whether it implements IGH_Component or IGH_Param or neither. And whether the exposure is set to GH_Exposure.hidden or whether it is an Obsolete object.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

As for how many combinations are possible, that's obviously a very simple question as the answer is infinite. You have to put a limit on the number of components you're allowed to use before you can say how many valid permutations exist.

 

But allow me to guesstimate a number for 20 components (no more, no less). Here are my starting assumptions:

  1. Let's say the average input and output parameter count of any component is 2. So we have 20 components, each with 2 inputs and 2 outputs.
  2. There are roughly 35 types of parameter, so the odds of connecting two parameters at random that have the same type are roughly 3%. However there are many conversions defined and often you want a parameter of type A to seed a parameter of type B. So let's say that 10% of random connections are in fact valid. (This assumption ignores the obvious fact that certain parameters (number, point, vector) are far more common than others, so the odds of connecting identical types are actually much higher than 3%)
  3. Now even when data can be shared between two parameters, that doesn't mean that hooking them up will result in a valid operation (let's ignore for the time being that the far majority of combinations that are valid are also bullshit). So let's say that even when we manage to pick two parameters that can communicate, the odds of us ending up with a valid component combo are still only 1 in 2.
  4. We will limit ourselves to only single connections between parameters. At no point will a single parameter seed more than one recipient and at no point will any parameter have more than one source. We do allow for parameters which do not share or receive data.

 

So let's start by creating the total number of permutations that are possible simply by positioning all 20 components from left to right. This is important because we're not allowed to make wires go from right to left. The left most component can be any one of 20. So we have 20 possible permutations for the first one. Then for each of those we have 19 options to fill the second-left-most slot. 20×19×18×17×...×3×2×1 = 20! ~2.5×1018.

 

We can now start drawing wires from the output of component #1 to the inputs of any of the other components. We can choose to share no outputs, output #1, output #2 or both with any of the downstream components (19 of them, with two inputs each). That's 2×(19×2) + (19×2)×(19×2-1) ~ 1500 possible connections we can make for the outputs of the first component. The second component is very similar, but it only has 18 possible targets and some of the inputs will already have been used. So now we have 2×(18×2-1) + (18×2-1)×(18×2-1) ~1300. If we very roughly (not to mention very incorrectly, but I'm too tired to do the math properly) extrapolate to the other 18 components where the number of possible connections decreases in a similar fashion thoughout, we end up with a total number of 1500×1300×1140×1007×891×789×697×...×83×51×24×1 which is roughly 6.5×1050. However note that only 10% of these wires connect compatible parameters and only 50% of those will connect compatible components. So the number of valid connections we can make is roughly 3×1049.

All we have to do now is multiply the total number of valid connection per permutation with the total number of possible permutations; 20! × 3×1049 which comes to 7×1067 or 72 unvigintillion as Wolfram|Alpha tells me.

Impressive as these numbers sound, remember that by far the most of these permutations result in utter nonsense. Nonsense that produces a result, but not a meaningful one.

EDIT: This computation is way off, see this response for an improved estimate.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Fun fact, I actually used Grasshopper to estimate the progression of possible connections for each subsequent component. Calculate a few key points by hand, interpolate those points with a curve, intersect them with vertical lines, each representing one of the 20 components. Measure the length of each of these lines, create a string with all those lengths interspersed with "*" symbols and copy-paste that into Wolfram|Alpha.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

:) Nice answer, lot of data to think about. When I said "how many combinations" I was thinking about "1-1" legal combinations, but 20 is a nice number to use in estimations  This conversation remembers me this video from vsauce: http://www.youtube.com/watch?v=DAcjV60RnRw

The "same" estimation made with English language (converting definitions into sentences): http://clas.mq.edu.au/infinite_sentences/index.html

We could definitely say that GH is an Open System :)

Thinking about a possible practical use of this data into grasshopper workflow. 

The Markov is the only thing at the moment that is even remotely related to this piece of theory. By recording what people do -not just once but repeatedly- it's almost exclusively a record of meaningful component combinations. It doesn't at present record any wire events though. It would be possible (though legal implications complicate the matter) to harvest this information from a large set of users and aggregate the results into a single 'most common' chain database.

If wire events were also recorded, everything is in place to start auto-generating meaningful networks, a la the automatic curse generator. But I have serious doubts as to the usefulness of such an exercise. Someone else is welcome to do it of course and they are welcome to the Markov database already running on every GH install.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ho! Major mistake right at the start. The total possible number of initial left to right layouts isn't 20! at all. There's ~800 choices for the first slot, then again 800 choices for the next slot etc. etc. So it's 80020 which is ~1058. Assuming you're allowed to use the same component more than once.

 

1058 × 1049 = 10107 total possible algorithms. When talking about big numbers I only have three frames of reference. The distance from us to the edge of the observable universe is roughly 1029 millimeters, the observable universe contains 1080 protons and the volume of the observable universe is roughly 5×10105 cubic nanometers. So you could more or less put a different valid Grasshopper algorithm into every cubic nanometer of this universe.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service