# Genepool duplicates

Hi,
I’m running a genepool for an evolutionary solver and I need to ensure that the sliders never output the same value.
For example I have 10 sliders (genes), that can each have a value between 0 and 99. the solver will select a value at random, but it should never pick the same number twice in the set. Then screen shot below shows that gene 3 and 9 both having a value of 63, which I want to stop happening for my scenario.
Any suggestions around the logic for this would great.

cheers
pete

Sure there a faster/more stable methods to do so. Meanwhile this should work:

File:
20210521_randomVals.gh (7.6 KB)

as far as I know, Galapagos works with slider “positions”, which means when it’s trying combinations it doesn’t really care about the numeric value of a slider, it only cares of the slider position

for instance: each slider with range 0-to-99 would have 100 possible positions, and for the Galapagos algorithm to work properly it’s fundamental that a given slider always referes to the very same domain for the whole duration of the Galapagos run (meaning the domains of each slider should not change while Galapagos is calculating)
this should automatically discard all the possible “tricks” for which if two genes are the same, you might add +x to one of them in order to make them different at Galapagos’ eyes
if at a certain moment during the solution you have slider#3 and slider#9 both at position 64 (value=63) you shouldn’t make Galapagos believe one of them has “temporary” value 62 or 64: they both should output value=63 to avoid the Galapagos understanding of your model to diverge from the actual model you want to simulate

I won’t also play with the fitness value by nullifying it if two genes have the same value, because that will not help Galapagos “understand” the model: being an evolutionary solver, it will just interpret as if those particular slider position result in a bad fitness value, and continue with new generations taking that particular info into account → it will never understand fitness was bad because two slider were the same, it will just know that combination gives a bad fitness, and make a new generation to continue the calculation

the problem is that two (or more sliders) being on the same position is not something you can program to avoid, and it’s like a “random effect” that sometimes happens during the computation: as if for each generation you were flipping a coin and each time you get heads you set fitness to zero

anyway… all this is just “as far as I know” so… let’s wait for the opinion of much smarter heads

Hi Baris,
That works well, but is a little unstable. I got it to do some crashing when running it in larger solver problems. It is very effective though.

Also, I’m using Wallacei as the MoE and I don’t think that it shuffles through the evolutions properly with this method. My understanding is that wallacie needs to be able learn from one evolution to the next, meaning that if it discovers a few genes that produce particularly good outcomes it will favour these in the next evolution. I think that it needs to have the genes as separate sliders so it can control each one independently. Your suggested solution takes the gene (seed) slider and runs the output though a script, and I’m pretty sure that I can’t use the script output as a gene.

I’m happy to be correct on this.
EIther way, your solution definitely got me thinking about how wallacei approaches the problem.

thanks

Hi Inno,
Thanks for your discussion. I agree completely that introducing nulls into the solver is very problematic.

I’m using wallacei as a MoE as part of a larger project, so I think that this means that I need to deal with the duplicates at the gene slider level, meaning that the ‘seed’ of any random generation has to remain the same in each simulation/evolution.

I have discovered in the last few days that by using an MoE I can entre the gene duplication test as a gene itself. The screen grab below outlines the logic that I think works without stuffing up the solver. It uses sets to find duplicates in the gene, and returns a ‘0’ if there are none or a ‘1’ if there is. As Wallacei tries to reduce all values to 0, it allows me to be able to filter the outputs by selecting all of the simulations that have 0 value for that particular fitness goal.

Happy to be corrected if the logic isn’t correct.

1 Like

ohh, I thought you were using Galapagos, this is super interersting and a great learning opportunity!
I think the logic is perfect, and if you don’t mind, once you get some results, please briefly share your thoughts, if that strategy worked well and the outcome is as expected, I’m very curious thanks!