# algorithms – Finding optimal path for a reproduction problem

Given a finite set of lists with elements ($$e_1, e_2,…, e_7$$) and $$e_i = True, False$$.
It is possible to create a new list by taking two lists and apply the $$land$$ operator on both lists ($$e_i$$ in the new list is $$True$$ only if $$e_i$$ are $$True$$ in both parent lists)

The aim is to find a way to obtain the list with all elements equal to $$True$$.

An additional condition is that lists can reproduce only a limited of time, which is equal to $$R = 8 – N_{True}$$ for initial lists and is equal to $$R = min(R_1, R_2) – 1$$ for new list created with parents 1 and 2.

It is also possible to create new lists by applying other operations that work the same way, but ensure that one specific $$True$$ is passed no matter what.

This problem is equivalent to a breeding problem where parents only give a DNA strain to the child if they both have it but can hold a special item to pass one or two DNA strains no matter what. This picture might help you to understand the problem quickly: https://i.redd.it/haxk71icdod41.png

Depending on the initial set of lists, there might be multiple ways to obtain the result. I am looking to get the cheapest one (by that I mean the one with the minimum of reproduction needed), but also to get the one where the wanted list has the maximum $$R$$ possible.

I’ve never coded something like that, so far I tried to use the only algorithm I have experience with: basin hopping. It is not working so well, it is either giving always the same good answer or not finding the final list at all.

Is there a specific kind of algorithms for this kind of problem?