Grasshopper

algorithmic modeling for Rhino

# Setting population and generation

Hi, I made a simple example to learn how generative design with Wallacei works. I made a solid extruded from a square with a 1-20 slider for the height. I set a '0' value to all the solution up to 10 and '1' value to solution from 11 to 20 (so this is my fitness value).
I set 1 as generation size and 20 as population, becouse i can have a maximum of 20 solution. I only want solutions with fitness value corrisponding to '1' so, when I extract that, i expect to have 10 valid and different solutions. But when I run the analysis I obtain some repeated results in my 10 solutions.
I would like to have all my possible and only solutions analyzed and displayed.
I know that I probably set the generation/population values wrong, but I don't know how to do it, also reading the Primer. Can someone help?

Views: 58

Attachments:

### Replies to This Discussion

Hi,

generation size 1 and generation count 20 is not a correct input. if for some reason (i don't know why tho) you need to keep the population size 20, I suggest the generation size to be 4 and the generation count 5 (or vice versa).  when you run the simulation with the above setting, the following is the individuals of the Pareto front for all population.

now if you want to increase variation amongst them, you can increase the mutation probability from 1/n to 0.9 and by running the simulation again, the Pareto front set will have more variation, following picture:

it may not be very visible by looking at the images but once you compare the numbers (the gene) you will see an increase in variation.

but this is not a good example to get you going with GD. This is not a problem to run an evolutionary simulation for and to understand the GD process. I strongly recommend you to watch WallaceiX playlist in our youtube channel in which we explain one of the example files in detail.

This example is too easy to solve with an evolutionary solver that the use of an evolutionary solver is not a right move. it is like you use a tower crane to lift your laptop that you can simply lift it with your arms.

Hope it helps,

Following is the link to our youtube channel that you can find the playlist

Thank you for the reply, I know this is a very simple example, but I made this to understand more complex file I made yet. The key question is if the GD can analyze all the possible solutions or it can only analyze randomly. So if, in this case, can it analyze trying all the slider values from 1 to 20.
Than I'm trying to understand how to set genes and population, so what is the criteria. I saw all the Wallacei X playlist videos but it's difficult to associate numbers to the real application.

here is the key concept I think you are missing, an evolutionary solver helps you to search the search space (all possible combinations of your genes) intelligently rather than one by one creating all the possible options. if you want to create all the possible options, there is no point to use an evolutionary solver. just simply shuffle through all your genes which as you may guess it, it will take a lot of time for complex problems. Here is when an evolutionary solver comes to play, with the principles from biology, with the help of an evolutionary solver you can search your search space in a much more efficient manner and reach to your answers much faster.

and second, about the randomness, there is an element of randomness involved in the process but this does not mean that the solutions are being generated only "randomly". except the first generation (gen 0) all solutions are being generated based on a series of biological principles of cross over and mutations, that is why you see the incremental increase in fitness.

And regarding the generation size and count,  There is no universal number that works for all problems, it is different case by case. The best practice is to run a test and study the graphs to understand the optimisation and convergence trends and revise the numbers accordingly. I recommend starting with the default values.

Thank you, clear

I have a doubt in selecting my solutions. In this example I'm trying to fit some boxes, genes are position in X,Y and rotation. When they do not collide i have a value of 4, when some collide I have a minor value. Then I have a bounding box with total area. My goal is no collision with lower area, so FO1 with a value of 4 with lower area. How can I select these results? So the best fitness rank of both

Prova%20collision.gh

by June Lee

• View All