ALife Somatic Computation
Model was written in NetLogo 5.0.4
•
Viewed 1393 times
•
Downloaded 68 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Info tab cannot be displayed because of an encoding error
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
breed [ replicators ] ; Replicator breed corresponding to mobile agents m-agents globals [ geneticlist ; A list of the different genetic variants number-of-replicators_0 number-of-replicators_1 decrease-in-population variants variants_0 num-variants extinctions ] patches-own [ ; Patches hold plantoids, each plantoid is a plant-like replicator with a fixed position in the territory ; The patches variables below actually correspond to plantoid-related variables max-reservoir ; Corresponds to a plantoid's reservoir capacity, defined as: the maximum amount of resources that a plantoid at that patch can generate. ; This variable depends upon the territory characteristics, which means that plantoids with the same genetic code but at different locations can have ; different reservoir capacities (different max-reservoir). plantoid-tag ; Corresponds to the plantoid's chromosome. Chromosomes are defined as per Holland's Echo rules: while actual chromosomes have a more complex relation to the ; general structure of an organism, the chromosome in Echo's artificial world is introduced with two fundamental characteristics: the chromosome is the ; genetic material of the agent and determines the agent's interface and interaction patterns, addressed in the model through tags that define these interactions, ; the tags' contents match the segments of the chromosome's chain. amount-resources ; Corresponds to the amount of resources that a plantoid holds at each time. ] replicators-own [ ; Although the plantoids are replicators, in this Netlogo code these are being addressed internally through patch-related variables, since they are fixed in the terrain. ; The breed "replicator" is, thus, being applied to mobile agents, or m-agents. genetic-code ; Corresponds to a m-agent's entire chromosome chain cog ; The "cog" variable defines the cognitive type, there two cognitive types: Cog-0 basic self-replicating automata; Cog-1 agents capable of emotional responses. reservoir-capacity ; The maximum amount of energy resources that the m-agent can hold. agent-reservoir ; The amount of resources that the m-agent has stored. offense ; The m-agent's offense tag (corresponds to a section of the agent's chromosome). defense ; The m-agent's defense tag (corresponds to a section of the agent's chromosome). ; NOTE: together, the offense and defense tags compose the agent's chromosome. rep-thresh; The energy threshold that if exceeded leads the m-agent to replicate. ; Variables for agent-environment interactions: used in m-agent feeding interaction with plantoids (m-agens feed from plantoids' energy resources). environmental-comp agent-comp1 agent-comp2 environmental-score extra-environmental ; Variables for agent-agent interactions: used in m-agent feeding interaction with other m-agents (m-agents feed from other m-agents' energy resources). agent-score1 agent-score2 proportion1 proportion2 extra1 extra2 ; Variables related with emotional responses: these are used in cog-1 related procedures and define the cog-1's AI's emotional responses in survival situations: fear ; The fear level is triggered in conflict situations in agent-agent feeding interaction (which take place as conflict procedures). desire ; Corresponds to the desire to feed variable. ; The desire level is triggered by the m-agent's internal evaluation of its reservoir depletion level and its need to feed. ; The desire to feed is involved in deliberation around moving, feeding and conflict situations (agent-agent interactions). desire-to-replicate ; The desire to replicate is triggered in replication procedures. ; NOTE: none of these AI variables are used in the cog-0 interactions, so that cog-0 is a basic self-replicating automaton, while the cog-1 is programmed with ; an AI capable of emotional responses. It is important to stress that the type of computation performed by cog-1 is a "somatic computation" (soma - body) in which ; basic emotion responses, taken in parallelism with living organisms, are introduced as a way to provide the agents with greater reflexive abilities. ; The cog-1 AI, thus, is programmed in such a way that an engagement of the whole artificial organism's body is involved in the computation, with physiological responses ; programmed into the artificial organism's cognitive ability, in this way we can speak of a "somatic" artificial intelligence. ] to setup ca reset-ticks set-default-shape replicators "bug"; m-agents shaped as bugs, called in the program code by the breed replicator. setup-resources ; Sets up the resource fountains conditions and the plantoids profile setup-m-agents ; Sets up the m-agents ; Auxiliary variables used in plotting procedures set variants_0 [] set number-of-replicators_0 count replicators plot-species end to setup-resources ask patches [ setup-terrain ] ; Setup the terrain in terms of resource fountain maximum capacity and initial resource level of plantoids. ask patches [ setup-plantoids ] ; Setup the plantoids' genetic profile. end to setup-terrain ; Each plantoid can hold up to a maximum amount of energy resources characteristic of the patch it is at: set max-reservoir 1 + random fountains-capacity ; This is patch-specific plantoid procedure: ; the maximum amount of energy resources characteristic of the patch (max-reservoir), ; which corresponds to the plantoid's energy reservoir capacity at that patch, ; is set randomly with uniform probability between 1 and a maximum level equal to fountains-capacity (global parameter ; defining the maximum plantoids' energy reservoir capacity admissible). ; Initially the plantoids are at their maximum resource level: set amount-resources max-reservoir ; This is a plantoid procedure. ; The patches color is set as a function of the amount of resources of the corresponding plantoid: set pcolor scale-color green amount-resources 200 0 end to setup-plantoids ; The plantoids' chromosome chain is set with a length chosen randomly from 1 to max-gen ; each letter of the genetic code (defined as a Netlogo list) is taken initially from a random uniform distribution ; from a numeric alphabet {0,1,2,..., genetic-diversity}. set plantoid-tag n-values (1 + random max-gen) [random (1 + genetic-diversity)] end to setup-m-agents create-replicators init-num-replicators ; Initial number of replicators [ set size 1 ; Each replicator sets its size as 1 ;; Set the cognitive profile: set cog 0 ; The initial cog value is set to 0 in order to be able to replace it depending upon the a-c slider: if a-c = 0 [set cog 0] ; a-c slider = 0, means that all m-agents are set with the cognitive profile cog-0. if a-c = 2 [set cog 1] ; a-c slider = 2, means that all m-agents are set with the cognitive profile cog-1. ; NOTE: The case of a-c = 1 is set in another procedure below. ;: Set the genetic profile (each m-agent is born with a given chromosome chain that specifies two tags: an offense tag and ;; a defense tag): set offense n-values (1 + random max-gen) [random (1 + genetic-diversity)] ; The offense tag set defense n-values (1 + random max-gen) [random (1 + genetic-diversity)] ; The defense tag set genetic-code sentence offense defense ; The replicator's genetic code ;; Set the energy reservoir capacity: ; Each m-agent has an energy reservoir capacity which is set to be equal to the length of its genetic code plus a base ; reservoir level called agent-max-reservoir. set reservoir-capacity agent-max-reservoir + length genetic-code ; Initially all replicators have the reservoir at their maximum capacity set agent-reservoir reservoir-capacity ; Replication threshold for the m-agent equals the length of the m-agent's genetic code, this is involved in replication ; procedures: an m-agent only replicates when its energy exceeds the replication threshold (agent-reservoir > rep-thresh) set rep-thresh length genetic-code ; If the button labels is chosen the genetic-code of each m-agent is shown if labels? [set label genetic-code] ; Initial position of the m-agent setxy random-float world-width random-float world-height ] ; When a-c = 1 half of the m-agents are set to be of the cog-1 variant, this connects with the previous procedure of assignment of ; cognitive profiles. if a-c = 1 [ ask n-of (count turtles / 2) turtles [set cog 1] ] ; Cog-1s' desire to replicate is set to 0 in the initial configuration. ; None of the emotional response variables are applicable in the case of cog-0 m-agent. ask replicators [ ifelse cog = 1 [set desire-to-replicate 0] [set desire-to-replicate "not applicable"] ] ask replicators [ if cog = 0 [ set fear "not applicable" set desire "not applicable" ] ] ask replicators [ifelse cog = 1 [evaluate-internal-state] [set color green] ] end to go no-display ;; First step is energy resource production by the plantoids ask patches [produce-resources] ;; Second step is resource collection procedures ; While cog-0 collect resources form the patch they are at, ; cog-1 evaluate their internal state and their environment ; before collecting resources (before feeding): ask replicators [ if cog = 1 [ evaluate-internal-state ; Step 1 of cog-1's deliberation process: the evaluation of their internal state ; this means that the cog-1 becomes aware of its feeding needs. evaluate-environment ] ; Step 2 of cog-1's deliberation process: the evaluation of the environment ] resource-collection ; The resource collection/feeding procedures implemented by the replicators. ask replicators [ ; Fighting procedures resulting from insufficient energy, this is a predator mode, where m-agent entities search for other ; m-agent entities from which to extract energy in a conflict situation if (agent-reservoir < max-reservoir) [ fight ] ; Fighting procedures replicate ; Replication procedures. ; If after fighting and replicating the m-agent's energy reservoir is depleted, then, that m-agent dies: if agent-reservoir <= 0 [die] ] ask patches [ if any? replicators-here [ release-poison ] ] ; Plantoids poison release procedure. ask patches [ compete ; Competition procedures (define the plantoids' replication rules). set pcolor scale-color green amount-resources 200 0 ] ; Patch color defined in terms of the corresponding plantoids' energy resources tick if (not any? replicators) [stop] do-plots display end to produce-resources ; If the maximum reservoir of a plantoid is not filled... ifelse max-reservoir - amount-resources > 0 ;... the plantoid produces resources by a fixed amount of replenishment rate ("replenishment" slider), otherwise... [set amount-resources amount-resources + replenishment ] ;... the resource level continues unchanged (resource depletion can only come from consumption by replicators). [set amount-resources amount-resources] end to evaluate-internal-state ; The evaluation of internal state corresponds to the evaluation of the agent's energy level ; and internal energy requirements, synthesized in an emotional response of desire to feed, ; the desire to feed is be defined as an internal response of the agent to the proportion of the ; agent's reservoir that is empty called proportion of energy needs, ; In the procedure below the desire to feed is set as equal to the proportion of energy needs: set desire 1 - (agent-reservoir / reservoir-capacity) ; Change in color corresponds to a physiological change in the cog-1's body, depending upon ; the desire to feed, thus, the hungrier a cog-1 is, the paler the color is set, darker colors ; correspond to cog-1s that have less desire to feed, this is programmed as physiological changes ; in their artificial bodies as a consequence of the level of desire to feed: set color scale-color color-desire (desire * scale-color-p) scale-color-min scale-color-max end to evaluate-environment ; Moving costs one unit of energy, in this case, and if energy reaches zero or below zero ; the cog-1 dies. In this case, the cog-1 evaluates how close it is to death, if taking one ; step does not lead to energy depletion, then, the cog-1 moves uphil with respect to the ; "amount of resources" plantoid variable, that is, it moves to the patch with the highest ; amount of energy resources. After this procedure the cog-1 evaluates again its internal state ; which triggers a new desire to feed level. if (1 - desire) * reservoir-capacity - 1 > 0 [ uphill amount-resources evaluate-internal-state ] end to move ; This is a universal procedure for both cog-0 and cog-1 agents. ; Motion leads to spending resources, so that at each step the agent loses one unit of energy of its reservoir. ; Death takes place if the resource is completely depeleted after moving. ; If the resource is not depleted a cog-0 replicator moves to a new random location. if cog = 0 [ set agent-reservoir agent-reservoir - 1 ifelse agent-reservoir <= 0 [die] [rt random-normal 0 20 fd random-float 1] ] ; A cog-1 replicator evaluates whether or not it should move ; if it's resources are depleted by moving the agent stays put and keeps its energy reservoir ; intact, otherwise, the cog-1 moves to the patch with an identified greater amount of resources (moving to greener pastures): if cog = 1 [ ifelse agent-reservoir - 1 <= 0 [set agent-reservoir agent-reservoir] [uphill amount-resources] ] end to resource-collection ; This is a universal procedure for both cog-0 and cog-1 agents. ; If the plantoid has energy resources available a chromosome-based scoring for feeding is initiated ask replicators [ if amount-resources > 0 [evaluate-scores] ] ; If the m-agent needs to feed and the amount of resources in the patch is greater than zero... ask replicators [ ifelse (agent-reservoir < reservoir-capacity) and (amount-resources > 0) ;...then, the agent's reservoir level is increased by the amount of resources multiplied by the proportion of environmental score of the agent in relation ; to the total environmental score of the other m-agent automata at that location [ set agent-reservoir agent-reservoir + amount-resources * (environmental-score / (sum [environmental-score] of replicators-here)) ; Resources are depleted by the agent's consumption set amount-resources amount-resources - amount-resources * (environmental-score / (sum [environmental-score] of replicators-here)) ; An agent only consumes up to its maximum reservoir capacity, any additional level of resources extracted is wasted ifelse agent-reservoir > max-reservoir [set agent-reservoir max-reservoir] [set agent-reservoir agent-reservoir] ] ; If the m-agent does not need to feed or there are no resources at the agent's location, then, the agent does not feed and keeps its reservoir level ; at its current level [set agent-reservoir agent-reservoir] ] end to evaluate-scores ; The scores are set depending upon a matching between the m-agent's interface with the plantoid, this depends upon genetic types: ; The comparison is between the plantoid's tag and the m-agent's offense tag which encodes to the m-agent's interface for feeding and for fighting. ; A list of matchings is defined so that the distance (measured in absolute value) is calculated between the contents for each offense tag element ; and the corresponding tag element of the plantoid-tag, this is the envrionmental-comp procedure (the computation of the matching of the interface between ; the m-agent and the plantoid). ; The environmental-score is calculated as: extra-environmental * [0.5 * (n+ - n- + k) + 1], with: ; 'extra-environmental' = 0.5 if it is the plantoid that has the longest tag (longer chromosome string with respect to the length of the m-agent's offense chromosome string) ; 'extra-environmental' = 1 if it is the m-agent that has the longest tag (longer offense chromosome string with respect to the length of the plantoid's chromosome string) ; n+: number of matching letters in a letter-by-letter chromosome string comparison (tag comparison procedure) ; n-: number of non-matching letters in the string chromosme string comparison (tag comparison procedure) ; k: length of the shorter chromosome string (shorter tag). ; Tag comparison procedure: ifelse (length plantoid-tag > length offense) ; If the plantoid has a longer tag than the m-agent... ; ...the match is made between the m-agent's offense tag and the sublist of the plantoid's tag which ; matches in size the m-agent's offense tag, the extra score penalty is set to 0.5 for the m-agent ; because it has the shorter tag: [set environmental-comp (map [abs (?1 - ?2)] offense (sublist plantoid-tag 0 (length offense))) set extra-environmental 0.5] ;... else: the match is made between the sublist of the m-agent's offense tag which matches in size the plantoid's tag ; and the plantoid's tag, the extra score penalty is set to 1 (no penalty incurred) for the m-agent because it does not have the ; shorter tag: [set environmental-comp (map [abs (?1 - ?2)] (sublist offense 0 (length plantoid-tag)) plantoid-tag) set extra-environmental 1] ; Scoring scheme: set environmental-score extra-environmental * (0.5 * (length filter [? = 0] environmental-comp - length filter [? != 0] environmental-comp + length environmental-comp) + 1) end to fight ; A m-agent initiates fighting by looking for another m-agent at a place to fight if any? other replicators-here [ match-off-def self one-of other replicators-here ; "Choose a pair to attack and fight" ] end to match-off-def [agent1 agent2] ;; agent1 is the attacker agent2 is the defender. ; As a result of a fight the transfer of energy can be from the attacker to the defender or vice-versa. let transfer12 0 ;; transfer from 1 to 2 (from attacker to defender). let transfer21 0 ;; transfer from 2 to 1 (from defender to attacker). ;; SCORING PROCEDURE 1: Attack scoring ; Matching between tags takes place in a similar manner to the evaluation score for resource extraction from plantoids, ; in this case the matching is done between the offense tag and the defense tag. ifelse (length [defense] of agent2 > length [offense] of agent1) ; If the defender has a longer defense tag than the attacker's offense tag... ; ...the match is made between the attacker's offense tag and the sublist of the defender's defense tag which ; matches in size the attacker's offense tag, the extra score penalty is set to 0.5 for the attacker because it has the shorter tag: [ set agent-comp1 (map [abs (?1 - ?2)] [offense] of agent1 (sublist [defense] of agent2 0 (length [offense] of agent1))) set extra1 0.5 ] ; ... else: the match is made between the sublist of the attacker's offense tag, which matches in size the defender's defense tag, ; and the defender's defense tag, the extra score penalty is set to 1 (no penalty incurred) for the attacker because it does not have the ; shorter tag: [ set agent-comp1 (map [abs (?1 - ?2)] (sublist [offense] of agent1 0 (length [defense] of agent2)) [defense] of agent2) set extra1 1 ] ; Scoring is set as before: set agent-score1 extra1 * (0.5 * (length filter [? = 0] agent-comp1 - length filter [? != 0] agent-comp1 + length agent-comp1) + 1) ;; SCORING PROCEDURE 2: Defense scoring ; In the conflict the agent that defends when attack also strikes in response assuming (so that integrated in defense is a counterstrike ; the procedures are similar to the above procedures with some adjustments. Namely, the defender has a disadvantage when the tags match in size ; and not only when the defense tag of the attacking agent is longer than the defender's offense tag. ifelse (length [defense] of agent1 >= length [offense] of agent2) ; If the attacker has defense tag at least as long as the defender's offense tag... ; ...the match is made between the defender's offense tag and the sublist of the attacker's defense tag which ; matches in size the defender's offense tag, the extra score penalty is set to 0.5 for the defender because ; it has the shorter tag or at least of equal size: [ set agent-comp2 (map [abs (?1 - ?2)] [offense] of agent2 (sublist [defense] of agent1 0 (length [offense] of agent2))) set extra2 0.5 ] ; ...else: the match is made between the sublist of the defender's offense tag, which matches in size the attackers's defense tag, ; and the attacker's defense tag, the extra score penalty is set to 1 (no penalty incurred) for the defender because it has the ; longer tag: [ set agent-comp2 (map [abs (?1 - ?2)] (sublist [offense] of agent2 0 (length [defense] of agent1)) [defense] of agent1) set extra2 1 ] ; Scoring is set as before: set agent-score2 extra2 * (0.5 * (length filter [? = 0] agent-comp2 - length filter [? != 0] agent-comp2 + length agent-comp2) + 1) ;; RESOURCE TRANSFERENCE EVALUATION PROCEDURE: ; The transfer of resources depends on the scores obtained by each agent relative to the total score. set proportion1 agent-score1 / (agent-score1 + agent-score2) ; Proportion of resources gained by attacker. set proportion2 agent-score2 / (agent-score1 + agent-score2) ; Proportion of resources gained by defender. ; Agent 1 (the attacker) transfers to agent 2 (the defender) an amount equal to proportion2 of its reservoir: set transfer12 ([agent-reservoir] of agent1) * proportion2 ; Agent 2 (the defender) transfers to agent 1 (the attacker) an amount equal to proportion1 of its reservoir. set transfer21 ([agent-reservoir] of agent2) * proportion1 ; For cog-0 agents the result of conflict is the above, for cog-1 agents they anticipate the result of a conflict, ; in this sense if the agents are cog-1, they may not engage in conflict. This dynamics depends upon the attacker agent1. ; Cog-0 attackers do not have the antecipatory response given by the emotional trigger of fear versus desire that is introduced for Cog-1 replicators, so that ; they just engage in conflict without deliberation. ask agent1 ; Attacker procedures [ ifelse cog = 1 ; If the m-agent is a cog-1, the agent anticipates the result of the resource transfer, the agent's actions will be dependent upon this evaluation [ ; Emotional responses: ; Fear: the fear of confrontation is triggered by the antecipatory perception of the outcome of the confrontation, namely, ; the cog-1 predator (the attacker) fears the confrontation by a level equal to the relative proportion of resources transferred to ; the prey (the defender) over the total amount of energy resources transferred in the conflict: set fear transfer12 / (transfer21 + transfer12) ; Desire: the desire of confrontation is also triggered by the antecipatory perception of the outcome of the confrontation, namely, ; the cog-1 predator (the attacker) desires the transference of resources from the prey (the defender), so that the desire level is ; set equal to the proportion of energy resources received from the prey: set desire (1 - fear) ; If the fear surpasses the desire for resources (resource transfer to the defender is less than half the transfer from the defender)... ifelse fear > desire ;... color is set to yellow (the agent is afraid to engage in conflict) (NOTE: the color change reflects a physiological response), but ; nothing else happens, since the attacker does not engage the potencial prey... [ set color yellow ] ;...else: the cog-1's color changes to red (physiological response) and the cog-1 attacks so that resource transference takes place. [ set color red ; Color is set to red if the desire for resources surpasses the fear of conflict (in this case, the attacker identifies an advantage) set agent-reservoir agent-reservoir + transfer21 - transfer12 ; The agent's reservoir changes by the amount of resources received from the defender ; minus the amount of resources lost in the conflict. ifelse agent-reservoir > max-reservoir [set agent-reservoir max-reservoir] [set agent-reservoir agent-reservoir] ; The agent's reservoir cannot exceed the maximum capacity. if agent-reservoir <= 0 [die] ] ; If the energy reservoir is depleted, the m-agent dies. ] ; For the cog-0, the resource transfer takes place independently of the advantage of each part. [ set agent-reservoir agent-reservoir + transfer21 - transfer12 ifelse agent-reservoir > max-reservoir [set agent-reservoir max-reservoir] [set agent-reservoir agent-reservoir] if agent-reservoir <= 0 [die] ] ] ask agent2 [ ; Fear and desire are triggered in the same way for the cog-1 defender if cog = 1 [ set fear transfer21 / (transfer21 + transfer12) ; Cog-1 preys fear the loss of resources to the predator. set desire (1 - fear) ; Cog-1 preys desire the resources from the predator. ifelse fear > desire [set color yellow] [set color red] ] ; Physiological responses triggered by fear versus desire ; If the predator is a cog-1 that has decided to attack (identified by red color) or a cog-0, which attacks no matter what... if ([cog] of agent1 = 1 and [color] of agent1 = red) or ([cog] of agent1 = 0) ; ... conflict takes place, the resource transference procedures are analogous: [ set agent-reservoir agent-reservoir + transfer12 - transfer21 ifelse agent-reservoir > max-reservoir [set agent-reservoir max-reservoir] [set agent-reservoir agent-reservoir] if agent-reservoir <= 0 [die] ] ] ; Cog-1 reevaluate their internal state after conflict: ask agent1 [ if cog = 1 [ evaluate-internal-state ] ] ask agent2 [ if cog = 1 [ evaluate-internal-state ] ] end to replicate if (agent-reservoir > rep-thresh) ; If a m-agent's reservoir exceeds the replication threshold then... [ if (random-float 1.0000 <= rep-chance) ; ... replication takes place with probability equal to rep-chance [ if cog = 1 [ set desire-to-replicate 1 ; Cog-1 agents set their desire to replicate equal to 1 set color pink ] ; and their color changes to pink, this is a physiological change in the agent's body hatch 1 ; A new m-agent is born [ ; The new m-agent gets the same traits as the parent: set offense [offense] of myself set defense [defense] of myself set cog [cog] of myself ifelse cog = 1 [set desire-to-replicate 0] [set desire-to-replicate "not applicable"] ; Mutation can take place with probability mutation-p if random-float 1.000 <= mutation-p [ ifelse random-float 1.000 <= length offense / (length offense + length defense) [ set offense replace-item (random-float length offense) offense (random (1 + genetic-diversity)) ] ; Mutation can take place either in the offense tag... [ set defense replace-item (random-float length defense) defense (random (1 + genetic-diversity)) ] ; ... or in the defense tag ] set genetic-code sentence offense defense ; The genetic code of the new organism ; Reservoir capacity is the same as that of the parent, the new m-agent is, however, born with half the reservoir of the parent set reservoir-capacity [reservoir-capacity] of myself set agent-reservoir (0.5 * [agent-reservoir] of myself) ; The offspring gets the same replication threshold set rep-thresh [rep-thresh] of myself ; Cog-1 evaluates its internal state ifelse cog = 1 [evaluate-internal-state] [set color green] if labels? [set label genetic-code] ] set agent-reservoir agent-reservoir / 2 ; The agent loses half its reservoir to the new offspring. ifelse cog = 1 [evaluate-internal-state] [set color green] ; Cog-1 agents reevaluate their internal state. if cog = 1 [set desire-to-replicate 0] ] ; Cog-1 agents that have replicated no longer have desire to replicate for the round. ] end to release-poison ; The plantoids react to the m-agents releasing poison that depletes the energy of the m-agents by one unit: ask replicators-here [ set agent-reservoir agent-reservoir - 1 ifelse agent-reservoir <= 0 [die] [move] ] ; Agents that have their energy reservoir depleted die, otherwise moving procedures are implemented. end to compete ; Competition is a procedure for plantoids. ; If a plantoid finds a neighbor with less than half its resources, then, it replicates, with the offspring occupying now the neighboring patch. if any? neighbors with [amount-resources < 0.5 * [amount-resources] of myself] [ ask one-of neighbors with [amount-resources < 0.5 * [amount-resources] of myself] ; Replication takes place with a mutation probability [ set plantoid-tag [plantoid-tag] of myself if random-float 1.000 < mutation-p [ set plantoid-tag replace-item (random-float length plantoid-tag) plantoid-tag (random (1 + genetic-diversity)) set amount-resources max-reservoir ] ; The new replicator increases the site's amount of resources to its maximum level. ] ] end to do-plots plot-species ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Increase and decrease in numbers ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; set number-of-replicators_1 count replicators if (number-of-replicators_1 - number-of-replicators_0 < 0) [set decrease-in-population number-of-replicators_0 - number-of-replicators_1] set-current-plot "Replicator Deaths" plot decrease-in-population set number-of-replicators_0 number-of-replicators_1 end to plot-species count-genetic-variants ; A procedure to count the number of genetic variants in the population set-current-plot "Number of Different Variants" plot num-variants set-current-plot "Number of replicators" plot count replicators set-current-plot "Extinctions" plot extinctions ; extinctions of genetic variants set-current-plot "Genetic Complexity" set-current-plot-pen "Average Complexity" plot mean [length genetic-code] of replicators set-current-plot-pen "Maximum Complexity" plot max [length genetic-code] of replicators set-current-plot "Plant Genetic Complexity" set-current-plot-pen "Average Complexity" plot mean [length plantoid-tag] of patches set-current-plot-pen "Maximum Complexity" plot max [length plantoid-tag] of patches end to count-genetic-variants set variants remove-duplicates [genetic-code] of replicators set num-variants length variants ifelse empty? variants_0 [set extinctions 0] [pair-up-gene-pool] set variants_0 variants end to pair-up-gene-pool let count-s 0 foreach variants_0 [if member? ? variants [set count-s count-s + 1]] ifelse count-s < length variants_0 [set extinctions length variants_0 - count-s] [set extinctions 0] end
There is only one version of this model, created almost 11 years ago by Carlos Pedro S. Gonçalves.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
ALife Somatic Computation.png | preview | Preview for 'ALife Somatic Computation' | almost 11 years ago, by Carlos Pedro S. Gonçalves | Download |
This model does not have any ancestors.
This model does not have any descendants.