algorithmic modeling for Rhino
Hi Grasshopper community,
I have a matrix of planar grid points and I am selecting two different points from them as corner points to make a rectangle. Then I need to do some optimization for the best rectangle choice.
Supposedly I have m columns and n rows of points, and my first selection is a,b where 0<=a< m-1 and 0<= b< n-1, then the range of my second point c,d should be a < c <=m-1 and b < d <= n-1
I want to set up integer abcd as four independent sliders for Galapagos in the most efficient way. Right now I have two maximum components comparing c and a+1, and d and b+1. The problem is that then half of the time the changing of c and d doesn't make a difference in the Fitness, and since my overall code is kind of heavy it also means that a lot of the time spent on computation is wasted.
I have two questions:
1. since the four sliders are not exactly independent from each other, does that affect how Galapagos runs?
2. is there a better way to set up the sliders? such as a dynamic slider?
Thank you!
Tags:
1. Dependent sliders oughtn't matter all that much.
2. I don't think so. Instead of integer sliders from 0 to m-1, you could set up floating point sliders from a to m-1, and then remap that number to an index, but then you'd end up with consecutive value ranges for the slider that all map to the same index, which I think is actually worse than your current setup. One major benefit of integer sliders is that the number of unique values you can get is usually far less than with floating point sliders.
There is an alternative way to set this up, but I don't know if it's better or worse or indifferent. Instead of definitely using the a and b values, and min/maxing the c and d values to be within some valid domain, you could pit a and c against each other, using those two integers to come up with a' and c'. So for example if {m=10, a=6, c=4}, you'd modify c to be 6+1. Any value of c between 0 and 7 thus yields the same outcome. Instead, you could define a' and c' to be something like a' = Min(a, 0.5*(a+c)), and c' = Max(c, 0.5*(a+c)). This way c will still have a different effect if it's lower than a, by depressing both the a' and c' values. It does sound quite complicated to get right though, I'm not sure I'd bother.
Galapagos doesn't deal with dynamic sliders. It creates genome constraints from the slider properties at the start of the process, and it remembers exactly how many different unique states each slider can be in. Genes then get assigned integers that index each of these unique states.
Hi David,
Thank you very much for your quick reply and now I have a better understanding of how Galapagos works.
I read one of your earlier comments on dynamic sliders with constructing a domain and it did turn out that the correspondent unique values are far less efficient, which was the reason why I asked this question to see if there have been updates. I'm very interested in the second method though as I've never thought about it before and I will give it a try.
Thank you again for your help!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by