Genes & Mating Systems Simulator
Attractive Aristocrats

Topics: Allele frequency, mating systems, Fit Bastard Theory, male-male competition, maximum genetic diversity.

Genetic Invasion Theory

This article, its sequel (The Science of Admixture), and its future sequels, collectively form a body of work referred to as Genetic Invasion Theory or GI Theory; it is the foundational theory of genopolemology – the study of gene war. For more information, please visit the Research Institute of Genopolemology.

Notice: The statements herein are to be interpreted as purely descriptive claims, rather than prescriptive ones. The research makes no ethical or practical arguments in favor or against admixture, any particular mating system, or the superiority / inferiority of any genetic cluster. Genopolemelogy is solely concerned with understanding the nature, causes, and consequences, of genetic warfare – a biological phenomenon that is real and occurs to varying degrees of intensity 100% of the time. Genopolemology is not a moral or political ideology. Instead, ideologies would be wise to base their arguments (in favor of or against) any genopolemological position on truthful information.

It should also be noted that the terms “elite” and “commoner” are not used in a pejorative sense and are not to be interpreted as an indication of moral judgements or as insults against any particular group. Exceptional people – elites – are born good-looking, intelligent, healthy, wealthy, and capable of statecraft, innovation, and institution-building. Typical common people – commoners – are not born that way and this fact has no bearing whatsoever on their moral standing in society; as the research demonstrates, it does have implications for evolutionary outcomes, due to hypergamous female sexual selection – the female sexual preference of elite men.

Women choose which men get to pass on their genes and which men get weeded out of the gene pool. This is an inalienable right of all women and commoner men will simply have to accept and respect women as they are.

The following is a computer model for simulating genetic changes over multiple generations, given a certain mating system. It is built over an MIT-licensed JavaScript framework to allow other researchers to freely copy, edit, & use. The framework is embedded below the data interpretation, along with an MIT-licensed example of its use immediately after. In turn, an overview of the algorithm is appended. For those who wish to host this simulator on their own websites, the example is the same code that powers this very simulator and may be copy / pasted to the desired webpage. The simulator also includes a download link.

Credible researchers only: feel free to dm me for any questions, assistance, bug reports, or improvement suggestions. “Apollonian Regime” or “@ApolloRegime” are both suitable for citations. What follows is an exercise in Apollonian speculation; thus, researchers are encouraged to subject this work to empirical data.

Lexical clarification: GQS is Genetic Quality Score. The researcher will note that the unit is omitted. This is because the model is not concerned with how the score is obtained, so long as it is a composite measure of allele frequency and that the “basket of genes” is sufficiently inclusive so as to correlate with genetic distance. This condition necessitates that the loci selected are roughly equidistance with a genome-wide spread. This ensures that we take into account the correlation structure of the data; see my paper on A Genealogy of Fallacies: Leowntin’s Eristic. The actual measure, unit, and methods of obtaining the GQS is at the discretion of the researcher – it may change the absolute values of the data generated but it will not change the inter-generational trends observed (which is what we care about).

On defining the elite:

genopolemology uses the genocentric definition of the elite which is simply that of a genetic cluster. Culture and religion is understood as a collection of memes made by brains made by genes. Thus, the genetic cluster of an elite is easily defined by the genes which develop the worldview of a particular hierarchy.

Under genocentrism, one does not become elite. Instead, the elite is born. Just because an elite cannot evidence eliteness with socioeconomic conditions does not make the elite a commoner.

Genocentrism Is The Future

Note: the settings below are the parameters by which we define the state of a founding population. The data will be inserted in-between the “Generate Data” button and the data interpretation.

Warning: the amount of computer resources needed to generate data increases exponentially with population size, which is why there is a limit of 9 generations; the limit can be overridden by right-clicking on the generation input, clicking “inspect”, and editing or removing the “max” attribute in the element that appears. Going above that limit or simply setting a high initial population can cause the browser to freeze or crash.

Change Log
  • V3 (2024?): adding age of parents’ 1st neonate, adding primogeniture, & adding data tabulation
  • V2 (2023): fixed mutation rate calculation, added maximum genetic diversity, fixed monogamous pairing order, & added adultery parameter
  • V1 (2022): Core features

Release Date: 2023-04-04

Version 2 – Explained

The most important upgrade from V1 is the addition of the adultery parameter as a default setting. As will be discussed in the data interpretation, adultery has a significant effect on allele frequency and its effect size is inversely related to population size. Clear evidence is found for the evolutionary origin of systemic adultery which contradicts prevailing theory.

Furthermore, V2 corrects an error in monogamous mode. The pairing algorithm reflects real-world mating patterns by first discounting the excess members of whichever gender has a surplus then matching each member assortatively by GQS. The theoretical algorithm removes the excess members from the bottom, i.e. with the lowest GQS (e.g. incels). The way the algorithm was implemented in V1, it was erroneously removing excess members from the top rather than from the bottom. Consequently, V1’s monogamy datasets were skewed in 2 ways:

  1. They exaggerated the decline in the elite’s average GQS, albeit the decline takes place nevertheless in V2.
  2. They mimicked mating patterns where adultery takes place (where the lowest GQS people still pass on their genes); insofar as default settings are concerned, V2’s monogamy datasets present no statistical difference among commoners. However, we do see that once adultery is disabled (which was the assumption in V1), the datasets in V2 demonstrate an increase in the commoners’ average GQS of ~8.6 times greater than the what was observed in V1.

All in all, the general trend remains: strict monogamy results in a convergence towards the middle. When adultery is disabled, the overall bottom-heaviness of the population is reduced and, as such, the elites and commoners converge at a higher GQS than they otherwise would. More information on adultery can be found below.

Lastly, V2 corrects how mutation rates were applied to offspring in V1. Firstly, V1 was parsing the mutation rate value as an integer, which had the effect of rounding down all decimals. As such, any mutation rate less than 1 (e.g. 0.9) was parsed as a 0. In V2, the mutation rate is parsed as a floating-point value (i.e. accounts for decimals). Secondly, V1 introduces pseudo-randomness to its mutation rate; at random, it can be either additive or subtractive to the GQS. This does not reflect real-world mutational patterns. V2 corrects this error by applying mutational load according to the Germ Cell Mutation equation (GCME):

Germ Cell Mutation Equation

GQSf = GQSi – GQSi M n = GQSi ( 1 – M n ) where n = i – 1

  • GQSi : initial GQS, the mean of the parents’ GQS
  • GQSf : final (actual) GQS, once mutation is applied
  • M: mutation rate
  • i: index of offspring, equivalent to position minus 1 (i.e. 1st child has an index of 0, and therefore, n = -1)

GCME Explained: As discussed in the Altruistic Matricide Hypothesis, the mutational load of germ cells increases with age. GCME assumes that the 1st neonate is born while the parents are sufficiently young enough such that their germ cells retain a sufficiently high epigenetic complexity so as to prevent the genesis of any viable gametes with dilutive mutations to the GQS (see professor Huang’s paper on Maximum Genetic Diversity). By process of elimination, the mutations that do occur in the first neonate are more likely to be additive to the GQS. The 2nd neonate necessarily is born later and, therefore, is higher in mutational load. The GCME gives a net 0 contribution for the 2nd neonate. The 3rd neonate’s mutational load is subtractive to the GQS, the 4th is doubly subtractive, the 5th is triply subtractive, and so on and so forth. Of course, this is a simplistic application of mutation rates which does not perfectly correspond to actual fixation rates, in the real world. However, our concern is to examine changes in allele frequency and, to that end, the GCME is a simple and convenient way of roughly mimicking the increase in mutational load from one offspring to the next.

V3 (which will maybe be published in 2024) will allow for the tweaking of the parents’ age of 1st birth, so as to account for the fact that parents can have babies later in life. This parameter will allow us to observe the effect of parental age on intergenerational changes in allele frequency within a genetic cluster.

Caution for researchers: It is imperative to bear in mind that the effect size of mutation is inversely related to the GQS score. If you are using this model to study mutation or something which relies on mutation, it is important to normalize real GQS scores such that the mutation rate used resembles real-world fixation patterns. I recommend using goodness-of-fit tests to establish reliable GQS scores.

Interpreting the Data

Firstly, it should be noted that the model has been thoroughly tested with various settings and it has reliably produced similar values per dataset (given the same settings) – similar but not identical, due to the mutation rate and the pseudo-randomness of gender determination. Whereas the values differ by dataset, the trends observed are identical from one dataset to another (when generated with the same settings).

Monogamy

Important

What follows is a discussion of strict monogamy, as opposed to serial monogamy; i.e. what would happen if humans were strictly monogamous?

Contrary to popular belief, pre-historic polygynous humans did not become strictly monogamous. As mentioned in the Altruistic Matricide Hypothesis:

Before the advent of modern medicine, marital vows were made with the very reasonable assumption that death shall indeed “do us part” […] some men would have more than one wife throughout their lifetimes, albeit not at the same time.

In other words, strict monogamy is impossible in the face of maternal mortality. What really happened in the past is that humans transitioned from synchronous polygyny to asynchronous polygyny which we refer to as serial monogamy.

Mathematically, the numbers (for gene cluster admixture) play out in almost the same way between polygyny and serial monogamy. As such, the subsequent section on polygyny is the one that is most informative for mating patterns in pre-industrial conditions, particularly before 1930.

The advent of modern medicine (i.e. OBGYNs) has reduced maternal mortality rates to negligible levels, in the West. As a result, we have become relatively more strictly monogamous. As such, this monogamy section is most informative for post-1930 mating patterns.

In monogamous mode (with default settings), we can observe a slow and steady decrease in the genetic quality of the elites (~%2 change over 9 generations) and a slow and steady increase (~35% over 9 generations) in the genetic quality of the commoners, consistent with the weak hypergamy of a monogamous system. There is, therefore, a convergence towards the middle consistent with egalitarian systems in other domains, such as in economics. While the genetic quality converges towards the middle, monogamous mating systems largely exacerbate the genetic distance between the initial elites and the commoners, thereby inhibiting ethnocentrism. While the initial stock of commoners are not bred out, the least fit male commoners are; the very minor upward shift in genetic quality correlates with the genetic drift of the commoner class under hypergamous selective pressures. Furthermore, the minor downward shift in the genetic quality of the elites is consistent with the hypergamous breeding patterns of commoner women.

Arguably, this model might be demonstrating the mechanism that leads to the creation of a genetic middle class. This is not only because of the convergence towards the middle, but also because the founding stock remains mostly intact. Among the elites of this simulated society, there remains a subset of pure-blooded individuals – unmixed descendants of the initial elites – who preserve and even increase their genetic quality, despite the general decrease of the elite group as a whole. This is consistent with Ed Dutton’s observation that, in the West, there remains a stock of individuals who are sufficiently low in mutational load to survive Darwinian conditions. In both the simulated reality and Dutton’s example, this elite nucleus is dwarfed by the rise in low-quality genes.

This elite nucleus eventually finds itself in a position where its genetic distance is continuously diverging from the middle and lower classes. Since genetic distance is a strong predictor of social distrust, disorder, and conflict, the growing genetic distance of the founding nucleus and the future generations would predict low ethnocentrism. Since the hostility is anti-elitist in nature, we can credibly say that populism is, therefore, a manifestation of low ethnocentrism caused by the rise of low-GQS individuals.

The genetic evidence contradicts the notion that monogamy increases social trust. While there is undoubtedly an immediate short-term ethnocentric benefit to monogamy (due to the reduction of male competition), the inter-generational increase in societal bottom-heaviness leads to a genetic divergence which lessens inward cooperation.

We can further compare the model to the current Western world by creating circumstances which mimick real-world birth rates in the West. To do this, we must adjust to parameters in such a way as to make commoner women birth more than 2 babies per couples and elite women birth 1 (which roughly correspond to current patterns). For this experiment, let’s set maximum babies per woman equal to 3, the elite budget equal to 100000, and the commoner budget equal to 150000. With these settings (over 9 generations), the elite GQS declines by ~80% and the commoner GQS declines by ~2%. Interestingly, when adultery is disabled, the elite GQS declines by only ~40% whereas the commoner GQS has no significant change.

Note: Near-total population replacement of commoners via downward mobility is still possible if elite couples consistently outproduce common couples 4:1. If commoner women average 2 babies, elite women would be required to produce 8 babies (who actually make it to breeding age) – a big ask. Even then, the elite GQS declines by ~1.5%.

Polygyny

In polygynous mode (with default settings), we can observe a slow and steady increase in the genetic quality of the elites (< 1% change over 9 generations) and a MAJOR increase (99.99% over 9 generations) in the genetic quality of the commoners, consistent with the strong hypergamy of a polygynous system. In each attempt, the elites maintained their genetic supremacy, albeit by a smaller margin per generation. There is, via the intermixing of elite men and commoner women, a new hybrid population being created in each generation with the % of commoner genes being diluted by ~50% every time a new hybrid class is created. The repetitive dilution of commoner genes go hand-in-hand by the genes diluting them, namely elite genes. As the frequency of elite genes increases in the commoner class, a decrease in the genetic distance between commoners and elites will necessarily be observed, thereby leading to an increase in ethnocentrism. Ultimately, polygyny is a humane form of population replacement of commoners with the offspring of the elites, or in other words, downward mobility.

With the addition of the adultery parameter, we can reach an interesting conclusion. With a large population size, adultery has no statistical significance with respect to allele frequency. As such, the significance of adultery has increased post-1930.

It should be noted that opponents of this theory point to the average IQ of the Muslim population as a demonstration of polygyny’s effects. However, this is entirely baseless as Islam encourages consanguineous marriages; to blame an in-bred population’s average IQ of 83 on polygyny rather than in-breeding depression is an absurd and unserious proposition. Moreover, Islamic educational practices have been shown to severely affect intelligence by converging natural variations in intelligence; children born with a genetic upper limit at an IQ level below 83 see an increase of IQ to that level and those born with an upper limit above 83 see a decrease of IQ to that level as well.

Polyandry

In polyandrous mode (with default settings), we can observe a cataclysmic collapse in genetic quality of ~60% in a single generation, regardless of class and gender. Feminists are encouraged to attempt a successful polyandrous society with the simulator. The results will demonstrate why there are no polyandrous cultures in existence.

 Pre-Islamic Arabia

It is known that polyandry was an acceptable form of relationship among pre-Islamic Arabs. It has been suggested that the female incentive for such an arrangement lies in the ability to exploit fatherhood uncertainty to extract resources. More simply, women are better able to secure resources for their children in a polyandrous group consisting of men from the same tribe or who are consanguineously related (e.g. cousins), given that all of the men involved can be certain that the offspring is, at least, closely related to them.

If a sufficient number of women have the power to demand such an arrangement in the sexual market, some men will simply have to take what they can get, as it offers them some chance of passing on their genes directly and a definite chance of passing on their genes indirectly via kin selection.

This is consistent with the prevailing theory pertaining to the emergence of cousin marriages as an evolutionary adaptation to cuckoldry and low positive ethnocentrism. Similarly, the emergence of Islam (i.e. extreme mate-guarding) is very plausibly explained as an adaptation to female promiscuity.

In a genetic cluster where women are promiscuous, the most extreme mate-guarders are the most likely to directly pass on their genes and get the most evolutionary reward for their parental investment. In turn, the genes which create brains which are prone to extreme mate-guarding are the ones which comprise and replace future populations. Once a critical number of these extreme mate-guarders is reached, they will have the ability to influence the dominant culture according to their preferences. This is the evolutionary mechanism behind the emergence of Islam, in Arabia.

Fit Bastard Theory

The model assumes that adultery is more common, the lower the GQS. This is because culture, including attitudes regarding fidelity, is a product of the highest GQS members of the original elite (in generation 0), and the highest GQS elites in subsequent generations are genetically closest to the founding stock and this implies a greater adherence to that culture, especially since that culture legitimizes their authority. If the most elite were to violate the cultural rules, it would undermine the culture that legitimizes their authority and, in turn, reduce their ability to advance their genetic interests. As genetic distance increases, i.e. as we travel down the hierarchy, so does the relative propensity for anti-sociality, such as adultery.

Having introduced the adultery parameter, I wanted to examine its effect size. I quickly observed that it is inversely related to population size. In other words, the effect of adultery on allele frequency is greater the smaller the population size. To analyze what that effect is, I recreated pre-historic conditions and generated the datasets, in monogamous and polygynous mode. In both modes, the parameters are as follows: max children per woman equals 2 (the pre-historic average was just above 2), initial elite population equals 10, initial commoner population equals 40, and adultery is disabled.

In both mating systems, the later generations’ elites demonstrate between 1.5 to 2 times the initial elite GQS (and this effect is only slightly stronger in polygyny). One might be fooled into thinking this is a good thing. In a large population where in-breeding is improbable, a rise in GQS comes about as a result of selection in favor of the eldest children, i.e. the fixation of mutations which are additive to the GQS. This is why GQS rises slowly in large populations: the mutation rate is too small to significantly affect GQS from one generation to the next. The effect is most noticeable across many generations.

But in a small population where in-breeding is highly probable, a rise in GQS is amplified by homozygosity. In other words, these 2 datasets demonstrate in-breeding. This begs an interesting question: how could prehistoric clans survive in the face of in-breeding depression?

I then ran the same experiment and only this time, I enabled adultery. Due to the small sample size, the data has a very high variance. 3 out of 10 times, the results resemble the first experiment. However, roughly 7 times out of 10, the results are as follows and they are intriguing. In monogamy, there is no significant difference in the commoner GQS and a roughly 50% reduction in the elite GQS. In polygyny, there is a roughly 101% increase in the commoner GQS and a roughly 100% increase the elite GQS.

In both mating systems, we see that adultery buffers against homozygosity by reducing the likelihood of consanguinity and this effect is much stronger in monogamy. In other words, prehistoric humans produced fitter offspring due to hybrid vigor, i.e. fit bastards, the more adulterous they were; hence, I call this the Fit Bastard Theory (FBT). However, the prevailing theory suggests that the male propensity for adultery is merely due to males passing on more of their genes than they otherwise would and that the female propensity for adultery is due to females producing fitter offspring (women cheat upward in mate value).

The prevailing theory cannot explain why men remain so adulterous in large populations. Since the effect size of adultery is negligible in large populations, we would expect this behavior to have withered away over time (as population and genetic diversity increased). However, FBT explains this perfectly. Almost the entirety of human evolutionary history was spent in small nomadic clans, under extreme selective pressures in favor of adultery – an adaptation against in-breeding. The advent of farming to the present day represents a very small fraction of human existence. Since most adultery remains secret, the historical execution of adulterers would have only selected in favor of discretion and secrecy, rather than actually selecting against adultery itself. As such, the genes for adultery have largely remained in existence.

To conclude, FBT explains adultery where the prevailing theory fails.

The Framework

Download: Mating Systems Computer Model Framework V2

/*
Mating Systems Computer Model Framework V2
Apollonian Regime (c) 2023
https://apollonianregime.com/wp-content/mating-systems-V2.js
License: MIT
*/
function MS(func)
{
    // mode, gens, mutationRate, children, eliteGQS, commonerGQS, eliteMaleBudget, commonerMaleBudget, costPerChild, adultery <= names of .ms-var
    Array.from( document.getElementsByClassName('ms-var') ).forEach((e)=>{
        MS[e.name] = parseFloat(e.value || e.dataset.default);
    });
    MS.adultery = document.getElementById('adultery').checked;
    MS.idx = 0;
    MS.data = [ Generation.first() ];
    for( let i = 0; i < MS.gens; i++ )
    {
        func(MS.simulate);
    }
}
MS.simulate = function()
{
    var gen = Generation.populate();
    MS.data.push(gen);
    MS.idx++;
    return gen.statistics();
};
function Human(isMale, geneticQuality)
{
    this.isMale = isMale;
    this.geneticQuality = geneticQuality;
}
function Woman(geneticQuality)
{
    Human.call(this, false, geneticQuality);
}
function Man(geneticQuality)
{
    Human.call(this, true, geneticQuality);
}
Man.prototype.randBool = function()
{
    return Math.random() < 0.5;
};
Man.prototype.impregnate= function(woman, rate)
{
	rate = rate || MS.mutationRate;
    var score = woman.geneticQuality + this.geneticQuality;
    var avg = score / 2;
    var difference = avg * rate;
    var geneticQuality = avg - difference;
    if( this.randBool() )
    {
        return new Man(geneticQuality);
    }
    return new Woman(geneticQuality);
};
Man.prototype.breed = function(woman, maxChildren)
{
    var children = [];
	var max = Math.min(MS.children, maxChildren);
    for (var i = 0; i < max; i++)
    {
        var child = this.impregnate(woman, (i - 1) * MS.mutationRate);
        children.push(child);
    }
    return children;
};
function Generation()
{
    this.men = [];
    this.women = [];
    this.pos = MS.idx + 1;
}
Generation.prototype.statistics = function()
{
    var commonerMen = parseInt(this.men.length * 0.8);
    var commonerWomen = parseInt(this.women.length * 0.8);
    var eliteMen = parseInt(this.men.length * 0.2);
    var eliteWomen = parseInt(this.women.length * 0.2);
    
    var commonerMaleScore = 0;
    for(let i = 0; i < commonerMen; i++)
    {
        commonerMaleScore += this.men[i].geneticQuality;
    }
    var commonerMaleAvg = commonerMaleScore / commonerMen;
    
    var eliteMaleScore = 0;
    for(let i = commonerMen; i < this.men.length; i++)
    {
        eliteMaleScore += this.men[i].geneticQuality;
    }
    var eliteMaleAvg = eliteMaleScore / eliteMen;
    
    var commonerFemaleScore = 0;
    for(let i = 0; i < commonerWomen; i++)
    {
        commonerFemaleScore += this.women[i].geneticQuality;
    }
    var commonerFemaleAvg = commonerFemaleScore / commonerWomen;
    
    var eliteFemaleScore = 0;
    for(let i = commonerWomen; i < this.women.length; i++)
    {
        eliteFemaleScore += this.women[i].geneticQuality;
    }
    var eliteFemaleAvg = eliteFemaleScore / eliteWomen;
    var self = this;
    return {
        "Generation": self.pos,
        "Pop. Size of Generation": self.men.length + self.women.length,
        "Number of Men": self.men.length,
        "Number of Women": self.women.length,
        "Elite Male Average GQS": eliteMaleAvg,
        "Elite Female Average QGS": eliteFemaleAvg,
        "Commoner Male Average GQS": commonerMaleAvg,
        "Commoner Female Average GQS": commonerFemaleAvg
    };
};
Generation.prototype.ascending = function(a, b)
{
    return a.geneticQuality - b.geneticQuality;
}
Generation.prototype.sortMen = function()
{
    this.men.sort(this.ascending);
};
Generation.prototype.sortWomen = function()
{
    this.women.sort(this.ascending);
};
Generation.prototype.sortAll = function()
{
    this.sortMen();this.sortWomen();
};
Generation.prototype.shuffle = function(people){
    people.sort(() => Math.random() - 0.5);
};
Generation.prototype.randomize = function(){
    this.shuffle(this.men);
    this.shuffle(this.women);
};
Generation.first = function()
{
    var self = new this();
    for( let i = 0; i < MS.commoners / 2; i++ )
    {
        self.men.push( new Man( MS.commonerGQS ) );
        self.women.push(  new Woman( MS.commonerGQS ) );
    }
    for( let i = 0; i < MS.elites / 2; i++ )
    {
        self.men.push( new Man( MS.eliteGQS ) );
        self.women.push( new Woman( MS.eliteGQS ) );
    }
    return self;
};
Generation.prototype.pair = function(men, women, length)
{
    var eliteThreshold = parseInt(MS.data[MS.idx].men.length * 0.2);
	length = length || women.length;
    for( let i = 0; i < length; i++ )
    {
        var woman = women[i];
        var man = men[i];
        var budget;
        if( i > eliteThreshold )
        {
            budget = MS.eliteMaleBudget;
        }
        else
        {
            budget = MS.commonerMaleBudget;
        }
        var maxChildren = parseInt(budget / MS.costPerChild);
        
        man.breed(woman, maxChildren).forEach((child)=>{
			if(child.isMale)
			{
				this.men.push(child);
				return;
			}
			this.women.push(child);
        });
    }
};
Generation.monogamy = function()
{
    var self = new Generation();
    var gen = MS.data[MS.idx];
    var genderGap, femaleSurplus, maleSurplus, men, women;
	femaleSurplus = gen.women.length > gen.men.length;
	maleSurplus = gen.men.length > gen.women.length;
    if( femaleSurplus )
    {
        genderGap = gen.women.length - gen.men.length;
		women = gen.women.slice(genderGap);
		men = gen.men;
    }
    else if( maleSurplus )
    {
        genderGap = gen.men.length - gen.women.length;
        men = gen.men.slice(genderGap);
		women = gen.women;
    }
	else
	{
		men = gen.men;
		women = gen.women;
	}
	self.pair(men, women);
	if( MS.adultery && maleSurplus )
	{
		var incels = gen.men.slice(0, genderGap);
		self.pair( incels, women, incels.length);
	}
	if( MS.adultery && femaleSurplus )
	{
		self.pair( men, gen.women.slice(0, genderGap));
	}
    self.sortAll();
    return self;
};
Generation.prototype.match = function(men, women, length, ratio)
{
    for( var i = 0; i < length; i++ )
    {
        var man = men[i];
        var maxChildren = parseInt(MS.eliteMaleBudget / MS.costPerChild);
        var maxPerWoman = parseInt(maxChildren / ratio);
        
        var harem = [];
        var idx = 0;
        while(idx < ratio)
        {
			var woman = women.shift();
			if( !woman ){return;}
            harem.push( woman );
            idx++;
        }
        harem.forEach((woman)=>{
            man.breed(woman, maxPerWoman).forEach((child)=>{
                if(child.isMale)
                {
                    this.men.push(child);
                    return;
                }
                this.women.push(child);
            });
        });
    }
};
Generation.polygyny = function()
{
    var self = new Generation();
    var gen = MS.data[MS.idx];
    var lenWomen = gen.women.length;
    var lenMen = parseInt(gen.men.length * 0.2 );
    var lenIncels = gen.men.length - lenMen;
    var lenFeminists = lenWomen % lenMen;
    lenWomen -= lenFeminists
    
	var women = gen.women.slice(lenFeminists);
    var men = gen.men.slice(lenIncels);
    var ratio = lenWomen / lenMen;
	self.match(men, women, lenMen, ratio);
	
	if( MS.adultery )
	{
		var lenMutants = lenFeminists % lenMen;
		var feminists = gen.women.slice(lenMutants, lenFeminists);
		ratio = Math.round(feminists.length / lenMen) || 1;
		var length = (lenMutants) ? lenMen : feminists.length;
		self.match(men, feminists, length, ratio);
	}
	
    self.sortAll();
    return self;
};
Generation.polyandry = function()
{
    var self = new Generation();
    var gen = MS.data[MS.idx];
    var children = [];
    var lenWomen = gen.women.length;
    var lenMen = gen.men.length;
    var lenFeminists;
    if(lenMen < lenWomen)
    {
        lenFeminists = lenWomen - lenMen;
        lenWomen -= lenFeminists;
    }
    else
    {
        lenFeminists = 0;
    }
    var lenIncels = lenMen % lenWomen;
    lenMen -= lenIncels;
    var men = gen.men.splice(0, lenMen);
    var women = gen.women.splice(0, lenWomen);
    var ratio = lenMen / lenWomen;
    
    for( let i = 0; i < lenWomen; i++)
    {
        var woman = women[i];
        var harem = [];
        var idx = 0;
        while(idx < ratio)
        {
            harem.push( men.shift() );
            idx++;
        }
        var count = 0;
        while(MS.children > count)
        {
            harem.forEach((man)=>{
                count++;
                if(MS.children < count){return;}
                var child = man.impregnate(woman);
                children.push(child);
                if(child.isMale)
                {
                    self.men.push(child);
                    return;
                }
                self.women.push(child);
                
            });
        }
    }
    self.randomize();
    return self;
};
Generation.populate = function()
{
    return this.systems[MS.mode]();
};
Generation.mode = function()
{
    return this.systemNames[MS.mode];
};
Generation.systems = [Generation.polygyny, Generation.monogamy, Generation.polyandry];
Generation.systemNames = ["Polygyny", "Monogamy", "Polyandry"];
// MS(func);

Example Use of Framework

Dependencies: Mating Systems Computer Model Framework V2 & Bootstrap

<!-- 
| Mating Systems Simulator V2
| Apollonian Regime (c) 2023
| https://apollonianregime.com/genes-mating-systems-simulator
| License: MIT
 -->
<script type="text/javascript">
var css = {
    head: document.getElementsByTagName('head')[0],
    insert: function(file)
    {
        var css = document.createElement("link");
        css.href = "/wp-content/bootstrap-v5.2.0/".concat(file);
        css.rel="stylesheet";
        this.head.appendChild(css);
    },
};
css.insert('min.css');
</script>
<div class="row col-md-8 d-block mx-auto">
    <div class="form-group"><p class="mb-0"><b>Download:</b> <a href="/wp-content/mating-systems-V2.js" download>Mating Systems Computer Model Framework V2</a></p></div>
    <div class="form-group mb-1"><p><b>Release Date:</b> 2023-04-04</p></div>
    <div class="form-group mb-1"><select class="ms-var form-control" name="mode" data-default="1">
        <option value="" selected="" disabled="" hidden="">--- Select mating system (Default: monogamy)</option>
        <option value="0">Polygyny</option>
        <option value="1">Monogamy</option>
        <option value="2">Polyandry</option>
    </select></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="gens" type="number" min="1" max="9" placeholder="Number of generations (Default: 9)" data-default="9"></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="mutationRate" type="number" min="0" max="1" step="0.0001" placeholder="Mutation rate (Default: 0.0025)" data-default="0.0025"></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="children" type="number" min="0" max="12" placeholder="Maximum children per woman (Default: 4)" data-default="4"></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="elites" type="number" min="10" placeholder="Initial elite population (Default: 20)" data-default="20"></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="commoners" type="number" min="0" max="100" placeholder="Initial commoner population (Default: 80)" data-default="80"></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="eliteGQS" type="number" min="0" max="100" placeholder="Avg GQS of elites (Default: 2)" data-default="2"></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="commonerGQS" type="number" min="0" max="100" placeholder="Avg GQS of commoners (Default: 1)" data-default="1"></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="eliteMaleBudget" type="number" min="0" placeholder="Avg budget of elite men (Default: $1000000)" data-default="1000000"></div>
    <div class="form-group mb-1"><input class="ms-var form-control" name="commonerMaleBudget" type="number" min="0" placeholder="Avg budget of commoner men (Default: $100000)" data-default="100000"></div>
    <div class="form-group mb-2"><input class="ms-var form-control" name="costPerChild" type="number" min="10000" max="500000" placeholder="Cost per child (Default: $50000)" data-default="50000"></div>
    <div class="form-check mb-3" style="padding-left:3.5em">
      <input class="form-check-input" type="checkbox" id="adultery" checked>
      <label class="form-check-label" for="adultery">Enable Adultery</label>
    </div>
    <button onclick="control.exe()" class="btn btn-xl btn-warning mb-5 w-75 mx-auto d-block"><b>Generate Data</b></button>
    <div id="ms-box">
    </div>
</div>
<script type="text/javascript" src="/wp-content/bootstrap-v5.2.0/bundle.min.js"></script>
<script type="text/javascript" src="/wp-content/mating-systems-v2.js"></script>
<script type="text/javascript">
var control = {
    view: document.getElementById('ms-box'),
    flow: function(simulate)
    {
        var data = simulate();
        var html = [];
        for( var key in data )
        {
            ['<p class="mb-0 pb-0"><b>', key, ':</b> ', data[key], '</p>'].forEach((str)=>{
                html.push(str);
            });
        }
        html.push('<p>----------</p>');
        control.view.innerHTML += html.join('');
    },
    exe: function()
    {
        this.view.innerHTML = '';
        MS(this.flow);
        this.view.innerHTML += '<p><b>Success:</b> <u>simulation complete</u></p>';
    }
};
</script>

Algorithm

What follows is generated by Chat GPT 4 and edited by me.

The code models three different mating systems: Polygyny, Monogamy, and Polyandry. The main function that initiates the simulation is MS. It is responsible for setting up initial parameters and running the simulation for a specified number of generations.

Key Components

1.MS Function:

  • The MS function initializes various parameters by extracting values from HTML elements with the class ms-var. These parameters include the mating system, number of generations, mutation rate, birth rate, the prevalence of adultery, and various other parameters related to genetic quality scores (GQS) and budgets.
  • It then initializes the first generation and runs the simulation for the specified number of generations.

2. Human, Man, and Woman Classes

  • Human is a basic class that represents a human with attributes like gender and genetic quality.
  • Man and Woman are subclasses of Human. The Man class has methods to impregnate a woman and breed with her, producing children with genetic qualities influenced by both parents.

3. Generation Class

  • Represents a generation of humans. It has methods to calculate statistics about the generation, sort men and women based on their genetic quality, pair men and women to produce offspring, implement different mating systems (Polygyny, Monogamy, Polyandry).
  • The populate method of the Generation class determines which mating system to use based on the mode set in the MS function.

4. Mating Systems

  • Polygyny: Some men (usually the ones with higher genetic quality) mate with multiple women.
  • Monogamy: Each man pairs with one woman.
  • Polyandry: Some women mate with multiple men.

5. Adultery

The model also considers the possibility of adultery. If the MS.adultery parameter is set to true, then extra men or women (depending on the mating system and gender imbalance) might mate outside their primary pairing.

Execution Flow

When the MS(func) function is called with a specific mating system function as its argument, the following steps occur:

  1. Parameters are initialized.
  2. The first generation is created.
  3. The specified mating system function is executed for the number of generations defined in the parameters.
  4. Each generation produces offspring based on the rules of the chosen mating system.

Apollonian Regime Telegram Channel

Click to view.

Conceptual Open-Source License (COSL)

The original ideas and arguments presented herein are published under the COSL license.