I am working on the creation of a cluster that optimizes the exterior comfort of urban spaces with ladybug and galapagos.
I divided the genepool into a domain of 5 options (0-4) and thats what is connected to galapagos in order to be shuffled again and again until the average temperature is optimized.
This 5 options correspond to different geometries that are placed on a grid, 0=shading element; 1=trees; 2=water…
My question is if there is a way to constrain the gene pool to only have a maximum amount of each geometry.
For example. I only want to have 20 geometries as max for shading element, is there a way that never places more than 20?
You mean you want the COUNT input of the GENEPOOL CONTROLLER to be limited to 20?
I would do it like this
No I mean I want to have for example in the list of 133 sliders of the gene pool, that from that 133 slider only 20 can be with the value 1, so it doesnt overpopulate that geometry.
So for example, the number 1 are shading elements and therefore are the best to get a good value for the average temperature, so when I apply galapagos the 133 sliders would be value=1, but that is absurd, because is not economically viable.
I dont know if you undertand what I want to say
Ok now I understand
You want your solver to discard the solutions where more than a certain numer of genes have athe same certain value (20 genes at value 1 in your case).
You need to translate this information to something that modify your solution in a way that it goes discarded.
I’d do it like this. Let’s say you are minimizing. you can analize the gene pool ( equality to the value 1 ) and measure how many true you get. If it’s less or equal to 20 return 1, otherwise return something bigger (2/10/50/your choice - something high enough).
Raise the value you are minimizing to this number (so it is 1 for the correct scenarios, higher for the incorrect ones) so the incorrect pools get you a solution that goes away.
With this approach you can combine as many conditions as you want
I suggest using the annealing solver with these kind of problems
I’m not a Galapagos expert AT ALL but, as far as I know, introducing something like that in Galapagos would sort of flaw the results: Galapagos won’t “learn” why certain solutions are bad, it will just blindly avoid them if they lead to bad fitness
what I mean is, Galapagos is not aware that you want max 20 sliders set to one, it will just understand that -periodically, sort of randomly from his point of view- while it tries to explore a solution that might be better or worse than the previous, it will just get a very bad overinflated fitness, and continue its exploration
it won’t be able to discern that the reason for that bad fitness was “because there were 21x ones and he just wanted 20”, it will just consider that whole current states as something that was not that good, and continue exploring based on that data (much like training a dog to sit, but instead of saying “sit” and rewarding it when it does, you just punish it whenever it does anything else)
Exactly, this is why it is better to use the annealing solver instead of the evolutionary solver.
with the evolutionary solver you might get stuck on a local minimum, instead with the annealing solver you explore better all the space
It still might be slow to get to a proper solution, depending on the complexity of the problem / dimension (number of genes), but this is the general approach when you have a solution space with lots of irregularities and local minimums.
(once you get to a good solution you can eventually refine it with the evolutionary solver - this is not the case since your genes have discrete values)
It doesn’t discern reasons, it just read the fitness value. You are just modifying the fitness function to drive you solution away from certain inputs (like it does your original function, you are just adding conditions)
Thanks for your answer, I already thought of that and applied it, but as you say it is a really slow process and all those solutions which go over 20times value=1 and therefore are not optimal, makes the process way longer than if there was a way of making galapagos not even have to go through them
Also, I’ve been searching for the difference between the evolutionary solver and the annealing solver, and I do not really understand the differences.
I’ve always used the evolutionary one.
the process will be slow no matter what you do, you don’t get away from that (you have 100+ sliders) and you still have to run through bad solutions ( (1)because of a bad fitness value or (2)because of a bad combination of genes that you translate in a bad fitness value) in the first iterations, but if the fitness function is set properly you will go away from them: there is no difference at the end between 1 and 2, they will be eventually discarded.
I don’t have right now any idea to ignore the (1) since the start but I think it’s smaller than (2) so I don’t think this is the big problem, you have just a very high number of genes so you just have to wait, and since the dimension is very high you need to consider the annealing solver