Avoiding invalid outcomes

Hi All,

I’m new to exploring optomisation in grasshopper, and have been doing a lot of research over the past few days.

I’m working on a simple analysis using Wallacei and Karamba - the model is a parametric truss with variable dimensions, and member selection. The optimisation objectives are the mass of the structure, the deflection and the buckling modes.

The intention is that the analysis will consider only valid solutions - that is, solutions with buckling modes over some number (say 5), then optimise for minimising deflection and weight.

I have taken the inverse of the buckling mode, so that minimising it creates a higher buckling number, but I’m looking for number that are much less than 1. If the number is greater than 1, I want to penalise the algorithm to guide it away from similar invalid solutions.

I tried the same analysis with Galapagos, but I combined the parameters by adding an expression that penalised weight (by adding 999999999kg) if the buckling mode was less than the threshold value (5) or if the deflection was greater than an allowable threshold (say 20mm). This seemed to work OK, but I feel like it’s a bit hackish, and that Wallacei is a more advanced tool, so it should have more advanced ways to handle this problem.

What’s the best way to handle this problem in Wallacei?

One approach is to have Wallacei “skip” the undesired solutions.

A little background to explain this process:

When Wallacei encounters an error solution, which is a solution that has a ‘null’ or ‘empty’ fitness value, Wallacei skips this solution and recreates another one that doesn’t have the error. This was originally implemented to avoid crashes, or avoid error solutions from skewing the algorithms output. However an alternative (sneaky) use of this option is to force Wallacei not to evolve certain solutions that the user does not want, even if these undesired solutions were technically valid.

In your case, if you want Wallacei not to evolve a specific solution, then you can use the ‘stream filter’ component to identify the undesirable solutions and convert one of the fitness values of said solution to a ‘null’, thus forcing Wallacei to skip it and not include it in the optimisation process.

You can learn more about null solutions through the following videos. If still unclear, let me know and I can upload an example definition.

Hi,
Thanks for the response.

I tried your suggestion, but it fails to run. The problem (I believe) is that there are many times more invalid solutions than there are valid solutions. Consider deflection of a truss based on combinations of member sizes and truss depth. The permitted deflection is a range of values between 0 and 20 (say), but the range of invalid values is 20 to infinity (some large number). So the valid solutions are many times fewer.

There are two possible solutions here - one is to restrict the search space by limiting inputs. This takes some skill and perhaps trial and error to avoid limiting good values. The other solution is to provide some guidance to the algorithm that the value is bad, and to penalise it with in a manner tha is proportional to the distance from a valid solution.

With this in mind, I altered your suggestion, but rather than replacing a value with null, I replaced it with x^3 - this provides a continuous range of values so the algorithm can figure out which way to go, and is quickly rewarded with higher performing solutions. My earlier suggestion of providing an +999999 penalty is not continuous, so the change from one trial to the penalty is not enough.

I’ll continue working on this, but initial indications seem positive.

Hello Gerrard,

Null technique as Mohmmad mentioned here should work and it is the most effective way of doing these things even if there are a lot of null solutions. Wallacei learns and as it moves forward it reduces the generation of those solutions, if you share you file I would be happy to take a look at it

Hi,

Thanks again for the response. I tried again this morning while preparing a file for you, and this time it worked. I tried a second time and it failed. I realise now, it seems that you need to start with the model in a valid configuration, otherwise it will fail to start.

Thanks for your help!

1 Like

Yes correct, you need to start the model with a valid solution to inform Wallacei from the beginning what is desirable and what is not

1 Like