How to make rules for Galapagos?

Hello, I have a question because this is the first time I’m using Galapagos.
So let’s say I make a rectangle of 20 x 20 , and make the algorithm so that we can adjust the length and width of it (so initially the slides for length and width are on 20 and 20), where the area would be 400.
Now, let’s say I want to use Galapagos to find the possibilities of length and width, but I want to make two rules so that the area will be larger than 200 and less than 400. How to do such thing? I’m having an idea to use smaller than and larger than, so I use the length of the length and width and use smaller than component with number 400 inputted as the B number, and use larger than component with number 200 inputted, so I will have two ‘True/False’ output, and these two output should be ‘True’, but I don’t know how to tell it to Galapagos…

Hi @haykalavinsa,

Most of the time I’m using Galapagos I’m minimizing my fitness. So if I had a case like yours I would calculate penalties into my fitness function.

F.e. you could check I’d your area is less then 200 or bigger then 400 you could add a high penalty to your overall fitness value. Galapagos will then actively avoid such constellations.

1 Like

Is it inside of the Galapagos setting? to set the penalty?

This doesn’t sound like a fitness problem, This sounds like an iteration problem. Look at Anemone. Especially because you want possibilities, not an optimal result.

Octopus allows you to input Boolean values to decide whether an iteration gets evaluated or not.

No, you must define the “penalty” yourself using logic manipulating the final value on a Num component. The value in that Num component should “aim” at your desired value. The desired value can be withdrawn so as to reduce the "fitness to zero, which is a good value for Galapagos to converge at.

But I would suggest that you aim for one (1) single final value in addition to Lando’s suggestion, (say 300 in the middle between 200 and 400) and a “mild punishment” value for any deviation from 300, a penalty value which could be one magnitude higher, say 1000, and if going less than 200 or over 400 you give it yet one magnitude higher penalty, say 10.000.

All in all, when reaching an area near or right on 300, or if timing out (if you set a time limit), then Galapagos will then (likely) have converged at 300 or at least within the acceptable value range 200-400.

You didn’t say that you had any preference except for between 200 and 400, but I went for 300, and testing the configuration pictured below it converges at 300 (a little clumsy math-wiring there, but spending a little time on it you can probably simplify it):

In this way you manipulate any value in the definition so they end up going in the direction you want:

Fitness with Penalty.gh (21.8 KB)

You also didn’t mention what the POSSIBLE values can be of the inputs. I set it to 1–60, but that was just a guess.

// Rolf

2 Likes