avida-ed-library-build/docs/documentation/Environment-file.md

902 lines
30 KiB
Markdown

<p>
This is the setup file for the task/resource system in Avida.
</p>
<p>
Six main keywords are used in this file, RESOURCE, <a href="Gradient-resources">GRADIENT_RESOURCE</a>, REACTION, CELL, MUTATION, and SET_ACTIVE. Their formats are:
</p>
<pre>
<a href="#RESOURCE">RESOURCE</a> resource_name[:options] {resource_name ...}
<a href="gradient.html">GRADIENT_RESOURCE</a> gradient_resource_name[:options] {gradient_resource_name ...}
<a href="#REACTION">REACTION</a> reaction_name task [process:...] [requisite:...]
<a href="#CELL">CELL</a> resource_name:cell_list[:flow]
<a href="#MUTATION">MUTATION</a> name trigger scope type rate
<a href="#SET_ACTIVE">SET_ACTIVE</a> type name new_status(default=true)
</pre>
<h2>Resources</h2>
<p>
All entries on a resource line are names of individual resources. Resources can have a global quantity depletable by all organisms or can have quantities that vary from cell to cell. The resource name <code>infinite</code> is used to refer to an undepletable resource. There are two basic commands to set up a general resource: RESOURCE and CELL. In addition, <a href="gradient.html">GRADIENT_RESOURCE</a> is a specific instance of RESOURCE which allows the user to specify a cellular distribution of quantities that change (aka move) over time in an Avida run.
</p>
<h3><A name="RESOURCE">RESOURCE Command</A></h3>
<p>The syntax for the Resource command is:</p>
<pre>RESOURCE resource_name[:options] {resource_name ...}</pre>
<Blockquote>
<P>
Where <code>resource_name</code> is a unique name of the resource. This name may be used by the <code>CELL</code> command to further define the resource or in the <code>REACTION</code> to define which resource is consumed/created
by a reaction.
</P>
<P>
Where <code>options</code> is a colon delimited list of factors that modify the
resource. The following chart specifies these options.
</P>
</Blockquote>
<div align="center">
<p>&nbsp;</p>
<h3>Table 1: <span>Resources Options</span></h3>
<p>
(<span class="resall">blue</span> variables used for all resources
while <span class="resspatial">red</span> variables are only used for
spatial resources)
</p>
<table border="1" cellpadding="2">
<tr>
<th>Argument</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td class="resall">inflow</td>
<td>
The number of units of the resource that enter the population over
the course of an update. For a global resource this inflow
occurs evenly throughout the update, not all at once. For a
spatial resource this inflow amount is added every update
evenly to all grid cells in the rectangle described by the
points (inflowx1,inflowy1) and (inflowx2,inflowy2).
</td>
<td>0</td>
</tr>
<tr>
<td class="resall">outflow</td>
<td>
The fraction of the resource that will flow out of the population
each update. As with inflow, this happens continuously over the
course of the update for a global resource. In the case of a
spatial resource the fraction is withdrawn each update from
each cell in the rectangle described by the points
(outflowx1,outflowy1) and (outflowx2,outflowy2).
</td>
<td>0.0</td>
</tr>
<tr>
<td class="resall">initial</td>
<td>
The initial abundance of the resource in the population at the
start of an experiment. For a spatial resource the initial
amount is spread evenly to each cell in the world grid.
</td>
<td>0</td>
</tr>
<tr>
<td class="resall">geometry</td>
<td>
The layout of the resource in space.<br>
<em>global</em> -- the entire pool of a resource is
available to all organisms<br>
<em>grid</em> -- organisms can only access resources in
their grid cell. Resource can not flow past the edges of the
world grid. (resource will use spatial parameters)<br>
<em>torus</em> -- organisms can only access resources in
their grid cell. Resource can flow to the opposite edges of the
world grid. (resource will use spatial parameters)
</td>
<td>global</td>
</tr>
<tr>
<td class="resall">deme</td>
<td>
Is this resource going to be used by a deme. (<em>True</em> or
<em>False</em>)
</td>
<td>
false
</td>
</tr>
<tr>
<td class="resall">energy</td>
<td>
Is this an energy resource. The energy model must be used.
(<em>True</em> or <em>False</em>)
</td>
<td>
false
</td>
</tr>
<tr>
<td class="resspatial">inflowx1</td>
<td>
Leftmost coordinate of the rectangle where resource will flow
into world grid. If not specified but an inflow rate is specified,
an x-coordinate will be determinstically assigned.
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">inflowx2</td>
<td>
Rightmost coordinate of the rectangle where resource will flow
into world grid. If not specified, inflowx1's value will be used.
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">inflowy1</td>
<td>
Topmost coordinate of the rectangle where resource will flow
into world grid. If not specified but an inflow rate is specified,
a y-coordinate will be determinstically assigned.
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">inflowy2</td>
<td>
Bottommost coordinate of the rectangle where resource will flow
into world grid. If not specified, inflowy1's value will be used.
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">outflowx1</td>
<td>
Leftmost coordinate of the rectangle where resource will flow
out of world grid.
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">outflowx2</td>
<td>
Rightmost coordinate of the rectangle where resource will flow
out of world grid. If not specified, outflowx1's value will be used.
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">outflowy1</td>
<td>
Topmost coordinate of the rectangle where resource will flow
out of world grid.
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">outflowy2</td>
<td>
Bottommost coordinate of the rectangle where resource will flow
out of world grid. If not specified, outflowy1's value will be used.
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">xdiffuse</td>
<td>
How fast material will diffuse right <em>and</em> left. This flow
depends on the amount of resources in a given cell and amount in
the cells to the right and left of it. (0.0 - 1.0)
</td>
<td>1.0</td>
</tr>
<tr>
<td class="resspatial">xgravity</td>
<td>
How fast material will move to the right <em>or</em> left. This
movement depends only on the amount of resource in a given cell.
(-1.0 - 1.0)
</td>
<td>0</td>
</tr>
<tr>
<td class="resspatial">ydiffuse</td>
<td>
How fast material will diffuse up <em>and</em> down. This flow
depends on the amount of resources in a given cell and amount in
the cells above and below it. (0.0 - 1.0)
</td>
<td>1.0</td>
</tr>
<tr>
<td class="resspatial">ygravity</td>
<td>
How fast material will move to the up <em>or</em> down. This
movement depends only on the amount of resource in a given cell.
(-1.0 - 1.0)
</td>
<td>0</td>
</tr>
</table>
<p>&nbsp;</p>
</div>
<p>
An example of a RESOURCE statement that begins a run with a fixed amount of the
(global) resource in the environment, but has no inflow or outflows is:
<pre>
RESOURCE glucose:initial=10000
</pre>
</p>
<p>
If you wanted to make this into a chemostat with a 10000 equilibrium
concentration for unused resources, you could put:
<pre>
RESOURCE maltose:initial=10000:inflow=100:outflow=0.01
</pre>
</p>
<p>
If you want a resource that exists spatially where the resource enters
from the top and flows towards the bottom where it exits the system,
you could use:
<pre>
RESOURCE lactose:geometry=grid:initial=100000:inflow=100:outflow=0.1:\
inflowx1=0:inflowx2=100:inflowy1=0:inflowy2=0:outflowx1=0:outflowx2=100:\
outflowy1=100:outflowy2=100:ygravity=0.5
</pre>
</p>
<p>
Defining a resource with no parameters means that it will start at a zero
quantity and have no inflow or outflow. This is sometimes desirable if you
want that resource to only be present as a byproduct of a reaction.
Remember, though, that you should still have an outflow rate if it's in
a chemostat.
</p>
<h3><a name="CELL">CELL Command</a></h3>
<p>
Using Cell can help increase the detail of a spatial resource. Any cell in a
grid can be given their own initial amount of a resource, inflow amount and
outflow rate. These values are in addition to any other values set for the
spatial resource for the entire for the grid (diffusion and gravity for
instance). The command has the format:
</p>
<pre>CELL resource_name:cell_list[:options]</pre>
<p>
<Blockquote>
Where <code>resource_name</code> is the name of the spatial resource that this
cell command will modify. If this resource has not been defined yet, a new
resource with this name will be created.
</P>
<p>
Where <code>cell_list</code> is comma delimited list of cells that will be set.
We treat the grid like a one dimensional array where 0 is the upper left corner,
world_x - 1 is the upper right corner, and (world_x * world_y) - 1 is the
lower right corner. As well as single cell you can also enter a range of
cells by using the format a..b.
</P>
<P>
Where <code>options</code> is a colon delimited list of factors that modify the
resource. The following chart specifies these options.
</P>
</Blockquote>
<div align="center">
<p>&nbsp;</p>
<h3>Table 4: <span>Cell Options</span></h3>
<table border="1" cellpadding="2">
<tr>
<th>Argument</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td class="rescell">inflow</td>
<td>
The number of units of the resource that enter a cell at the end of an
update.
</td>
<td>0</td>
</tr>
<tr>
<td class="rescell">outflow</td>
<td>
The fraction of the resource that will flow out a cell each update.
</td>
<td>0.0</td>
</tr>
<tr>
<td class="rescell">initial</td>
<td>
The initial abundance of the resource in a cell at the start of an
experiment.
</td>
<td>0</td>
</tr>
</table>
<p>&nbsp;</p>
</div>
<p>
An example of setting two cells in the glucose spatial resource:
</P>
<pre>CELL glucose:20,50:initial=100:inflow=10:outflow=0.1</pre>
<P>
An example of setting a 3 x 3 square of cells in the middle of a a maltose
spatial resource (assuming a 10 x 10 world):
</P>
<pre>CELL maltose:33..35,43..45,53..55:initial=500:inflow=5:outflow=0.01</pre>
<h2>Reactions</h2>
<p>
Reactions are set to allow organisms to consume or produce resources when those
organisms preform certain tasks. Reactions can be used to reward (or punish)
organisms for performing tasks or to set up a "food web". They
are described by the task that triggers them, the processes they
perform (including resources used and the results of using them), and
requisites on when they can occur.
</p>
<h3><A NAME="REACTION">REACTION Command</A></h3>
<pre>REACTION reaction_name task[:argument:...] [process:...] [requisite:...]</pre>
<blockquote>
<p>
Where <code>reaction_name</code> is a unique name for a reaction.
</P>
<P>
Where <code>task</code> is the name of the task that must be be performed to
trigger the reaction. A list of common tasks is listed in Table 3.
</P>
<P>
Where <code>argument</code> is a list of specific arguments needed by the
particular task.
</P>
Where <code>process</code> is a colon delimited list of information about how
resources are consumed/produced. Process settings are described in Table 4.
</P>
<p>
Where <code>requisite</code> is a colon delimited list describing when
reactions can be triggered. Requisite settings are described in Table 5.
</blockquote>
<p>
Each reaction must have a task that triggers it. Currently, eighty tasks
have been implemented, as summarized in the following table (in approximate
order of complexity):
</p>
<div align="center">
<p>&nbsp;</p>
<h3>Table 5: <span>Available Tasks</span></h3>
<table border="1" cellpadding="2">
<tr>
<th>Task</th>
<th>Description</th>
</tr>
<tr>
<td class="resall">echo</td>
<td>
This task is triggered when an organism inputs a single number and
outputs it without modification.
</td>
</tr>
<tr>
<td class="resall">add</td>
<td>
This task is triggered when an organism inputs two numbers, sums them
together, and outputs the result.
</td>
</tr>
<tr>
<td class="resall">sub</td>
<td>
This task is triggered when an organism inputs two numbers, subtracts
one from the other, and outputs the result.
</td>
</tr>
<tr>
<td class="resall">not</td>
<td>
This task is triggered when an organism inputs a 32 bit number,
toggles all of the bits, and outputs the result. This is typically
done either by nanding (by use of the <tt>nand</tt> instruction) the
sequence to itself, or negating it and subtracting one. The latter
approach only works since numbers are stored in twos-complement
notation.
</td>
</tr>
<tr>
<td class="resall">nand</td>
<td>
This task is triggered when two 32 bit numbers are input, the values
are 'nanded' together in a bitwise fashion, and the result is output.
Nand stands for "not and".
The nand operation returns a zero if and only if both inputs are one;
otherwise it returns a one.
</td>
</tr>
<tr>
<td class="resall">and</td>
<td>
This task is triggered when two 32 bit numbers are input, the values
are 'anded' together in a bitwise fashion, and the result is output.
The and operation returns a one if and only if both inputs are one;
otherwise it returns a zero.
</td>
</tr>
<tr>
<td class="resall">orn</td>
<td>
This task is triggered when two 32 bit numbers are input, the values
are 'orn' together in a bitwise fashion, and the result is output.
The orn operation stands for or-not. It is returns true if for each
bit pair one input is one <em>or</em> the other one is zero.
</td>
</tr>
<tr>
<td class="resall">or</td>
<td>
This task is triggered when two 32 bit numbers are input, the values
are 'ored' together in a bitwise fashion, and the result is output.
It returns a one if either the first input <em>or</em> the second input
is a one, otherwise it returns a zero.
</td>
</tr>
<tr>
<td class="resall">andn</td>
<td>
This task is triggered when two 32 bit numbers are input, the values
are 'andn-ed' together in a bitwise fashion, and the result is output.
The andn operation stands for and-not. It only returns a one if
for each bit pair one input is a one <em>and</em> the other input is
not a one. Otherwise it returns a zero.
</td>
</tr>
<tr>
<td class="resall">nor</td>
<td>
This task is triggered when two 32 bit numbers are input, the values
are 'nored' together in a bitwise fashion, and the result is output.
The nor operation stands for not-or and returns a one only if both
inputs are zero. Otherwise a zero is returned.
</td>
</tr>
<tr>
<td class="resall">xor</td>
<td>
This task is triggered when two 32 bit numbers are input, the values
are 'xored' together in a bitwise fashion, and the result is output.
The xor operation stands for "exclusive or" and returns a one
if one, but not both, of the inputs is a one. Otherwise a zero is
returned.
</td>
</tr>
<tr>
<td class="resall">equ</td>
<td>
This task is triggered when two 32 bit numbers are input, the values
are equated together in a bitwise fashion, and the result is output.
The equ operation stands for 'equals' and will return a one if both
bits are identical, and a zero if they are different.
</td>
</tr>
<tr>
<td class="resall">logic_3AA-<br />logic_3CP</td>
<td>
These tasks include all 68 possible unique 3-input logic operations,
many of which don't have easy-to-understand human readable names.
</td>
</tr>
</table>
<p>&nbsp;</p>
</div>
<p>
When describing a reaction, the <code>process</code> portion determines consumption
of resources, their byproducts, and the resulting bonuses. There are several
arguments (separated by colons; example below) to detail the use of a resource.
Default values are in brackets:
</p>
<div align="center">
<p>&nbsp;</p>
<h3>Table 6: <span>Reaction Process Specifications</span></h3>
<table border="1" cellpadding="2">
<tr>
<th>Argument</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td class="resall">resource</td>
<td>
The name of the resource consumed. By default, no resource is being
consumed, and the 'max' limit is the amount absorbed.
</td>
<td>infinite</td>
</tr>
<tr>
<td class="resall">value</td>
<td>
Multiply the value set here by the amount of the resource consumed
to obtain the bonus. (0.5 may be inefficient, while 5.0 is very
efficient.) This allows different reactions to make use of the
same resource at different efficiency levels.
</td>
<td>1.0</td>
</tr>
<tr>
<td class="resall">type</td>
<td>
Determines how to apply the bonus (i.e. the amount of the resource
absorbed times the value of this process) to change the merit of the
organism.
<br />&nbsp;&nbsp;&nbsp;<em>add</em>: Directly add the bonus to the current merit.
<br />&nbsp;&nbsp;&nbsp;<em>mult</em>: Multiply the current merit by the bonus (warning: if
the bonus is ever less than one, this will be detrimental!)
<br />&nbsp;&nbsp;&nbsp;<em>pow</em>: Multiply the current merit by 2<sup>bonus</sup>.
this is effectively multiplicative, but positive bonuses are
always beneficial, and negative bonuses are harmful.
<br />&nbsp;&nbsp;&nbsp;<em>enzyme</em>: Add bonus * resource / (resource + ksubm) to the current merit.
This is gives a Michaelis-Menten enzyme type reward where bonus is the K<sub>cat</sub>
and the K<sub>m</sub> is entered. Does not work with unlimited resources.
<br />&nbsp;&nbsp;&nbsp;<em>energy</em>: Add the bonus energy to the organism's energy waiting to be applied buffer. Bonus energy can be applied on completion of a reaction, execution of the sleep/eat instruction, or when the organisms divides. See <a href="energy_model.html">Energy Model</a> documentation for more information.
</td>
<td>add</td>
</tr>
<tr>
<td class="resall">max</td>
<td>The maximum amount of the resource consumed per occurrence.</td>
<td>1.0</td>
</tr>
<tr>
<td class="resall">min</td>
<td>
The minimum amount of resource required. If less than this quantity
is available, the reaction ceases to proceed.
</td>
<td>0.0</td>
</tr>
<tr>
<td class="resall">frac</td>
<td>The maximum fraction of the available resource that can be consumed.</td>
<td>1.0</td>
</tr>
<tr>
<td class="resall">product</td>
<td>
The name of the by-product resource. At the moment, only a single
by-product can be produced at a time.
</td>
<td>none</td>
</tr>
<tr>
<td class="resall">conversion</td>
<td>The conversion rate to by-product resource</td>
<td>1.0</td>
</tr>
<tr>
<td class="resall">inst</td>
<td>
The instruction that gets executed when this reaction gets performed. If
you do not want an organism to be able to have the instruction in their
genome, you still must put it in the instruction set file, but set its weight
to zero. The instruction is executed at no cost to the organism.
</td>
<td>none</td>
</tr>
<tr>
<td class="resall">lethal</td>
<td>Whether the cell dies after performing the process</td>
<td>0</td>
</tr>
<tr>
<td class="resall">random</td>
<td>Whether any produced resource is placed randomly in the world instead of the focal cell.</td>
<td>0</td>
</tr>
<tr>
<td class="resall">depletable</td>
<td>
Whether this resource is consumed by reactions.
</td>
<td>1</td>
</tr>
<tr>
<td class="resall">phenplastbonus</td>
<td>
Specify how to handle phenotypic plasticity at run-time.
This option may significantly slow an Avida experiment.
When requested in many of the settings below (*), task
bonuses will be adjusted by the plasticity
of each organism's genotype. Requisites will still be
honored, making true task completion information ambiguous.
<br />&nbsp;&nbsp;&nbsp;<em>default</em>: Do not attempt to use the genotype's task plasticity.
<br />&nbsp;&nbsp;&nbsp;*<em>nobonus</em>: Do not give a bonus to non-static tasks.
<br />&nbsp;&nbsp;&nbsp;*<em>fracbonus</em>: Scale the bonus by how static the task is.
<br />&nbsp;&nbsp;&nbsp;*<em>fullbonus</em>: Always reward a task when it is detected.
</td>
<td>
default
</td>
</tr>
<tr>
<td class="resall">ksubm</td>
<td>
K<sub>m</sub> for an enzyme reaction.
</td>
<td>
0.0
</td>
</tr>
</table>
<p>&nbsp;</p>
</div>
<p>
If no process is given, a single associated process with all default
settings is assumed. If multiple process statements are given, <em>all</em> are
acted upon when the reaction is triggered. Assuming you were going to set
all of the portions of process to be their default values, this portion of
the reaction statement would appear as:
<pre>
process:resource=infinite:value=1:type=add:max=1:min=0:frac=1:product=none:conversion=1
</pre>
</p>
<p>
This statement has many redundancies; for example, it would indicate that the
associated reaction should use the infinite resource, making 'frac' and 'min'
settings irrelevant. Likewise, since 'product' is set to none, the
'conversion' rate is never considered.
</p>
<p>
The <code>requisite</code> entry limits when this reaction can be triggered. The
following requisites (in any combination) are possible:
</p>
<div align="center">
<p>&nbsp;</p>
<h3>Table 7: <span>Reaction Requisite Specifications</span></h3>
<table border="1" cellpadding="2">
<tr>
<th>Argument</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td class="resall">reaction</td>
<td>
This limits this reaction from being triggered until the other
reaction specified here has been triggered first. With this, the
user can force organisms to perform reactions in a specified order.
</td>
<td>none</td>
</tr>
<tr>
<td class="resall">noreaction</td>
<td>
This limits this reaction from being triggered if the reaction
specified here has already been triggered. This allows the user to
make mutually exclusive reactions, and force organisms to "choose"
their own path.
</td>
<td>none</td>
</tr>
<tr>
<td class="resall">min_count</td>
<td>
This restriction requires that the task used to trigger this reaction
must be performed a certain number of times before the trigger will
actually occur. This (along with max_count) allows the user to
provide different reactions depending on the number of times an
organism has performed a task.
</td>
<td>0</td>
</tr>
<tr>
<td class="resall">max_count</font>
<td>
This restriction places a cap on the number of times a task can
be done and still trigger this reaction. It allows the user to
limit the number of times a reaction can be done, as well as
(along with min_count) provide different reactions depending on the
number of times an organism as performed a task.
</td>
<td>INT_MAX</td>
</tr>
<tr>
<td class="resall">min_tot_count</td>
<td>
This restriction requires that the total number of tasks performed by
the organism must be at least this high before this reaction will trigger.
This (along with max_tot_count) allows the user to provide different
reactions depending on how many tasks an organism performs.
</td>
<td>0</td>
</tr>
<tr>
<td class="resall">max_tot_count</td>
<td>
This restriction places a cap on the number of tasks an organism can do
and still trigger this reaction. It allows the user to limit the number
of tasks that will be rewarded, as well as (along with min_tot_count) provide
different reactions depending on the number of tasks an organism performs.
</td>
<td>INT_MAX</td>
</tr>
<tr>
<td class="resall">reaction_min_count</td>
<td>
This restriction requires that the reaction must be performed a certain number
of times before any rewards are given. The restriction refers to the number of
times the specific reaction has been triggered, regardless of how many times
the referenced task has been performed. The reaction process specs max and min
will restrict reactions and their counts, not tasks.
</td>
<td>0</td>
</tr>
<tr>
<td class="resall">reaction_max_count</td>
<td>
This restriction caps the number of times an organism can perform the reaction,
effectively limiting the number of times a reaction will be rewarded. The
restriction refers to the number of times the specific reaction has been triggered,
regardless of how many times the referenced task has been performed. The reaction
process specs max and min will restrict reactions and their counts, not tasks.
</td>
<td>INT_MAX</td>
</tr>
<tr>
<td class="resall">divide_only</td>
<td>
This command decides when a task will be checked, if the value is 0 the task
will only be checked when an organism executes an IO. If the value is 1 the task
will only be checked when the organism divides. If the value is 2 the task will be
checked at both times.
</td>
<td>0</td>
</tr>
<tr>
<td class="resall">parasite_only</td>
<td>
This command only allows parasites to get credit for the reaction, not host organisms.
</td>
<td>False</td>
</tr>
</table>
<p>&nbsp;</p>
</div>
<p>
No restrictions are present by default. If there are multiple requisite
entries, only *one* of them need be satisfied in order to trigger the
reaction. Note though that a single requisite entry can have as many
portions as needed.
</p>
<h2>Examples</h2>
<p>
We could simulate the pre-environment system (in which no resources were
present and task performance was rewarded with a fixed bonus) with a file
including only lines like:
<pre>
REACTION AND logic:2a process:type=mult:value=4.0 requisite:max_count=1
REACTION EQU logic:2h process:type=mult:value=32.0 requisite:max_count=1
</pre>
</p>
<p>
No RESOURCE statements need be included since only the infinite resource is
used (by default, since we don't specify another resource's name)
# To create an environment with two resources that are converted back and
forth as tasks are performed, we might have:
<pre>
RESOURCE yummyA:initial=1000
RESOURCE yummyB:initial=1000
REACTION AtoB gobbleA process:resource=yummyA:frac=0.001:product=yummyB
REACTION BtoA gobbleB process:resource=yummyB:frac=0.001:product=yummyA
</pre>
</p>
<p>
A value of 1.0 per reaction is default. Obviously <code>gobbleA</code> and
<code>gobbleB</code> would have to be tasks described within Avida.
</p>
<p>
A requisite against the other reaction being performed would prevent a
single organism from garnering both rewards in equal measure.
</p>
<p>
As an example, to simulate a chemostat, we might have:
<pre>
RESOURCE glucose:inflow=100:outflow=0.01
</pre>
</p>
<p>
This would create a resource called "glucose" that has a fixed inflow rate of
10000 units where 20% flows out every update. (Leaving a steady state of
50,000 units if no organism-consumption occurs).
</p>
<p>
Limitations to this system:
<ul>
<li>
Only a single resource can be required at a time, and only a single
by-product can be produced.
</li>
</ul>
<p>
The default setup is:
<pre>
REACTION NOT not process:value=1.0:type=pow requisite:max_count=1
REACTION NAND nand process:value=1.0:type=pow requisite:max_count=1
REACTION AND and process:value=2.0:type=pow requisite:max_count=1
REACTION ORN orn process:value=2.0:type=pow requisite:max_count=1
REACTION OR or process:value=3.0:type=pow requisite:max_count=1
REACTION ANDN andn process:value=3.0:type=pow requisite:max_count=1
REACTION NOR nor process:value=4.0:type=pow requisite:max_count=1
REACTION XOR xor process:value=4.0:type=pow requisite:max_count=1
REACTION EQU equ process:value=5.0:type=pow requisite:max_count=1
</pre>
</p>
<p>
This creates an environment where the organisms get a bonus for performing
any of nine tasks. Since none of the reactions are associated with a
resource, the infinite resource is assumed, which is non-depeletable.
The max_count of one means they can only get the bonus from each reaction
a single time.
</p>
<p>
A similar setup that has 9 resources, one corresponding to each of the nine
possible tasks listed above is:
<pre>
RESOURCE resNOT:inflow=100:outflow=0.01 resNAND:inflow=100:outflow=0.01
RESOURCE resAND:inflow=100:outflow=0.01 resORN:inflow=100:outflow=0.01
RESOURCE resOR:inflow=100:outflow=0.01 resANDN:inflow=100:outflow=0.01
RESOURCE resNOR:inflow=100:outflow=0.01 resXOR:inflow=100:outflow=0.01
RESOURCE resEQU:inflow=100:outflow=0.01
REACTION NOT not process:resource=resNOT:value=1.0:frac=0.0025
REACTION NAND nand process:resource=resNAND:value=1.0:frac=0.0025
REACTION AND and process:resource=resAND:value=2.0:frac=0.0025
REACTION ORN orn process:resource=resORN:value=2.0:frac=0.0025
REACTION OR or process:resource=resOR:value=4.0:frac=0.0025
REACTION ANDN andn process:resource=resANDN:value=4.0:frac=0.0025
REACTION NOR nor process:resource=resNOR:value=8.0:frac=0.0025
REACTION XOR xor process:resource=resXOR:value=8.0:frac=0.0025
REACTION EQU equ process:resource=resEQU:value=16.0:frac=0.0025
</pre>
</p>
<H2>Other Commands</H2>
<h3>SET_ACTIVE Command</h3>
<p>
Allows user to activate or deactivate a reaction. If this command is not
used all reactions are active.
</p>
<pre>
<a name="SET_ACTIVE">SET_ACTIVE</a> type name new_status(default=true)
</pre>
<blockquote>
<P>
Where <code>type</code> is the type of command to activate/deactivate.
Currently <b>REACTION</b> is the only choice.
</P>
<p>
Where <code>name</code> is the name of the item to activate/deactivate.
</p>
<p>
Where <code>new_status</code> sets if the item is active (0 or FALSE will
deactivate).
</Blockquote>