NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

Try It in NetLogo Web

Compatible with NetLogo 6.0


Evolution of Sex is a NetLogo model that illustrates the advantages and disadvantages of sexual and asexual reproductive strategies. It seeks to demonstrate the answer to the question:

#### "Why do we have sex?"

After all, wouldn't it be a better strategy to simply clone yourself? There are many advantages to asexual reproduction:

1. Your offspring possess all of your own genetic material.
2. You get to make a copy of 100% of your genes.
2. You don't have to worry about finding a mate.

Conversely, there are many disadvantages to sexual reproduction:

1. You have to share your genetic material with an unrelated individual.
2. You get to make a copy of only 50% of your genes.
3. You have to expend time and energy looking for and obtaining a mate.

From this, it may seem like sexual reproduction is an evolutionary puzzle as it appears too costly to ever be advantageous. However, as this model shows, under certain conditions, a sexual reproductive strategy can win out over an asexual strategy. By introducing parasites to the environment, it creates a selective pressure that makes it more advantageous NOT to simply make a clone of yourself! The reason is simple: if a parasite can infect you, it can also infect all of your clones. However, if your offspring only obtain 50% of their genetic material from you, they are less likely to be susceptible to the same parasite that can infect you. Sexual reproducers are able to mix their genetic material in ways that produce new combinations that parasites have not yet evolved to attack. In short, in the arms race between the hosts and the parasites, sexually reproducing hosts are able to keep up much better than asexually reproducing hosts can.


When the model is initialized, a population of hosts and parasites are created.

There are many options for the reproductive strategy of the initial host population: 100% sexual reproducers, 100% asexual reproducers, or some ratio of the two. They come in different shapes: spade = male, heart = female, club = asexual. They come in different colors: orange or blue. And finally, they come in different sizes: small, medium, large. The combination of these options represents the phenotype of the host.

The phenotype is determined by the host's genotype. There are two alleles for color: orange and blue. Blue is dominant over orange. There are two alleles for size: small and large. These alleles are codominant, which allows for the expression of a medium-sized host if they possess both one small and one large allele.

All together, this creates six phenotypes for host: blue-small, blue-medium, blue-large, orange-small, orange-medium, and orange-large. The parasites, in turn, are assigned one of these six types as their infection strategy. Upon initialization, the parasites are given a random type. However, when they reproduce, which they do asexally, all of their offspring possess the same infection strategy as their parent.

When the simulation runs, host and parasites wander randomly about their environment. Host females that are in close enough proximity to a male host will reproduce sexually at each INTERBIRTH-INTERVAL. Parasites that come into contact with a host that corresponds to their own phenotype will have some probability, according to the PARASITE-INFECTIVITY setting, of infecting that host. Infected hosts then become incubation containers for the parasite's offspring. When a parasite reaches its PARASITE-LIFESPAN, it and its host die and its offspring are released into the environment.


### Host Settings

Write in the CARRYING-CAPACITY input box to determine the maximum number of host individuals for your simulation. This maintains a density dependent mortality rate while the simulation is running.

The SEXUAL-TO-ASEXUAL-RATIO slider determines the initial ratio of sexual and asexual hosts in the population. When hosts mutate, it also determines the likelihood of a different reproductive strategy appearing.

The INTERBIRTH-INTERVAL slider determines how often a female reproduces.

The OFFSPRING-PER-FEMALE slider determines how many offspring each female has when she reproduces. All asexual hosts are females.

The HOST-MUTATION-RATE slider determines the rate at which each host allele mutates. The higher the mutation rate, the more likely that one or more of the parent alleles won't be correctly copied in the offspring alleles. It also determines the rate at which an offspring will assume a different reproductive strategy than its parent.

### Parasite Settings

The OFFSPRING-PER-PARASITE slider determines how many offspring each parasite has when it reproduces. Parasites only reproduce at the end of their lifespan and if they have infected a host.

The PARASITE-MUTATION-RATE slider determines the rate at which each parasite mutates its infection strategy. Again, there are six strategy options: blue-small, blue-medium, blue-large, orange-small, orange-medium, and orange-large.

The PARASITE-INFECTIVITY slider determines how easily a parasite is able to infect a host once it comes into contact with a host whose phenotype matches its own infection strategy.

The PARASITE-LIFESPAN slider determines how long a parasite lives. If a parasite hasn't found a host in that time span, they simply die. However, if they have found a host, they reproduce before they die.

Use the SHOW-PARASITES switch to decide whether you want to display the parasites in the environment or not. With this switch turned off, it may be easier to see the behavior of the host individuals. However, the parasites are still present and infecting the hosts, even if they aren't visible.

### Buttons

Press SETUP after all of the settings have been chosen. This will initialize the program to create a population of hosts and parasites.

Press GO to make the simulation run continuously. Hosts and parasites will move about the environment, reproducing or infecting when they can. To stop the simulation, press the GO button again.

### Output

While it is running, the simulation will show the results of this parasite-host interaction in four graphs:

The ASEXUAL VS. SEXUAL STRATEGIES graph shows the population count of both asexual and sexual hosts through time.

The PARASITE PHENOTYPE FREQUENCIES graph shows the prevalence of each of the six infection strategies through time.

The ASEXUAL PHENOTYPE FREQUENCIES graph shows the prevalence of each of the six phenotypes for asexual hosts through time.

THE SEXUAL PHENOTYPE FREQUENCIES graph shows the prevalence of each of the six phenotypes for sexual hosts through time.


The purpose of this model is to demonstrate that under certain conditions sexual reproduction can be more beneficial than asexual reproduction. Pay attention to how the settings affect how often sexual reproducers are able to outcompete asexual reproducers:

1. Does it matter what the CARRYING-CAPACITY is set to?
2. How do the host reproductive settings OFFSPRING-PER-FEMALE and INTERBIRTH-INTERVAL affect the ability of the host population to survive a parasite infection?
3. How do the HOST-MUTATION-RATE and PARASITE-MUTATION-RATE settings affect which reproductive strategy wins or whether the hosts survive a parasite infection? What happens if you set a mutation rate to zero?
4. Which combination of OFFSPRING-PER-PARASITE, PARASITE-INFECTIVITY, and PARASITE-LIFESPAN settings makes the parasites most effective in infecting the host population? Which combination makes the parasites least effective? How do these settings affect which reproductive strategy wins?
5. When you set the initial host population to 100% sexual or 100% asexual, which strategy is better able to fight off the parasites? Which strategy more often goes to extinction?

Finally, make sure to pay special attention to the graphical outputs. How do the host phenotype frequencies and parasite infection strategies affect each other? What patterns do you notice?


Copyright 2016 K N Crouse.

Acknowledgements: A special thanks to M L Wilson for comments and suggestions.

This model was created at the University of Minnesota as part of a series of applets to illustrate principles in biological evolution.

The model may be freely used, modified and redistributed provided this copyright is included and the resulting models are not used for profit.

Contact K N Crouse at if you have questions about its use.

(back to the NetLogo User Community Models)