Pymate: Evolutionary Simulations

During grad school, I learned Python and wrote a custom library, pymate, to test hypotheses about primate mating strategies using agent-based modeling and evolutionary simulations. Pymate utilizes object-oriented programming to allow the user to create a primate society, complete with social groups that contain male and female individuals.

Real primate societies are extremely diverse in their social structures, mating systems, and much more, and pymate mirrors this diversity by including a number of user-defined parameters and stochastic components. For example, the steepness of the male dominance hierarchy is a measure of how decisively a male of a particular social rank can exert dominance over males of lower ranks. Pymate's rank-competitiveness-correlation parameter gives the user control over a similar group-level trait, the relationship between social rank and competitive ability, but no two model runs will produce identical hierarchies, even when rank-competitiveness-correlation remains the same (Figure 1).

Figure 1. Plots of relationship between rank and competitive ability during 2 model runs. All parameters are identical between runs (e.g. rank-competitiveness-correlation = 0.5). Stochastic processes are responsible for differences.
Image Image

In Figure 1, each male is represented by a single point, with higher ranking males farther left, and males with higher compeitive ability closer to the top. Functionally, social rank determines access to female mates, so high rank allows males to monoplize a higher share of reproduction. But the lower the correlation between the two traits, the more likely that some males will be ranked higher than their less compeititve peers. This mirros real variation in the social styles of primate societies: In some species, age or group tenure exert a strong influence of social rank, reducing the impact of competitive ability. In others, however, social rank is essentially determined by competitive ability, because males fight, or at least show off their aggressiveness, to move up the dominance hierarchy.

Figure 2. The Pymate GUI, built using Flask.

I built a Flask app1 so that users could try out Pymate without knowing anything about python. In the back end, the app's python code relies heavily on the library to build and simulate primate societies. Communication between the backend, and the HTML and jacvascript frontend, allow users to fine-tune their model parameters in a user-friendly graphical user interface (GUI).

This post is a work in progress!


Written on July 31, 2023