I'm currently working on a neuro-evolution genetic algorithm where I create small organisms with simple neural networks which can move around a 2d space with randomly distributed food. I spawn a bunch of those organisms with a random initialized "brain". Some of those organisms will be by coincidence drawn to food more than others which will lead them to survive longer and be able to reproduce. The children will inherit the same brain-values as the parents which slight modifications/mutations. Of those children again some will be drawn to food more than others, will survive longer and reproduce. With the generations the organisms will evolve and will understand tha they have to go towards food in order to live longer. This is all working fine.

But it needs two organisms to reproduce. Until now, if two organisms randomly walk into each other and have enough energy they create a child with a combination and variation of the parents brain. But I want the organisms to learn over generations by themselves that they have to reproduce and therefore to be drawn to each other. But unlike learning to eat to survive longer, I just can't find a evolutionary motivation for them to reproduce. All the "explanations" why we reproduce in the internet don't really answer that question. I only noticed that since I'm trying to simulate natural selection myself.

The first idea is to give the organisms a dompamine-value which they need to maximize. Reproducing/Sex will "feel good" by increasing that value. But why should they want to maximize that value?

Another idea, is that they will only want to reproduce if a add predators to the simulation. Because if there are predators which eat other organisms those organisms will probably want to have more of their kind around them so the chance of getting eaten will decrease. They could also learn to move in swarms to protect themselves like some animals do in real life. But this would mean that there only is an evolutionary motivation for reproduction if there are other species/predators. Can this be true in real life?

So I want to know what the motivation for a species to reproduce is in order that the organisms in my simulation will learn over generations that they should reproduce.

If you are interested in the topic of genetic algorithms and simulations of natural selection, here are some references:
[article](https://towardsdatascience.com/introduction-to-genetic-algorithms-including-example-code-e396e98d8bf3),
[youtube channel 1](https://www.youtube.com/channel/UCjJEUMnBFHOP2zpBc7vCnsA),
[youtube channel 2](https://www.youtube.com/watch?v=0ZGbIKd0XrM&t=495s)