Polyploidization model
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Polyploidization model (1)
Polyploidization is associated with lineage-specific changes that promote divergence and speciation. Knowledge about the establishment of neopolyploids is fragmentary. We use Netlogo (2) to build a scalable easy-to-use command center for analysing complex diploid-polyploid interactions. This model was constructed by integrating code components directly from pre-existing models (3,4), which allowed for the incorporation of functionalities such as hybridization or the application of uniform rules across individuals. Simultaneously, we meticulously addressed critical components like gamete classes, fitness dynamics, and environmental interactions.
The workspace is a multilayered environment whose eco-variables fluctuate between generations. Reproductive syndromes, recombinant/clonal inheritance and complex traits (adaptivity, niche breadth, dispersal) are used to elicit fitness values and monitor population spatial dynamics. Neopolyploidization was recurrent, polytopic and heterogeneous in time. Increasing rates of unreduced gametes accelerated the establishment of neopolyploids but removed the role of triploids. Under standard rates and heterogeneous environment, model-based evidence shows that (1) a large proportion of polyploidization events are unsuccessful, (2) parental traits and local conditions prime a loss of diploid fitness that benefited eco-geographic structured polyploid success, (3) self-fertility and apomixis improve the rate of polyploidization, and shorten the time required for demographic establishment, and (4) ecological niche shifts promote cytotype coexistence, but niche expansion favors establishment and foster cytotype displacement. The modelling framework offers opportunities for in-depth lineage-specific analyses of the spatiotemporal dynamics and evolutionary differentiation in diploid-polyploid systems.
We extend our sincere gratitude to the creators of NetLogo for developing this exceptional and powerful modeling platform. We warmly invite all users—whether they are researchers looking to test complex hypotheses or educators seeking to explain dynamic concepts to their students—to utilize and modify this model freely to suit their specific needs and goals. We kindly request that, in the spirit of open science, users always ensure appropriate citation is provided to the original work, as well as to the NetLogo software itself.
References
Schneider, J.S., Reutemann, A.V., Sassone, A.B., Honfi, A.I. & Hojsgaard, D.H. An interactive heuristic model to test ecological and evolutionary hypotheses on incipient polyploid species. Scientific Reports. https://www.nature.com/articles/s41598-025-29286-7 (2025).
Wilensky & U. NetLogo. Center for Connected Learning and Computer-Based Modelling, Northwestern University. Evanston, IL. http://ccl.northwestern.edu/netlogo/ (1999).
Novak, M. & Wilensky, U. NetLogo Plant Hybridization model. Center for Connected Learning and Computer-Based Modelling, Northwestern University, Evanston, IL. http://ccl.northwestern.edu/netlogo/models/PlantHybridization (2007).
Novak, M., McGlynn, G. & Wilensky, U. NetLogo Plant Speciation model. Center for Connected Learning and Computer-Based Modelling, Northwestern University, Evanston, IL. http://ccl.northwestern.edu/netlogo/models/PlantSpeciation (2012).
Comments and Questions
extensions [gis palette]
breed [Plants Plant]
Plants-own [ID ID_Count ID_Fitness Counted Origin cytotype partner IA1 IA2 IA3 IA4 IA5
IA1_4x IA2_4x IA3_4x IA4_4x IA5_4x
age E_Total E_mother_SPE E_Surround_SPE E1 E2 E3 E4 E5 offspring]
;Pollen_ratio Seed_ratio Effective_Pollen_ratio Effective_Seed_ratio]
patches-own [V1 V2 V3 V4 V5 V1mean V2mean V3mean V4mean V5mean occupied area]
globals [Generation Counter
ID_total who_list who_agentset
Bilateral_polyploidization Unilateral_polyploidization
Max_Offspring
Max_age
SV
homogeneous_patch
Atmospheric_variable1 Atmospheric_variable2 Atmospheric_variable3 Soil_variable1 Soil_variable2 Soil_variable3
minV1 minV2 minV3 minV4 minV5
maxV1 maxV2 maxV3 maxV4 maxV5
MinIA1 MinIA2 MinIA3 MinIA4 MinIA5
MaxIA1 MaxIA2 MaxIA3 MaxIA4 MaxIA5
MeanIA1 MeanIA2 MeanIA3 MeanIA4 MeanIA5
RangeIA1 RangeIA2 RangeIA3 RangeIA4 RangeIA5
MinIA1_4x MinIA2_4x MinIA3_4x MinIA4_4x MinIA5_4x
MaxIA1_4x MaxIA2_4x MaxIA3_4x MaxIA4_4x MaxIA5_4x
MeanIA1_4x MeanIA2_4x MeanIA3_4x MeanIA4_4x MeanIA5_4x
RangeIA1_4x RangeIA2_4x RangeIA3_4x RangeIA4_4x RangeIA5_4x]
to Setup_characteristics
clear-all
random-seed 1 ;To change the environment between experiments: random-seed new-seed
set Max_age 10 ;Determines the potential age of plants.
set Max_Offspring 10 ;Determines the potential offspring of plants.
;Raster variables must be stored in the same folder that the model.
set Atmospheric_variable1 gis:load-dataset "V1_Rad2.asc"
set Atmospheric_variable2 gis:load-dataset "V2_Bio3.asc"
set Atmospheric_variable3 gis:load-dataset "V3_Bio12.asc"
set Soil_variable1 gis:load-dataset "V4_SWC.asc"
set Soil_variable2 gis:load-dataset "V5_SOCC.asc"
gis:set-world-envelope (gis:envelope-of Atmospheric_variable1) ;We adjust the "modeled world" to the size of the variables.
ask patches [
;Gis:raster-sample takes the values from the raster and passes to patches that occupy the same space, if the patch covers more than one cell, in the raster the valueswill be averaged.
;Atmospheric Variables:
set V1 gis:raster-sample Atmospheric_variable1 self
set V2 gis:raster-sample Atmospheric_variable2 self
set V3 gis:raster-sample Atmospheric_variable3 self
;Soil Variables:
set V4 gis:raster-sample Soil_variable1 self
set V5 gis:raster-sample Soil_variable2 self
set occupied false
set area true]
set minV1 min [V1] of patches ;Minimum value of the variables in the raster.
set minV2 min [V2] of patches
set minV3 min [V3] of patches
set minV4 min [V4] of patches
set minV5 min [V5] of patches
set maxV1 max [V1] of patches ;Maximum value of the variables in the raster.
set maxV2 max [V2] of patches
set maxV3 max [V3] of patches
set maxV4 max [V4] of patches
set maxV5 max [V5] of patches
if Homogeneous_environment? [
if Which_homogeneous_patch? = "0.65" [set homogeneous_patch (patch (max-pxcor / 3) (max-pycor / 2))]
if Which_homogeneous_patch? = "0.77" [set homogeneous_patch (patch (max-pxcor / 2.7) (max-pycor / 2))]
if Which_homogeneous_patch? = "0.87" [set homogeneous_patch (patch (max-pxcor / 2.5) (max-pycor / 2))]
if Which_homogeneous_patch? = "0.99" [set homogeneous_patch (patch (max-pxcor / 2) (max-pycor / 2))]
ask patches [
;The value that the patches will take in the homogeneous environment experiment is established.
set V1mean [V1] of homogeneous_patch
set V2mean [V2] of homogeneous_patch
set V3mean [V3] of homogeneous_patch
set V4mean [V4] of homogeneous_patch
set V5mean [V5] of homogeneous_patch]]
if switch_Map = "White" [ask patches [set pcolor white]]
if switch_Map = "Black" [ask patches [set pcolor black]]
if switch_Map = "Atmospheric Variable 1" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V1) minV1 maxV1]]
if switch_Map = "Atmospheric Variable 2" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V2) minV2 maxV2]]
if switch_Map = "Atmospheric Variable 3" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V3) minV3 maxV3]]
if switch_Map = "Soil Variable 1" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V4) minV4 maxV4]]
if switch_Map = "Soil Variable 2" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V5) minV5 maxV5]]
;The output file is created with the specified name.
let Which_patch ""
ifelse Homogeneous_environment? [set Which_patch Which_homogeneous_patch?] [set Which_patch "Heterogeneous"]
let file (word "(" "2n=" Unreduced_Famale_gametes_Plants_2x ")"
"(" "Limit4x=" Limit4x ")"
"(" "Optimum=" How_much_patches? ")"
"(" "S.A=" Self_pollination_4x "." Apomixis_potential_4x ")"
Which_patch ".txt")
if is-string? file [
file-open file]
end
to setup
clear-turtles
clear-all-plots
random-seed 1 ;To change the position of the initial 30 plants, and thus the AI values between repetitions: random-seed new-seed.
set Generation 0
set Counter (Counter + 1)
set Bilateral_polyploidization 0
set Unilateral_polyploidization 0
set ID_total []
create-Plants 30 ;The initial 30 plants are created.
ask Plants [
set shape "Diploids" set color [0 100 0]
set size 4
set cytotype "2x"
set ID "No ID"
set ID_Count 0
set Counted FALSE
set age 0
set partner "other"
setxy random-normal (max-pxcor / 2) 2 random-normal (max-pycor / 2) 2 ;The size of the initial spread is proportional to the range of IA values.
;Once each plant is located, five patch-specific Individual Adaptivity values (IAi) are printed, each associated to one of the five selected environmental variables (Vi)
set IA1 V1
set IA2 V2
set IA3 V3
set IA4 V4
set IA5 V5
if Different_optimum_4x? [
;In the Different optimum experiment, 30 patches different from those of the diploid plants are selected.
set IA1_4x ([V1] of patch-at-heading-and-distance Heading? How_much_patches?)
set IA2_4x ([V2] of patch-at-heading-and-distance Heading? How_much_patches?)
set IA3_4x ([V3] of patch-at-heading-and-distance Heading? How_much_patches?)
set IA4_4x ([V4] of patch-at-heading-and-distance Heading? How_much_patches?)
set IA5_4x ([V5] of patch-at-heading-and-distance Heading? How_much_patches?)]]
;The different measures for the optimum of diploids and triploids are calculated.
;Atmospheric Individual Adaptivity:
set MeanIA1 precision (mean [IA1] of turtles) 5 ;Average value for each AI.
set MeanIA2 precision (mean [IA2] of turtles) 5
set MeanIA3 precision (mean [IA3] of turtles) 5
set MinIA1 precision (min [IA1] of turtles) 5 ;Minimum value for each AI.
set MinIA2 precision (min [IA2] of turtles) 5
set MinIA3 precision (min [IA3] of turtles) 5
set MaxIA1 precision (max [IA1] of turtles) 5 ;Maximum value for each AI.
set MaxIA2 precision (max [IA2] of turtles) 5
set MaxIA3 precision (max [IA3] of turtles) 5
set RangeIA1 precision (MaxIA1 - MinIA1) 5 ;Range of each AI.
set RangeIA2 precision (MaxIA2 - MinIA2) 5
set RangeIA3 precision (MaxIA3 - MinIA3) 5
;Soil Individual Adaptivity:
set MeanIA4 precision (mean [IA4] of turtles) 5
set MeanIA5 precision (mean [IA5] of turtles) 5
set MinIA4 precision (min [IA4] of turtles) 5
set MinIA5 precision (min [IA5] of turtles) 5
set MaxIA4 precision (max [IA4] of turtles) 5
set MaxIA5 precision (max [IA5] of turtles) 5
set RangeIA4 precision (MaxIA4 - MinIA4) 5
set RangeIA5 precision (MaxIA5 - MinIA5) 5
if Different_optimum_4x? [
;For the Different optimum experiment, the different measures for the optimum of the tetraploids are calculated.
;Atmospheric Individual Adaptivity (4x):
set MeanIA1_4x precision (mean [IA1_4x] of turtles) 5
set MeanIA2_4x precision (mean [IA2_4x] of turtles) 5
set MeanIA3_4x precision (mean [IA3_4x] of turtles) 5
set MinIA1_4x precision (min [IA1_4x] of turtles) 5
set MinIA2_4x precision (min [IA2_4x] of turtles) 5
set MinIA3_4x precision (min [IA3_4x] of turtles) 5
set MaxIA1_4x precision (max [IA1_4x] of turtles) 5
set MaxIA2_4x precision (max [IA2_4x] of turtles) 5
set MaxIA3_4x precision (max [IA3_4x] of turtles) 5
set RangeIA1_4x precision (MaxIA1_4x - MinIA1_4x) 5
set RangeIA2_4x precision (MaxIA2_4x - MinIA2_4x) 5
set RangeIA3_4x precision (MaxIA3_4x - MinIA3_4x) 5
;Soil Individual Adaptivity (4x):
set MeanIA4_4x precision (mean [IA4_4x] of turtles) 5
set MeanIA5_4x precision (mean [IA5_4x] of turtles) 5
set MinIA4_4x precision (min [IA4_4x] of turtles) 5
set MinIA5_4x precision (min [IA5_4x] of turtles) 5
set MaxIA4_4x precision (max [IA4_4x] of turtles) 5
set MaxIA5_4x precision (max [IA5_4x] of turtles) 5
set RangeIA4_4x precision (MaxIA4_4x - MinIA4_4x) 5
set RangeIA5_4x precision (MaxIA5_4x - MinIA5_4x) 5]
if switch_Map = "White" [ask patches [set pcolor white]]
if switch_Map = "Black" [ask patches [set pcolor black]]
if switch_Map = "Atmospheric Variable 1" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V1) minV1 maxV1]]
if switch_Map = "Atmospheric Variable 2" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V2) minV2 maxV2]]
if switch_Map = "Atmospheric Variable 3" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V3) minV3 maxV3]]
if switch_Map = "Soil Variable 1" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V4) minV4 maxV4]]
if switch_Map = "Soil Variable 2" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V5) minV5 maxV5]]
reset-ticks
end
to go
tick
if not any? turtles [Setup]
set Generation Generation + 1
if Counter = 1001 [file-close beep stop] ;1000 replicates for each experiment to account for stochasticity.
;if generation = 200 [export-world (word "World" " " Counter ".csv") setup]
random-seed new-seed ;Seed should be different between runs (new-seed) to account for stochasticity of crossings and dispersion.
set who_list []
if (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x) > 100 [user-message (word "The sum of Triploid´s gametes percentages cannot be greater than 100%")]
;Limit values must be greater than 0.
if (LimitV1) = 0 or (LimitV2) = 0 or (LimitV3) = 0 or (LimitV4) = 0 or (LimitV5) = 0 [user-message (word "Limit cannot be 0")]
if switch_Map = "White" [ask patches [set pcolor white]]
if switch_Map = "Black" [ask patches [set pcolor black]]
if switch_Map = "Atmospheric Variable 1" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V1) minV1 maxV1]]
if switch_Map = "Atmospheric Variable 2" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V2) minV2 maxV2]]
if switch_Map = "Atmospheric Variable 3" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V3) minV3 maxV3]]
if switch_Map = "Soil Variable 1" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V4) minV4 maxV4]]
if switch_Map = "Soil Variable 2" [ask patches [set pcolor palette:scale-gradient [[255 255 255] [255 200 0]] (V5) minV5 maxV5]]
;Intergenerational Atmospheric variability
set SV Precision (random-normal 1 0.001) 5
New-generation
end
to New-generation
;In the homogeneous environment experiment, we wait until generation 100 to homogenize the environment.
if Homogeneous_environment? and generation = 100 [ask patches [if count (Plants-here) > 0 [set occupied true] set area occupied]]
ask patches [if occupied = true [set pcolor white]]
ask turtles [set age (age + 1)]
ask turtles [if age > Max_age [die]]
ask turtles [set Origin "Established"]
ask turtles [Edit_E_Total] ;The value of the Environmental Fitness Component (E) is calculated for each plant, in each generation.
ask turtles [if (random-float 1) > (E_Total) [die]] ;The environmental component of fitness conditions the life of the individual.
ask turtles [ifelse Variable_plants_color? [
if Which_variable_values? = "Environmental Component" [ifelse Origin = "Established" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] (E_Total * 100) 50 100] [set color white]]
ifelse Different_optimum_4x? [
if Which_variable_values? = "IA1 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA1 - (min (list MinIA1 MinIA1_4x))) / ((max (list MaxIA1 MaxIA1_4x)) - (min (list MinIA1 MinIA1_4x))) * 100) 0 100]
if Which_variable_values? = "IA2 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA2 - (min (list MinIA2 MinIA2_4x))) / ((max (list MaxIA2 MaxIA2_4x)) - (min (list MinIA2 MinIA2_4x))) * 100) 0 100]
if Which_variable_values? = "IA3 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA3 - (min (list MinIA3 MinIA3_4x))) / ((max (list MaxIA3 MaxIA3_4x)) - (min (list MinIA3 MinIA3_4x))) * 100) 0 100]
if Which_variable_values? = "IA4 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA4 - (min (list MinIA4 MinIA4_4x))) / ((max (list MaxIA4 MaxIA4_4x)) - (min (list MinIA4 MinIA4_4x))) * 100) 0 100]
if Which_variable_values? = "IA5 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA5 - (min (list MinIA5 MinIA5_4x))) / ((max (list MaxIA5 MaxIA5_4x)) - (min (list MinIA5 MinIA5_4x))) * 100) 0 100]]
[if Which_variable_values? = "IA1 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA1 - MinIA1) / RangeIA1 * 100) 0 100]
if Which_variable_values? = "IA2 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA2 - MinIA2) / RangeIA2 * 100) 0 100]
if Which_variable_values? = "IA3 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA3 - MinIA3) / RangeIA3 * 100) 0 100]
if Which_variable_values? = "IA4 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA4 - MinIA4) / RangeIA4 * 100) 0 100]
if Which_variable_values? = "IA5 Values" [set shape "Tetraploids" set color palette:scale-gradient [[160 32 240] [176 48 96] [255 255 0]] ((IA5 - MinIA5) / RangeIA5 * 100) 0 100]]]
[if cytotype = "2x" [set shape "Diploids" set color [0 100 0]]
if cytotype = "3x" [set shape "Triploids" set color [255 0 0]]
if cytotype = "4x" [set shape "Tetraploids" set color [0 0 255]]]]
ask turtles [
if count (Plants-here) > 1 [
let overpopulation ((count Plants-here) - 1)
if count Plants-here > 0 [ask (min-n-of overpopulation Plants-here [E_Total]) [die]]]] ;Only one plant by patch, the most fit.
ask turtles [set ID_Count 0]
ask turtles [
set offspring precision (Max_Offspring * E_Total) 0 ;The number of offspring a plant can have is calculated.
if age = 1 [set offspring (offspring * 0.3)]
if age = 2 [set offspring (offspring * 0.6)]
if age != 0 [
if cytotype = "2x" [reproduce-diploids]
if cytotype = "4x" [reproduce-tetraploids]
if cytotype = "3x" [reproduce-triploids]]]
output
end
to Edit_E_Total ;Calculation of the environmental component of fitness (E) for each AI
;For a homogeneous environment.
ifelse Homogeneous_environment? and (generation = 100 or generation > 100) [
ifelse cytotype = "4x"
[set E1 precision (1 / (2 ^ abs (((IA1 - (V1mean * SV)) / (LimitV1 * Limit4x)) ^ 2))) 2
set E2 precision (1 / (2 ^ abs (((IA2 - (V2mean * SV)) / (LimitV2 * Limit4x)) ^ 2))) 2
set E3 precision (1 / (2 ^ abs (((IA3 - (V3mean * SV)) / (LimitV3 * Limit4x)) ^ 2))) 2
set E4 precision (1 / (2 ^ abs (((IA4 - V4mean) / (LimitV4 * Limit4x)) ^ 2))) 2
set E5 precision (1 / (2 ^ abs (((IA5 - V5mean) / (LimitV5 * Limit4x)) ^ 2))) 2]
[set E1 precision (1 / (2 ^ abs (((IA1 - (V1mean * SV)) / LimitV1) ^ 2))) 2
set E2 precision (1 / (2 ^ abs (((IA2 - (V2mean * SV)) / LimitV2) ^ 2))) 2
set E3 precision (1 / (2 ^ abs (((IA3 - (V3mean * SV)) / LimitV3) ^ 2))) 2
set E4 precision (1 / (2 ^ abs (((IA4 - V4mean) / LimitV4) ^ 2))) 2
set E5 precision (1 / (2 ^ abs (((IA5 - V5mean) / LimitV5) ^ 2))) 2]]
;For a heterogeneous environment.
[ifelse cytotype = "4x"
[set E1 precision (1 / (2 ^ abs (((IA1 - (V1 * SV)) / (LimitV1 * Limit4x)) ^ 2))) 2
set E2 precision (1 / (2 ^ abs (((IA2 - (V2 * SV)) / (LimitV2 * Limit4x)) ^ 2))) 2
set E3 precision (1 / (2 ^ abs (((IA3 - (V3 * SV)) / (LimitV3 * Limit4x)) ^ 2))) 2
set E4 precision (1 / (2 ^ abs (((IA4 - V4) / (LimitV4 * Limit4x)) ^ 2))) 2
set E5 precision (1 / (2 ^ abs (((IA5 - V5) / (LimitV5 * Limit4x)) ^ 2))) 2]
[set E1 precision (1 / (2 ^ abs (((IA1 - (V1 * SV)) / LimitV1) ^ 2))) 2
set E2 precision (1 / (2 ^ abs (((IA2 - (V2 * SV)) / LimitV2) ^ 2))) 2
set E3 precision (1 / (2 ^ abs (((IA3 - (V3 * SV)) / LimitV3) ^ 2))) 2
set E4 precision (1 / (2 ^ abs (((IA4 - V4) / LimitV4) ^ 2))) 2
set E5 precision (1 / (2 ^ abs (((IA5 - V5) / LimitV5) ^ 2))) 2]]
;Environmental component of fitness (E).
set E_Total precision (E1 * E2 * E3 * E4 * E5) 2
end
to reproduce-diploids
repeat offspring [
;It determines where and how far the seed will be dispersed.
let where patch-at-heading-and-distance (random 360) precision ((random-exponential 0.5) + 1) 2
;We make sure that the selected patch is unoccupied. In the homogeneous environment experiment we limit the distribution, since if we do not do so, the plants will take over the world.
if where != NOBODY [if [count turtles-here] of where = 0 and [area] of where = true [
let mate []
ifelse random-float 100 > Self_pollination_2x [;set Pollen_ratio precision ((random-exponential 1) + 1) 1
;set mate one-of other Plants with [Age != 0] in-radius Pollen_ratio]
set mate one-of other Plants with [Age != 0] in-radius precision ((random-exponential 1) + 1) 1]
[set mate self]
if mate != NOBODY [
;set Effective_Seed_ratio precision ([distance where] of self) 2
;set Effective_Pollen_ratio precision ([distance mate] of self) 2
hatch (1) [
let ovule "x"
let pollen "x"
;Pollen. The viability and frequency of Unreduced Gametes for pollen is considered.
if ([cytotype] of mate = "2x") [
ifelse Generation < 200 [ifelse random-float 100 > Male_Gametes_Viability_2x [die] [set pollen "(x)"]]
[ifelse random-float 100 < Unreduced_male_gametes_Plants_2x [ifelse random-float 100 > Male_Gametes_Viability_2x [die] [set pollen "(2x)"]]
[ifelse random-float 100 > Male_Gametes_Viability_2x [die] [set pollen "(x)"]]]]
if ([cytotype] of mate = "3x") [
ifelse random-float 100 > Male_Gametes_Viability_3x [die] [
let which_gamete ((random (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x)) + 1) ;Random reports a random integer number strictly less than the specified number.
if which_gamete <= (Reduced_x_gametes_Plant_3x) [set pollen "(x)"]
if which_gamete > (Reduced_x_gametes_Plant_3x) and which_gamete <= (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x) [set pollen "(2x)"]
if which_gamete > (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x) and which_gamete <= (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x) [set pollen "(3x)"]]]
if ([cytotype] of mate = "4x") [
ifelse random-float 100 > Male_Gametes_Viability_4x [die]
[set pollen "(2x)"]]
;Ovule. The viability and frequency of unreduced gametes for ovules is considered.
ifelse Generation < 200 [ifelse random-float 100 > Female_Gametes_Viability_2x [die] [set ovule "(x)"]]
[ifelse random-float 100 < Unreduced_Famale_gametes_Plants_2x [ifelse random-float 100 > Female_Gametes_Viability_2x [die] [set ovule "(2x)"]]
[ifelse random-float 100 > Female_Gametes_Viability_2x [die] [set ovule "(x)"]]]
let letters word ovule pollen
if letters = "(2x)(3x)" [die]
if letters = "(x)(3x)" [set letters "(2x)(2x)"]
;Seed.
if letters = "(x)(x)" [
if random-float 100 > Diploid_Seed_viability [die]
set cytotype "2x"
if ([cytotype] of mate = "2x") [ifelse mate = myself [set partner "Selfing"] [set partner "Other"] set Origin "Gamete(n=x)Mother(2n=2x)+Gamete(n=x)Father(2n=2x)" set ID "No ID"]
if ([cytotype] of mate = "3x") [set partner "Other" set Origin "Gamete(n=x)Mother(2n=2x)+Gamete(n=x)Father(2n=3x)" set ID "No ID"]]
if letters = "(2x)(2x)" [
if random-float 100 > Tetraploid_Seed_viability [die]
set cytotype "4x"
if ([cytotype] of mate = "2x") [ifelse mate = myself [set partner "Selfing"] [set partner "Other"] set Origin "Gamete(2n=2x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)" set ID who set E_mother_SPE (Precision (E_Total) 2) set Counted FALSE]
if ([cytotype] of mate = "4x") [set partner "Other" set Origin "Gamete(2n=2x)Mother(2n=2x)+Gamete(n=2x)Father(2n=4x)" set ID ([ID] of mate) set E_mother_SPE (Precision (E_Total) 2) set Counted ([Counted] of mate)]
if ([cytotype] of mate = "3x") [set partner "Other" ifelse pollen = "(2x)" [set Origin "Gamete(2n=2x)Mother(2n=2x)+Gamete(n=2x)Father(2n=3x)"] [set Origin "Gamete(n=x)Mother(2n=2x)+Gamete(2n=3x)Father(2n=3x)"] set ID ([ID] of mate) set E_mother_SPE (Precision (E_Total) 2) set Counted ([Counted] of mate)]]
if letters = "(x)(2x)" or letters = "(2x)(x)" [
if random-float 100 > Triploid_Seed_viability [die]
set cytotype "3x"
if ([cytotype] of mate = "2x") [ifelse mate = myself [set partner "Selfing"] [set partner "Other"] ifelse pollen = "(2x)" [set Origin "Gamete(n=x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)"] [set Origin "Gamete(2n=2x)Mother(2n=2x)+Gamete(n=x)Father(2n=2x)"] set ID who set E_mother_SPE (Precision (E_Total) 2) set Counted FALSE]
if ([cytotype] of mate = "4x") [set partner "Other" set Origin "Gamete(n=x)Mother(2n=2x)+Gamete(n=2x)Father(2n=4x)" set ID ([ID] of mate) set E_mother_SPE (Precision (E_Total) 2) set Counted ([Counted] of mate)]
if ([cytotype] of mate = "3x") [set partner "Other" ifelse pollen = "(2x)" [set Origin "Gamete(n=x)Mother(2n=2x)+Gamete(n=2x)Father(2n=3x)"] [set Origin "Gamete(2n=2x)Mother(2n=2x)+Gamete(n=x)Father(2n=3x)"] set ID ([ID] of mate) set E_mother_SPE (Precision (E_Total) 2) set Counted ([Counted] of mate)]]
move-to where
set age 0
;Transmission of individual adaptivity (IA) to offspring.
ifelse Different_optimum_4x? [
if cytotype = "2x" or (cytotype = "3x" and (([cytotype] of mate = "2x") or ([cytotype] of mate = "3x"))) [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1)) ;Obtenemos el valor de parental contribution to adaptivity de la madre (PCA A).
while [IA1_mother < MinIA1 or IA1_mother > MaxIA1] [set IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))] ;Corregimos valores fuera de la curva.
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1)) ;Obtenemos el valor de parental contribution to adaptivity del padre (PCA B).
while [IA1_father < MinIA1 or IA1_father > MaxIA1] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10 ;Promediamos las contribuciones de los padres para obtener el valor de IA de la descendencia.
let IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))
while [IA2_mother < MinIA2 or IA2_mother > MaxIA2] [set IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))
while [IA2_father < MinIA2 or IA2_father > MaxIA2] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))
while [IA3_mother < MinIA3 or IA3_mother > MaxIA3] [set IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))
while [IA3_father < MinIA3 or IA3_father > MaxIA3] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))
while [IA4_mother < MinIA4 or IA4_mother > MaxIA4] [set IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))
while [IA4_father < MinIA4 or IA4_father > MaxIA4] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))
while [IA5_mother < MinIA5 or IA5_mother > MaxIA5] [set IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))
while [IA5_father < MinIA5 or IA5_father > MaxIA5] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]
if cytotype = "3x" and ([cytotype] of mate = "4x") [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))
while [IA1_mother < MinIA1 or IA1_mother > MaxIA1] [set IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))]
let IA1_father random-normal (MaxIA1 - (MaxIA1_4x - [IA1] of mate)) abs ((RangeIA1 / 2) - abs ((MaxIA1 - (MaxIA1_4x - [IA1] of mate)) - MeanIA1))
while [IA1_father < MinIA1 or IA1_father > MaxIA1] [set IA1_father random-normal (MaxIA1 - (MaxIA1_4x - [IA1] of mate)) abs ((RangeIA1 / 2) - abs ((MaxIA1 - (MaxIA1_4x - [IA1] of mate)) - MeanIA1))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))
while [IA2_mother < MinIA2 or IA2_mother > MaxIA2] [set IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))]
let IA2_father random-normal (MaxIA2 - (MaxIA2_4x - [IA2] of mate)) abs ((RangeIA2 / 2) - abs ((MaxIA2 - (MaxIA2_4x - [IA2] of mate)) - MeanIA2))
while [IA2_father < MinIA2 or IA2_father > MaxIA2] [set IA2_father random-normal (MaxIA2 - (MaxIA2_4x - [IA2] of mate)) abs ((RangeIA2 / 2) - abs ((MaxIA2 - (MaxIA2_4x - [IA2] of mate)) - MeanIA2))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))
while [IA3_mother < MinIA3 or IA3_mother > MaxIA3] [set IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))]
let IA3_father random-normal (MaxIA3 - (MaxIA3_4x - [IA3] of mate)) abs ((RangeIA3 / 2) - abs ((MaxIA3 - (MaxIA3_4x - [IA3] of mate)) - MeanIA3))
while [IA3_father < MinIA3 or IA3_father > MaxIA3] [set IA3_father random-normal (MaxIA3 - (MaxIA3_4x - [IA3] of mate)) abs ((RangeIA3 / 2) - abs ((MaxIA3 - (MaxIA3_4x - [IA3] of mate)) - MeanIA3))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))
while [IA4_mother < MinIA4 or IA4_mother > MaxIA4] [set IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))]
let IA4_father random-normal (MaxIA4 - (MaxIA4_4x - [IA4] of mate)) abs ((RangeIA4 / 2) - abs ((MaxIA4 - (MaxIA4_4x - [IA4] of mate)) - MeanIA4))
while [IA4_father < MinIA4 or IA4_father > MaxIA4] [set IA4_father random-normal (MaxIA4 - (MaxIA4_4x - [IA4] of mate)) abs ((RangeIA4 / 2) - abs ((MaxIA4 - (MaxIA4_4x - [IA4] of mate)) - MeanIA4))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))
while [IA5_mother < MinIA5 or IA5_mother > MaxIA5] [set IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))]
let IA5_father random-normal (MaxIA5 - (MaxIA5_4x - [IA5] of mate)) abs ((RangeIA5 / 2) - abs ((MaxIA5 - (MaxIA5_4x - [IA5] of mate)) - MeanIA5))
while [IA5_father < MinIA5 or IA5_father > MaxIA5] [set IA5_father random-normal (MaxIA5 - (MaxIA5_4x - [IA5] of mate)) abs ((RangeIA5 / 2) - abs ((MaxIA5 - (MaxIA5_4x - [IA5] of mate)) - MeanIA5))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]
if cytotype = "4x" and (([cytotype] of mate = "2x") or ([cytotype] of mate = "3x")) [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal (MaxIA1_4x - (MaxIA1 - IA1)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - IA1)) - MeanIA1_4x))
while [IA1_mother < MinIA1_4x or IA1_mother > MaxIA1_4x] [set IA1_mother random-normal (MaxIA1_4x - (MaxIA1 - IA1)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - IA1)) - MeanIA1_4x))]
let IA1_father random-normal (MaxIA1_4x - (MaxIA1 - [IA1] of mate)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - [IA1] of mate)) - MeanIA1_4x))
while [IA1_father < MinIA1_4x or IA1_father > MaxIA1_4x] [set IA1_father random-normal (MaxIA1_4x - (MaxIA1 - [IA1] of mate)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - [IA1] of mate)) - MeanIA1_4x))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal (MaxIA2_4x - (MaxIA2 - IA2)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - IA2)) - MeanIA2_4x))
while [IA2_mother < MinIA2_4x or IA2_mother > MaxIA2_4x] [set IA2_mother random-normal (MaxIA2_4x - (MaxIA2 - IA2)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - IA2)) - MeanIA2_4x))]
let IA2_father random-normal (MaxIA2_4x - (MaxIA2 - [IA2] of mate)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - [IA2] of mate)) - MeanIA2_4x))
while [IA2_father < MinIA2_4x or IA2_father > MaxIA2_4x] [set IA2_father random-normal (MaxIA2_4x - (MaxIA2 - [IA2] of mate)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - [IA2] of mate)) - MeanIA2_4x))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal (MaxIA3_4x - (MaxIA3 - IA3)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - IA3)) - MeanIA3_4x))
while [IA3_mother < MinIA3_4x or IA3_mother > MaxIA3_4x] [set IA3_mother random-normal (MaxIA3_4x - (MaxIA3 - IA3)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - IA3)) - MeanIA3_4x))]
let IA3_father random-normal (MaxIA3_4x - (MaxIA3 - [IA3] of mate)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - [IA3] of mate)) - MeanIA3_4x))
while [IA3_father < MinIA3_4x or IA3_father > MaxIA3_4x] [set IA3_father random-normal (MaxIA3_4x - (MaxIA3 - [IA3] of mate)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - [IA3] of mate)) - MeanIA3_4x))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal (MaxIA4_4x - (MaxIA4 - IA4)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - IA4)) - MeanIA4_4x))
while [IA4_mother < MinIA4_4x or IA4_mother > MaxIA4_4x] [set IA4_mother random-normal (MaxIA4_4x - (MaxIA4 - IA4)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - IA4)) - MeanIA4_4x))]
let IA4_father random-normal (MaxIA4_4x - (MaxIA4 - [IA4] of mate)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - [IA4] of mate)) - MeanIA4_4x))
while [IA4_father < MinIA4_4x or IA4_father > MaxIA4_4x] [set IA4_father random-normal (MaxIA4_4x - (MaxIA4 - [IA4] of mate)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - [IA4] of mate)) - MeanIA4_4x))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal (MaxIA5_4x - (MaxIA5 - IA5)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - IA5)) - MeanIA5_4x))
while [IA5_mother < MinIA5_4x or IA5_mother > MaxIA5_4x] [set IA5_mother random-normal (MaxIA5_4x - (MaxIA5 - IA5)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - IA5)) - MeanIA5_4x))]
let IA5_father random-normal (MaxIA5_4x - (MaxIA5 - [IA5] of mate)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - [IA5] of mate)) - MeanIA5_4x))
while [IA5_father < MinIA5_4x or IA5_father > MaxIA5_4x] [set IA5_father random-normal (MaxIA5_4x - (MaxIA5 - [IA5] of mate)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - [IA5] of mate)) - MeanIA5_4x))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]
if cytotype = "4x" and ([cytotype] of mate = "4x") [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal (MaxIA1_4x - (MaxIA1 - IA1)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - IA1)) - MeanIA1_4x))
while [IA1_mother < MinIA1_4x or IA1_mother > MaxIA1_4x] [set IA1_mother random-normal (MaxIA1_4x - (MaxIA1 - IA1)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - IA1)) - MeanIA1_4x))]
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1_4x / 2) - abs (([IA1] of mate) - MeanIA1_4x))
while [IA1_father < MinIA1_4x or IA1_father > MaxIA1_4x] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1_4x / 2) - abs (([IA1] of mate) - MeanIA1_4x))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal (MaxIA2_4x - (MaxIA2 - IA2)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - IA2)) - MeanIA2_4x))
while [IA2_mother < MinIA2_4x or IA2_mother > MaxIA2_4x] [set IA2_mother random-normal (MaxIA2_4x - (MaxIA2 - IA2)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - IA2)) - MeanIA2_4x))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2_4x / 2) - abs (([IA2] of mate) - MeanIA2_4x))
while [IA2_father < MinIA2_4x or IA2_father > MaxIA2_4x] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2_4x / 2) - abs (([IA2] of mate) - MeanIA2_4x))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal (MaxIA3_4x - (MaxIA3 - IA3)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - IA3)) - MeanIA3_4x))
while [IA3_mother < MinIA3_4x or IA3_mother > MaxIA3_4x] [set IA3_mother random-normal (MaxIA3_4x - (MaxIA3 - IA3)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - IA3)) - MeanIA3_4x))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3_4x / 2) - abs (([IA3] of mate) - MeanIA3_4x))
while [IA3_father < MinIA3_4x or IA3_father > MaxIA3_4x] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3_4x / 2) - abs (([IA3] of mate) - MeanIA3_4x))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal (MaxIA4_4x - (MaxIA4 - IA4)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - IA4)) - MeanIA4_4x))
while [IA4_mother < MinIA4_4x or IA4_mother > MaxIA4_4x] [set IA4_mother random-normal (MaxIA4_4x - (MaxIA4 - IA4)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - IA4)) - MeanIA4_4x))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4_4x / 2) - abs (([IA4] of mate) - MeanIA4_4x))
while [IA4_father < MinIA4_4x or IA4_father > MaxIA4_4x] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4_4x / 2) - abs (([IA4] of mate) - MeanIA4_4x))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal (MaxIA5_4x - (MaxIA5 - IA5)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - IA5)) - MeanIA5_4x))
while [IA5_mother < MinIA5_4x or IA5_mother > MaxIA5_4x] [set IA5_mother random-normal (MaxIA5_4x - (MaxIA5 - IA5)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - IA5)) - MeanIA5_4x))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5_4x / 2) - abs (([IA5] of mate) - MeanIA5_4x))
while [IA5_father < MinIA5_4x or IA5_father > MaxIA5_4x] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5_4x / 2) - abs (([IA5] of mate) - MeanIA5_4x))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]]
[;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))
while [IA1_mother < MinIA1 or IA1_mother > MaxIA1] [set IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))]
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))
while [IA1_father < MinIA1 or IA1_father > MaxIA1] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))
while [IA2_mother < MinIA2 or IA2_mother > MaxIA2] [set IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))
while [IA2_father < MinIA2 or IA2_father > MaxIA2] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))
while [IA3_mother < MinIA3 or IA3_mother > MaxIA3] [set IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))
while [IA3_father < MinIA3 or IA3_father > MaxIA3] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))
while [IA4_mother < MinIA4 or IA4_mother > MaxIA4] [set IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))
while [IA4_father < MinIA4 or IA4_father > MaxIA4] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))
while [IA5_mother < MinIA5 or IA5_mother > MaxIA5] [set IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))
while [IA5_father < MinIA5 or IA5_father > MaxIA5] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10
]]]]]]
end
to reproduce-tetraploids
repeat offspring [
let where patch-at-heading-and-distance (random 360) ((random-exponential 0.5) + 1)
if where != NOBODY [if [count turtles-here] of where = 0 and [area] of where = true [
ifelse random-float 100 < Apomixis_potential_4x ;Depending on the potential for apomixis (ovule), one reproductive mode or the other will be selected.
[let mate []
ifelse random-float 100 > Self_pollination_4x [set mate one-of other Plants with [Age != 0] in-radius precision ((random-exponential 1) + 1) 1]
[set mate self]
if mate != NOBODY [
hatch (1) [
;Pollen: Here Pseudogamous Apomixis is considered, therefore pollen viability is considered.
if ([cytotype] of mate = "2x") and random-float 100 > Male_Gametes_Viability_2x [die]
if ([cytotype] of mate = "3x") and random-float 100 > Male_Gametes_Viability_3x [die]
if ([cytotype] of mate = "4x") and random-float 100 > Male_Gametes_Viability_4x [die]
;Ovule.
if random-float 100 > Female_Gametes_Viability_4x [die]
;Seed.
if random-float 100 > Tetraploid_Seed_viability [die]
set Origin "4x_Apx"
set partner "Apomixis"
set E_mother_SPE (Precision (E_Total) 2)
move-to where
set age 0
]]]
[let mate []
ifelse random-float 100 > Self_pollination_4x [set mate one-of other Plants with [Age != 0] in-radius precision ((random-exponential 1) + 1) 1]
[set mate self]
if mate != NOBODY [
hatch (1) [
let ovule "x"
let pollen "x"
;Pollen
if ([cytotype] of mate = "2x") [
ifelse random-float 100 < Unreduced_male_gametes_Plants_2x [ifelse random-float 100 > Male_Gametes_Viability_2x [die] [set pollen "(2x)"]]
[ifelse random-float 100 > Male_Gametes_Viability_2x [die] [set pollen "(x)"]]]
if ([cytotype] of mate = "3x") [
ifelse random-float 100 > Male_Gametes_Viability_3x [die] [
let which_gamete ((random (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x)) + 1)
if which_gamete <= (Reduced_x_gametes_Plant_3x) [set pollen "(x)"]
if which_gamete > (Reduced_x_gametes_Plant_3x) and which_gamete <= (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x) [set pollen "(2x)"]
if which_gamete > (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x) and which_gamete <= (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x) [set pollen "(3x)"]]]
if ([cytotype] of mate = "4x") [
ifelse random-float 100 > Male_Gametes_Viability_4x [die]
[set pollen "(2x)"]]
;Ovule
ifelse random-float 100 > Female_Gametes_Viability_4x [die]
[set ovule "(2x)"]
let letters word ovule pollen
if letters = "(2x)(3x)" [die]
;Seed.
if letters = "(2x)(2x)" [
if random-float 100 > Tetraploid_Seed_viability [die]
set cytotype "4x"
if ([cytotype] of mate = "2x") [set partner "Other" set Origin "Gamete(n=2x)Mother(2n=4x)+Gamete(2n=2x)Father(2n=2x)" set E_mother_SPE (Precision (E_Total) 2)]
if ([cytotype] of mate = "4x") [ifelse mate = myself [set partner "Selfing"] [set partner "Other"] set Origin "Gamete(n=2x)Mother(2n=4x)+Gamete(n=2x)Father(2n=4x)" set E_mother_SPE (Precision (E_Total) 2)]
if ([cytotype] of mate = "3x") [set partner "Other" set Origin "Gamete(n=2x)Mother(2n=4x)+Gamete(n=2x)Father(2n=3x)" set E_mother_SPE (Precision (E_Total) 2)]]
if letters = "(2x)(x)" [
if random-float 100 > Triploid_Seed_viability [die]
set cytotype "3x"
if ([cytotype] of mate = "2x") [set partner "Other" set Origin "Gamete(n=2x)Mother(2n=4x)+Gamete(n=x)Father(2n=2x)" set E_mother_SPE (Precision (E_Total) 2)]
if ([cytotype] of mate = "3x") [set partner "Other" set Origin "Gamete(n=2x)Mother(2n=4x)+Gamete(n=x)Father(2n=3x)" set E_mother_SPE (Precision (E_Total) 2)]]
move-to where
set age 0
ifelse Different_optimum_4x? [
if cytotype = "3x" [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal (MaxIA1 - (MaxIA1_4x - IA1)) abs ((RangeIA1 / 2) - abs ((MaxIA1 - (MaxIA1_4x - IA1)) - MeanIA1))
while [IA1_mother < MinIA1 or IA1_mother > MaxIA1] [set IA1_mother random-normal (MaxIA1 - (MaxIA1_4x - IA1)) abs ((RangeIA1 / 2) - abs ((MaxIA1 - (MaxIA1_4x - IA1)) - MeanIA1))]
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))
while [IA1_father < MinIA1 or IA1_father > MaxIA1] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal (MaxIA2 - (MaxIA2_4x - IA2)) abs ((RangeIA2 / 2) - abs ((MaxIA2 - (MaxIA2_4x - IA2)) - MeanIA2))
while [IA2_mother < MinIA2 or IA2_mother > MaxIA2] [set IA2_mother random-normal (MaxIA2 - (MaxIA2_4x - IA2)) abs ((RangeIA2 / 2) - abs ((MaxIA2 - (MaxIA2_4x - IA2)) - MeanIA2))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))
while [IA2_father < MinIA2 or IA2_father > MaxIA2] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal (MaxIA3 - (MaxIA3_4x - IA3)) abs ((RangeIA3 / 2) - abs ((MaxIA3 - (MaxIA3_4x - IA3)) - MeanIA3))
while [IA3_mother < MinIA3 or IA3_mother > MaxIA3] [set IA3_mother random-normal (MaxIA3 - (MaxIA3_4x - IA3)) abs ((RangeIA3 / 2) - abs ((MaxIA3 - (MaxIA3_4x - IA3)) - MeanIA3))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))
while [IA3_father < MinIA3 or IA3_father > MaxIA3] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal (MaxIA4 - (MaxIA4_4x - IA4)) abs ((RangeIA4 / 2) - abs ((MaxIA4 - (MaxIA4_4x - IA4)) - MeanIA4))
while [IA4_mother < MinIA4 or IA4_mother > MaxIA4] [set IA4_mother random-normal (MaxIA4 - (MaxIA4_4x - IA4)) abs ((RangeIA4 / 2) - abs ((MaxIA4 - (MaxIA4_4x - IA4)) - MeanIA4))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))
while [IA4_father < MinIA4 or IA4_father > MaxIA4] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal (MaxIA5 - (MaxIA5_4x - IA5)) abs ((RangeIA5 / 2) - abs ((MaxIA5 - (MaxIA5_4x - IA5)) - MeanIA5))
while [IA5_mother < MinIA5 or IA5_mother > MaxIA5] [set IA5_mother random-normal (MaxIA5 - (MaxIA5_4x - IA5)) abs ((RangeIA5 / 2) - abs ((MaxIA5 - (MaxIA5_4x - IA5)) - MeanIA5))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))
while [IA5_father < MinIA5 or IA5_father > MaxIA5] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]
if cytotype = "4x" and (([cytotype] of mate = "2x") or ([cytotype] of mate = "3x")) [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1_4x / 2) - abs (IA1 - MeanIA1_4x))
while [IA1_mother < MinIA1_4x or IA1_mother > MaxIA1_4x] [set IA1_mother random-normal IA1 abs ((RangeIA1_4x / 2) - abs (IA1 - MeanIA1_4x))]
let IA1_father random-normal (MaxIA1_4x - (MaxIA1 - [IA1] of mate)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - [IA1] of mate)) - MeanIA1_4x))
while [IA1_father < MinIA1_4x or IA1_father > MaxIA1_4x] [set IA1_father random-normal (MaxIA1_4x - (MaxIA1 - [IA1] of mate)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - [IA1] of mate)) - MeanIA1_4x))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal IA2 abs ((RangeIA2_4x / 2) - abs (IA2 - MeanIA2_4x))
while [IA2_mother < MinIA2_4x or IA2_mother > MaxIA2_4x] [set IA2_mother random-normal IA2 abs ((RangeIA2_4x / 2) - abs (IA2 - MeanIA2_4x))]
let IA2_father random-normal (MaxIA2_4x - (MaxIA2 - [IA2] of mate)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - [IA2] of mate)) - MeanIA2_4x))
while [IA2_father < MinIA2_4x or IA2_father > MaxIA2_4x] [set IA2_father random-normal (MaxIA2_4x - (MaxIA2 - [IA2] of mate)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - [IA2] of mate)) - MeanIA2_4x))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3_4x / 2) - abs (IA3 - MeanIA3_4x))
while [IA3_mother < MinIA3_4x or IA3_mother > MaxIA3_4x] [set IA3_mother random-normal IA3 abs ((RangeIA3_4x / 2) - abs (IA3 - MeanIA3_4x))]
let IA3_father random-normal (MaxIA3_4x - (MaxIA3 - [IA3] of mate)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - [IA3] of mate)) - MeanIA3_4x))
while [IA3_father < MinIA3_4x or IA3_father > MaxIA3_4x] [set IA3_father random-normal (MaxIA3_4x - (MaxIA3 - [IA3] of mate)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - [IA3] of mate)) - MeanIA3_4x))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4_4x / 2) - abs (IA4 - MeanIA4_4x))
while [IA4_mother < MinIA4_4x or IA4_mother > MaxIA4_4x] [set IA4_mother random-normal IA4 abs ((RangeIA4_4x / 2) - abs (IA4 - MeanIA4_4x))]
let IA4_father random-normal (MaxIA4_4x - (MaxIA4 - [IA4] of mate)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - [IA4] of mate)) - MeanIA4_4x))
while [IA4_father < MinIA4_4x or IA4_father > MaxIA4_4x] [set IA4_father random-normal (MaxIA4_4x - (MaxIA4 - [IA4] of mate)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - [IA4] of mate)) - MeanIA4_4x))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5_4x / 2) - abs (IA5 - MeanIA5_4x))
while [IA5_mother < MinIA5_4x or IA5_mother > MaxIA5_4x] [set IA5_mother random-normal IA5 abs ((RangeIA5_4x / 2) - abs (IA5 - MeanIA5_4x))]
let IA5_father random-normal (MaxIA5_4x - (MaxIA5 - [IA5] of mate)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - [IA5] of mate)) - MeanIA5_4x))
while [IA5_father < MinIA5_4x or IA5_father > MaxIA5_4x] [set IA5_father random-normal (MaxIA5_4x - (MaxIA5 - [IA5] of mate)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - [IA5] of mate)) - MeanIA5_4x))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]
if cytotype = "4x" and ([cytotype] of mate = "4x") [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1_4x / 2) - abs (IA1 - MeanIA1_4x))
while [IA1_mother < MinIA1_4x or IA1_mother > MaxIA1_4x] [set IA1_mother random-normal IA1 abs ((RangeIA1_4x / 2) - abs (IA1 - MeanIA1_4x))]
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1_4x / 2) - abs (([IA1] of mate) - MeanIA1_4x))
while [IA1_father < MinIA1_4x or IA1_father > MaxIA1_4x] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1_4x / 2) - abs (([IA1] of mate) - MeanIA1_4x))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal IA2 abs ((RangeIA2_4x / 2) - abs (IA2 - MeanIA2_4x))
while [IA2_mother < MinIA2_4x or IA2_mother > MaxIA2_4x] [set IA2_mother random-normal IA2 abs ((RangeIA2_4x / 2) - abs (IA2 - MeanIA2_4x))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2_4x / 2) - abs (([IA2] of mate) - MeanIA2_4x))
while [IA2_father < MinIA2_4x or IA2_father > MaxIA2_4x] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2_4x / 2) - abs (([IA2] of mate) - MeanIA2_4x))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3_4x / 2) - abs (IA3 - MeanIA3_4x))
while [IA3_mother < MinIA3_4x or IA3_mother > MaxIA3_4x] [set IA3_mother random-normal IA3 abs ((RangeIA3_4x / 2) - abs (IA3 - MeanIA3_4x))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3_4x / 2) - abs (([IA3] of mate) - MeanIA3_4x))
while [IA3_father < MinIA3_4x or IA3_father > MaxIA3_4x] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3_4x / 2) - abs (([IA3] of mate) - MeanIA3_4x))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4_4x / 2) - abs (IA4 - MeanIA4_4x))
while [IA4_mother < MinIA4_4x or IA4_mother > MaxIA4_4x] [set IA4_mother random-normal IA4 abs ((RangeIA4_4x / 2) - abs (IA4 - MeanIA4_4x))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4_4x / 2) - abs (([IA4] of mate) - MeanIA4_4x))
while [IA4_father < MinIA4_4x or IA4_father > MaxIA4_4x] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4_4x / 2) - abs (([IA4] of mate) - MeanIA4_4x))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5_4x / 2) - abs (IA5 - MeanIA5_4x))
while [IA5_mother < MinIA5_4x or IA5_mother > MaxIA5_4x] [set IA5_mother random-normal IA5 abs ((RangeIA5_4x / 2) - abs (IA5 - MeanIA5_4x))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5_4x / 2) - abs (([IA5] of mate) - MeanIA5_4x))
while [IA5_father < MinIA5_4x or IA5_father > MaxIA5_4x] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5_4x / 2) - abs (([IA5] of mate) - MeanIA5_4x))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]]
[;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))
while [IA1_mother < MinIA1 or IA1_mother > MaxIA1] [set IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))]
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))
while [IA1_father < MinIA1 or IA1_father > MaxIA1] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))
while [IA2_mother < MinIA2 or IA2_mother > MaxIA2] [set IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))
while [IA2_father < MinIA2 or IA2_father > MaxIA2] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))
while [IA3_mother < MinIA3 or IA3_mother > MaxIA3] [set IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))
while [IA3_father < MinIA3 or IA3_father > MaxIA3] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))
while [IA4_mother < MinIA4 or IA4_mother > MaxIA4] [set IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))
while [IA4_father < MinIA4 or IA4_father > MaxIA4] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))
while [IA5_mother < MinIA5 or IA5_mother > MaxIA5] [set IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))
while [IA5_father < MinIA5 or IA5_father > MaxIA5] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10
]]]]]]]
end
to reproduce-triploids
repeat offspring [
let where patch-at-heading-and-distance (random 360) ((random-exponential 0.5) + 1)
if where != NOBODY [if [count turtles-here] of where = 0 and [area] of where = true [
let mate []
ifelse random-float 100 > Self_pollination_3x [set mate one-of other Plants with [Age != 0] in-radius precision ((random-exponential 1) + 1) 1]
[set mate self]
if mate != NOBODY [
hatch (1) [
let ovule "x"
let pollen "x"
;Pollen.
if ([cytotype] of mate = "2x") [
ifelse random-float 100 < Unreduced_male_gametes_Plants_2x [ifelse random-float 100 > Male_Gametes_Viability_2x [die] [set pollen "(2x)"]]
[ifelse random-float 100 > Male_Gametes_Viability_2x [die] [set pollen "(x)"]]]
if ([cytotype] of mate = "3x") [
ifelse random-float 100 > Male_Gametes_Viability_3x [die] [
let which_gamete ((random (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x)) + 1)
if which_gamete <= (Reduced_x_gametes_Plant_3x) [set pollen "(x)"]
if which_gamete > (Reduced_x_gametes_Plant_3x) and which_gamete <= (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x) [set pollen "(2x)"]
if which_gamete > (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x) and which_gamete <= (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x) [set pollen "(3x)"]]]
if ([cytotype] of mate = "4x") [
ifelse random-float 100 > Male_Gametes_Viability_4x [die]
[set pollen "(2x)"]]
;Ovule.
ifelse random-float 100 > Female_Gametes_Viability_3x [die] [
let which_gamete ((random (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x)) + 1)
if which_gamete <= (Reduced_x_gametes_Plant_3x) [set ovule "(x)"]
if which_gamete > (Reduced_x_gametes_Plant_3x) and which_gamete <= (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x) [set ovule "(2x)"]
if which_gamete > (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x) and which_gamete <= (Reduced_x_gametes_Plant_3x + Reduced_2x_gametes_Plant_3x + Unreduced_gametes_Plant_3x) [set ovule "(3x)"]]
let letters word ovule pollen
if letters = "(2x)(3x)" [die]
if letters = "(3x)(2x)" [die]
if letters = "(3x)(3x)" [die]
if letters = "(x)(3x)" [set letters "(2x)(2x)"]
if letters = "(3x)(x)" [set letters "(2x)(2x)"]
;Seed
if letters = "(x)(x)" [
if random-float 100 > Diploid_Seed_viability [die]
set cytotype "2x"
if ([cytotype] of mate = "2x") [set partner "Other" set Origin "Gamete(n=x)Mother(2n=3x)+Gamete(n=x)Father(2n=2x)" set ID "No ID" set E_mother_SPE (Precision (E_Total) 2)]
if ([cytotype] of mate = "3x") [ifelse mate = myself [set partner "Selfing"] [set partner "Other"] set Origin "Gamete(n=x)Mother(2n=3x)+Gamete(n=x)Father(2n=3x)" set ID "No ID" set E_mother_SPE (Precision (E_Total) 2)]]
if letters = "(2x)(2x)" [
if random-float 100 > Tetraploid_Seed_viability [die]
set cytotype "4x"
if ([cytotype] of mate = "2x") [set partner "Other" ifelse pollen = "(2x)" [set Origin "Gamete(n=2x)Mother(2n=3x)+Gamete(2n=2x)Father(2n=2x)"] [set Origin "Gamete(2n=3x)Mother(2n=3x)+Gamete(n=x)Father(2n=2x)"] set E_mother_SPE (Precision (E_Total) 2)]
if ([cytotype] of mate = "4x") [set partner "Other" set Origin "Gamete(n=2x)Mother(2n=3x)+Gamete(n=2x)Father(2n=4x)" set E_mother_SPE (Precision (E_Total) 2)]
if ([cytotype] of mate = "3x") [ifelse mate = myself [set partner "Selfing"] [set partner "Other"] ifelse pollen = "(3x)" [set Origin "Gamete(n=x)Mother(2n=3x)+Gamete(2n=3x)Father(2n=3x)"] [ifelse pollen = "(2x)" [set Origin "Gamete(n=2x)Mother(2n=3x)+Gamete(n=2x)Father(2n=3x)"] [set Origin "Gamete(2n=3x)Mother(2n=3x)+Gamete(n=x)Father(2n=3x)"]] set E_mother_SPE (Precision (E_Total) 2)]]
;set ID who set E_mother_SPE (Precision (E_Total) 2) set Counted FALSE] set ID "No ID"
;set ID ([ID] of mate) set E_mother_SPE (Precision (E_Total) 2) set Counted ([Counted] of mate)
if letters = "(x)(2x)" or letters = "(2x)(x)" [
if random-float 100 > Triploid_Seed_viability [die]
set cytotype "3x"
if ([cytotype] of mate = "2x") [set partner "Other" ifelse pollen = "(2x)" [set Origin "Gamete(n=x)Mother(2n=3x)+Gamete(2n=2x)Father(2n=2x)"] [set Origin "Gamete(n=2x)Mother(2n=3x)+Gamete(n=x)Father(2n=2x)"] set E_mother_SPE (Precision (E_Total) 2)]
if ([cytotype] of mate = "4x") [set partner "Other" set Origin "Gamete(n=x)Mother(2n=3x)+Gamete(n=2x)Father(2n=4x)" set E_mother_SPE (Precision (E_Total) 2)]
if ([cytotype] of mate = "3x") [ifelse mate = myself [set partner "Selfing"] [set partner "Other"] ifelse pollen = "(2x)" [set Origin "Gamete(n=x)Mother(2n=3x)+Gamete(n=2x)Father(2n=3x)"] [set Origin "Gamete(n=2x)Mother(2n=3x)+Gamete(n=x)Father(2n=3x)"] set E_mother_SPE (Precision (E_Total) 2)]]
move-to where
set age 0
ifelse Different_optimum_4x? [
if cytotype = "2x" or (cytotype = "3x" and (([cytotype] of mate = "2x") or ([cytotype] of mate = "3x"))) [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))
while [IA1_mother < MinIA1 or IA1_mother > MaxIA1] [set IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))]
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))
while [IA1_father < MinIA1 or IA1_father > MaxIA1] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))
while [IA2_mother < MinIA2 or IA2_mother > MaxIA2] [set IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))
while [IA2_father < MinIA2 or IA2_father > MaxIA2] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))
while [IA3_mother < MinIA3 or IA3_mother > MaxIA3] [set IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))
while [IA3_father < MinIA3 or IA3_father > MaxIA3] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))
while [IA4_mother < MinIA4 or IA4_mother > MaxIA4] [set IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))
while [IA4_father < MinIA4 or IA4_father > MaxIA4] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))
while [IA5_mother < MinIA5 or IA5_mother > MaxIA5] [set IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))
while [IA5_father < MinIA5 or IA5_father > MaxIA5] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]
if cytotype = "3x" and ([cytotype] of mate = "4x") [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))
while [IA1_mother < MinIA1 or IA1_mother > MaxIA1] [set IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))]
let IA1_father random-normal (MaxIA1 - (MaxIA1_4x - [IA1] of mate)) abs ((RangeIA1 / 2) - abs ((MaxIA1 - (MaxIA1_4x - [IA1] of mate)) - MeanIA1))
while [IA1_father < MinIA1 or IA1_father > MaxIA1] [set IA1_father random-normal (MaxIA1 - (MaxIA1_4x - [IA1] of mate)) abs ((RangeIA1 / 2) - abs ((MaxIA1 - (MaxIA1_4x - [IA1] of mate)) - MeanIA1))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))
while [IA2_mother < MinIA2 or IA2_mother > MaxIA2] [set IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))]
let IA2_father random-normal (MaxIA2 - (MaxIA2_4x - [IA2] of mate)) abs ((RangeIA2 / 2) - abs ((MaxIA2 - (MaxIA2_4x - [IA2] of mate)) - MeanIA2))
while [IA2_father < MinIA2 or IA2_father > MaxIA2] [set IA2_father random-normal (MaxIA2 - (MaxIA2_4x - [IA2] of mate)) abs ((RangeIA2 / 2) - abs ((MaxIA2 - (MaxIA2_4x - [IA2] of mate)) - MeanIA2))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))
while [IA3_mother < MinIA3 or IA3_mother > MaxIA3] [set IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))]
let IA3_father random-normal (MaxIA3 - (MaxIA3_4x - [IA3] of mate)) abs ((RangeIA3 / 2) - abs ((MaxIA3 - (MaxIA3_4x - [IA3] of mate)) - MeanIA3))
while [IA3_father < MinIA3 or IA3_father > MaxIA3] [set IA3_father random-normal (MaxIA3 - (MaxIA3_4x - [IA3] of mate)) abs ((RangeIA3 / 2) - abs ((MaxIA3 - (MaxIA3_4x - [IA3] of mate)) - MeanIA3))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))
while [IA4_mother < MinIA4 or IA4_mother > MaxIA4] [set IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))]
let IA4_father random-normal (MaxIA4 - (MaxIA4_4x - [IA4] of mate)) abs ((RangeIA4 / 2) - abs ((MaxIA4 - (MaxIA4_4x - [IA4] of mate)) - MeanIA4))
while [IA4_father < MinIA4 or IA4_father > MaxIA4] [set IA4_father random-normal (MaxIA4 - (MaxIA4_4x - [IA4] of mate)) abs ((RangeIA4 / 2) - abs ((MaxIA4 - (MaxIA4_4x - [IA4] of mate)) - MeanIA4))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))
while [IA5_mother < MinIA5 or IA5_mother > MaxIA5] [set IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))]
let IA5_father random-normal (MaxIA5 - (MaxIA5_4x - [IA5] of mate)) abs ((RangeIA5 / 2) - abs ((MaxIA5 - (MaxIA5_4x - [IA5] of mate)) - MeanIA5))
while [IA5_father < MinIA5 or IA5_father > MaxIA5] [set IA5_father random-normal (MaxIA5 - (MaxIA5_4x - [IA5] of mate)) abs ((RangeIA5 / 2) - abs ((MaxIA5 - (MaxIA5_4x - [IA5] of mate)) - MeanIA5))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]
if cytotype = "4x" and (([cytotype] of mate = "2x") or ([cytotype] of mate = "3x")) [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal (MaxIA1_4x - (MaxIA1 - IA1)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - IA1)) - MeanIA1_4x))
while [IA1_mother < MinIA1_4x or IA1_mother > MaxIA1_4x] [set IA1_mother random-normal (MaxIA1_4x - (MaxIA1 - IA1)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - IA1)) - MeanIA1_4x))]
let IA1_father random-normal (MaxIA1_4x - (MaxIA1 - [IA1] of mate)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - [IA1] of mate)) - MeanIA1_4x))
while [IA1_father < MinIA1_4x or IA1_father > MaxIA1_4x] [set IA1_father random-normal (MaxIA1_4x - (MaxIA1 - [IA1] of mate)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - [IA1] of mate)) - MeanIA1_4x))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal (MaxIA2_4x - (MaxIA2 - IA2)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - IA2)) - MeanIA2_4x))
while [IA2_mother < MinIA2_4x or IA2_mother > MaxIA2_4x] [set IA2_mother random-normal (MaxIA2_4x - (MaxIA2 - IA2)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - IA2)) - MeanIA2_4x))]
let IA2_father random-normal (MaxIA2_4x - (MaxIA2 - [IA2] of mate)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - [IA2] of mate)) - MeanIA2_4x))
while [IA2_father < MinIA2_4x or IA2_father > MaxIA2_4x] [set IA2_father random-normal (MaxIA2_4x - (MaxIA2 - [IA2] of mate)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - [IA2] of mate)) - MeanIA2_4x))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal (MaxIA3_4x - (MaxIA3 - IA3)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - IA3)) - MeanIA3_4x))
while [IA3_mother < MinIA3_4x or IA3_mother > MaxIA3_4x] [set IA3_mother random-normal (MaxIA3_4x - (MaxIA3 - IA3)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - IA3)) - MeanIA3_4x))]
let IA3_father random-normal (MaxIA3_4x - (MaxIA3 - [IA3] of mate)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - [IA3] of mate)) - MeanIA3_4x))
while [IA3_father < MinIA3_4x or IA3_father > MaxIA3_4x] [set IA3_father random-normal (MaxIA3_4x - (MaxIA3 - [IA3] of mate)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - [IA3] of mate)) - MeanIA3_4x))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal (MaxIA4_4x - (MaxIA4 - IA4)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - IA4)) - MeanIA4_4x))
while [IA4_mother < MinIA4_4x or IA4_mother > MaxIA4_4x] [set IA4_mother random-normal (MaxIA4_4x - (MaxIA4 - IA4)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - IA4)) - MeanIA4_4x))]
let IA4_father random-normal (MaxIA4_4x - (MaxIA4 - [IA4] of mate)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - [IA4] of mate)) - MeanIA4_4x))
while [IA4_father < MinIA4_4x or IA4_father > MaxIA4_4x] [set IA4_father random-normal (MaxIA4_4x - (MaxIA4 - [IA4] of mate)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - [IA4] of mate)) - MeanIA4_4x))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal (MaxIA5_4x - (MaxIA5 - IA5)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - IA5)) - MeanIA5_4x))
while [IA5_mother < MinIA5_4x or IA5_mother > MaxIA5_4x] [set IA5_mother random-normal (MaxIA5_4x - (MaxIA5 - IA5)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - IA5)) - MeanIA5_4x))]
let IA5_father random-normal (MaxIA5_4x - (MaxIA5 - [IA5] of mate)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - [IA5] of mate)) - MeanIA5_4x))
while [IA5_father < MinIA5_4x or IA5_father > MaxIA5_4x] [set IA5_father random-normal (MaxIA5_4x - (MaxIA5 - [IA5] of mate)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - [IA5] of mate)) - MeanIA5_4x))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]
if cytotype = "4x" and ([cytotype] of mate = "4x") [
;Atmospheric offspring’s adaptivity
let IA1_mother random-normal (MaxIA1_4x - (MaxIA1 - IA1)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - IA1)) - MeanIA1_4x))
while [IA1_mother < MinIA1_4x or IA1_mother > MaxIA1_4x] [set IA1_mother random-normal (MaxIA1_4x - (MaxIA1 - IA1)) abs ((RangeIA1_4x / 2) - abs ((MaxIA1_4x - (MaxIA1 - IA1)) - MeanIA1_4x))]
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1_4x / 2) - abs (([IA1] of mate) - MeanIA1_4x))
while [IA1_father < MinIA1_4x or IA1_father > MaxIA1_4x] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1_4x / 2) - abs (([IA1] of mate) - MeanIA1_4x))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal (MaxIA2_4x - (MaxIA2 - IA2)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - IA2)) - MeanIA2_4x))
while [IA2_mother < MinIA2_4x or IA2_mother > MaxIA2_4x] [set IA2_mother random-normal (MaxIA2_4x - (MaxIA2 - IA2)) abs ((RangeIA2_4x / 2) - abs ((MaxIA2_4x - (MaxIA2 - IA2)) - MeanIA2_4x))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2_4x / 2) - abs (([IA2] of mate) - MeanIA2_4x))
while [IA2_father < MinIA2_4x or IA2_father > MaxIA2_4x] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2_4x / 2) - abs (([IA2] of mate) - MeanIA2_4x))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal (MaxIA3_4x - (MaxIA3 - IA3)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - IA3)) - MeanIA3_4x))
while [IA3_mother < MinIA3_4x or IA3_mother > MaxIA3_4x] [set IA3_mother random-normal (MaxIA3_4x - (MaxIA3 - IA3)) abs ((RangeIA3_4x / 2) - abs ((MaxIA3_4x - (MaxIA3 - IA3)) - MeanIA3_4x))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3_4x / 2) - abs (([IA3] of mate) - MeanIA3_4x))
while [IA3_father < MinIA3_4x or IA3_father > MaxIA3_4x] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3_4x / 2) - abs (([IA3] of mate) - MeanIA3_4x))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal (MaxIA4_4x - (MaxIA4 - IA4)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - IA4)) - MeanIA4_4x))
while [IA4_mother < MinIA4_4x or IA4_mother > MaxIA4_4x] [set IA4_mother random-normal (MaxIA4_4x - (MaxIA4 - IA4)) abs ((RangeIA4_4x / 2) - abs ((MaxIA4_4x - (MaxIA4 - IA4)) - MeanIA4_4x))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4_4x / 2) - abs (([IA4] of mate) - MeanIA4_4x))
while [IA4_father < MinIA4_4x or IA4_father > MaxIA4_4x] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4_4x / 2) - abs (([IA4] of mate) - MeanIA4_4x))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal (MaxIA5_4x - (MaxIA5 - IA5)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - IA5)) - MeanIA5_4x))
while [IA5_mother < MinIA5_4x or IA5_mother > MaxIA5_4x] [set IA5_mother random-normal (MaxIA5_4x - (MaxIA5 - IA5)) abs ((RangeIA5_4x / 2) - abs ((MaxIA5_4x - (MaxIA5 - IA5)) - MeanIA5_4x))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5_4x / 2) - abs (([IA5] of mate) - MeanIA5_4x))
while [IA5_father < MinIA5_4x or IA5_father > MaxIA5_4x] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5_4x / 2) - abs (([IA5] of mate) - MeanIA5_4x))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10]]
[;Atmospheric offspring’s adaptivity
let IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))
while [IA1_mother < MinIA1 or IA1_mother > MaxIA1] [set IA1_mother random-normal IA1 abs ((RangeIA1 / 2) - abs (IA1 - MeanIA1))]
let IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))
while [IA1_father < MinIA1 or IA1_father > MaxIA1] [set IA1_father random-normal ([IA1] of mate) abs ((RangeIA1 / 2) - abs (([IA1] of mate) - MeanIA1))]
set IA1 precision ((IA1_mother + IA1_father) / 2) 10
let IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))
while [IA2_mother < MinIA2 or IA2_mother > MaxIA2] [set IA2_mother random-normal IA2 abs ((RangeIA2 / 2) - abs (IA2 - MeanIA2))]
let IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))
while [IA2_father < MinIA2 or IA2_father > MaxIA2] [set IA2_father random-normal ([IA2] of mate) abs ((RangeIA2 / 2) - abs (([IA2] of mate) - MeanIA2))]
set IA2 precision ((IA2_mother + IA2_father) / 2) 10
let IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))
while [IA3_mother < MinIA3 or IA3_mother > MaxIA3] [set IA3_mother random-normal IA3 abs ((RangeIA3 / 2) - abs (IA3 - MeanIA3))]
let IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))
while [IA3_father < MinIA3 or IA3_father > MaxIA3] [set IA3_father random-normal ([IA3] of mate) abs ((RangeIA3 / 2) - abs (([IA3] of mate) - MeanIA3))]
set IA3 precision ((IA3_mother + IA3_father) / 2) 10
;Soil offspring’s adaptivity
let IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))
while [IA4_mother < MinIA4 or IA4_mother > MaxIA4] [set IA4_mother random-normal IA4 abs ((RangeIA4 / 2) - abs (IA4 - MeanIA4))]
let IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))
while [IA4_father < MinIA4 or IA4_father > MaxIA4] [set IA4_father random-normal ([IA4] of mate) abs ((RangeIA4 / 2) - abs (([IA4] of mate) - MeanIA4))]
set IA4 precision ((IA4_mother + IA4_father) / 2) 10
let IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))
while [IA5_mother < MinIA5 or IA5_mother > MaxIA5] [set IA5_mother random-normal IA5 abs ((RangeIA5 / 2) - abs (IA5 - MeanIA5))]
let IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))
while [IA5_father < MinIA5 or IA5_father > MaxIA5] [set IA5_father random-normal ([IA5] of mate) abs ((RangeIA5 / 2) - abs (([IA5] of mate) - MeanIA5))]
set IA5 precision ((IA5_mother + IA5_father) / 2) 10
]]]]]]
end
to output
;Bilateral
set Bilateral_polyploidization (Bilateral_polyploidization + (count (Plants with [Origin = "Gamete(2n=2x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)"])))
;Unilateral
set Unilateral_polyploidization (Unilateral_polyploidization + (count (Plants with [Origin = "Gamete(n=x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)"]) +
count (Plants with [Origin = "Gamete(2n=2x)Mother(2n=2x)+Gamete(n=x)Father(2n=2x)"])))
ask (Plants with [Origin = "Gamete(2n=2x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)" or
Origin = "Gamete(n=x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)" or
Origin = "Gamete(2n=2x)Mother(2n=2x)+Gamete(n=x)Father(2n=2x)"]) [
let Surrounding_2x_Plants turtles-on neighbors
set Surrounding_2x_Plants (Surrounding_2x_Plants with [cytotype = "2x"])
ifelse (count Surrounding_2x_Plants > 0) [set E_Surround_SPE (Precision (mean ([E_Total] of Surrounding_2x_Plants)) 2)][set E_Surround_SPE ""]
Edit_E_Total]
if Counter = 1 and Generation = 1 [
file-print (word "Brackets" ";"
"Origin" ";"
"Counter_who" ";"
"Cytotype_who" ";"
"xcor" ";"
"ycor" ";"
"Counter_ID" ";"
"E" ";"
"Mother_E" ";"
"Surrounding_2x_E" ";"
"Bilateral_polyploidization" ";"
"Unilateral_polyploidization" ";"
"Prop_4x" ";"
"Number_of_Plants" ";"
"Counter" ";"
"Generation")]
;The Polyploidization Event:
if Generation <= 1200 and (count (Plants with [Origin = "Gamete(2n=2x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)"]) +
count (Plants with [Origin = "Gamete(n=x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)"]) +
count (Plants with [Origin = "Gamete(2n=2x)Mother(2n=2x)+Gamete(n=x)Father(2n=2x)"])) > 0 [
file-print [(word
";"
Origin ";"
Counter "_" who ";"
cytotype ";"
xcor ";"
ycor ";"
";"
(Precision (E_Total) 2) ";"
E_mother_SPE ";"
E_Surround_SPE ";"
";"
";"
(Precision ((count (Plants with [cytotype = "4x"])) / (count Plants)) 3) ";"
count turtles ";"
Counter ";"
(Generation - 200)
"\n")] of Plants with [Origin = "Gamete(2n=2x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)" or
Origin = "Gamete(n=x)Mother(2n=2x)+Gamete(2n=2x)Father(2n=2x)" or
Origin = "Gamete(2n=2x)Mother(2n=2x)+Gamete(n=x)Father(2n=2x)"]]
;The tetraploid population with n(ID) > 50
ask (Plants with [ID != "No ID" and Counted = FALSE]) [set ID_Count (count (Plants with [ID = [ID] of myself and cytotype = "4x" and Counted = FALSE]))]
ask (Plants with [cytotype = "4x" and ID_Count > 50 and Counted = FALSE]) [set ID_Fitness Precision (mean [E_Total] of (Plants with [ID = [ID] of myself and cytotype = "4x" and Counted = FALSE])) 3]
let ID_List ([ID] of (Plants with [ID_Count > 50]))
set ID_List remove-duplicates ID_List
let ID_List_TRUE filter [ x -> not member? x ID_total ] ID_List
while [length ID_List_TRUE > 0] [
let ID_selected one-of ID_List_TRUE
set ID_total lput ID_selected ID_total
set ID_List_TRUE remove ID_selected ID_List_TRUE
Let turtle_selected one-of (Plants with [cytotype = "4x" and ID = ID_selected])
set who_list lput turtle_selected who_list
set who_agentset turtle-set who_list]
if Generation <= 1200 and length who_list > 0 [
file-print [(word
";"
";"
";"
cytotype ";"
";"
";"
Counter "_" ID ";"
ID_Fitness ";"
";"
";"
";"
";"
";"
";"
Counter ";"
(Generation - 200)
"\n")] of who_agentset]
ask Plants with [ID_Count > 50] [set Counted TRUE]
;Generation 1200 (1000 generations after diploids begin to produce unreduced gametes):
if Generation > 1201 or ((count (Plants with [cytotype = "4x"])) / (count Plants)) = 1 [
file-print (word
";"
";"
";"
";"
";"
";"
";"
";"
";"
";"
Bilateral_polyploidization ";"
Unilateral_polyploidization ";"
(Precision ((count (Plants with [cytotype = "4x"])) / (count Plants)) 3) ";"
count turtles ";"
Counter ";"
(Generation - 200)
"\n")
setup]
end
There is only one version of this model, created about 2 hours ago by Sebastián Schneider.
Attached files
| File | Type | Description | Last updated | |
|---|---|---|---|---|
| Polyploidization model.png | preview | Preview for 'Polyploidization model' | about 2 hours ago, by Sebastián Schneider | Download |
| Read_first.txt | data | Read First | about 2 hours ago, by Sebastián Schneider | Download |
| Script_to_process_the_results.R | data | Script to process the NetLogo model results | about 2 hours ago, by Sebastián Schneider | Download |
| V1_Rad2.asc | background | Bioclimatic variables V1: February solar radiation | about 2 hours ago, by Sebastián Schneider | Download |
| V2_Bio3.asc | background | Bioclimatic variables V2: Isothermality | about 2 hours ago, by Sebastián Schneider | Download |
| V3_Bio12.asc | background | Bioclimatic variables V3: Annual Precipitation | about 2 hours ago, by Sebastián Schneider | Download |
| V4_SWC.asc | background | Soil variables V4: Available soil water capacity | about 2 hours ago, by Sebastián Schneider | Download |
| V5_SOCC.asc | background | Soil variables V5: Soil organic carbon content | about 2 hours ago, by Sebastián Schneider | Download |
This model does not have any ancestors.
This model does not have any descendants.
Download this model