|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectWorld
public class World
The World
class represents the world in which the simulation takes place.
The main components of the World
object are the population of organisms and the resource pool.
Both these are defined using the Vector
class.
Field Summary | |
---|---|
static int |
avg
The number of updates the efficiency is averaged over |
double |
bitflipProb
The bit flip probability of inflowing strings |
int |
entropyLevel
The level of entropy calculation |
boolean[] |
fixedString
In the case of fixed strings this is the inflowing string |
double |
flow
The flow rate of bit strings |
double |
inEntropy
The entropy of the inflowing strings |
int[][] |
interactions
The matrix holding interactions between the species. |
int |
noDivisions
Counter for the number of organism divisions |
double |
noStringsFlowing
Counter for the number of bit strings flowing into the system |
java.util.Vector<Organism> |
organisms
A Vector containing all the organisms in the World |
double[] |
productivity
An array that holds of the productivity for the last avg time steps |
int |
randomMode
When strings are random this declares the type of strings being used |
boolean |
randomStrings
True if random bit strings are used |
java.util.Vector<BString> |
resources
A Vector containing all the bit strings in the World |
int |
stringLength
The length of the bit strings |
Constructor Summary | |
---|---|
World(int popSize,
int foodSize,
double flow,
boolean[] fixedString,
int entropyLevel)
Creates a World with a flow of fixed strings |
|
World(int popSize,
int foodSize,
int stringLength,
double flow,
double bitflipProb,
int randomMode,
int entropyLevel)
Creates a World with a flow of random strings |
Method Summary | |
---|---|
void |
addInt(java.util.Vector<java.lang.Integer> H)
Adds an interaction to the matrix I |
void |
fakeUpdate()
Updates all organisms in the population without carrying out the actual divisions |
double |
getAvgAge()
The average age of the organisms |
double |
getAvgEntropy()
The average entropy of bit strings |
double |
getAvgIO()
The average IO (entropy difference) of the organisms |
double |
getAvgProd()
The average amount of energy that has been extracted from the bit strings. |
double |
getAvgStringAge()
The average age of the bit strings. |
int |
getDivides()
The total number of organism divisions that have occured in the system |
double |
getEff()
The average efficiency of the organisms, defined as the average IO divided by the maximum amount of energy that can be extracted from the strings |
double |
getFraction(int rule)
The fraction of the population that corresponds to a given rule |
double |
getIO(int rule)
The average IO (entropy difference) of organisms of a certain genotype |
int |
getNoPhenotypes(double frac)
The number of genotypes/rules that exist above a certain threshold |
double[] |
getState()
Returns the species distribution |
void |
Inoculate(int[] rules,
double[] fracs)
Setting the rule frequency to defined values |
void |
saveEff(java.lang.String file)
Saves the average efficiency in a data file |
void |
saveFoodEntropy(int t)
Saves the entropy of all strings to a data file parametrised by time |
void |
saveFoodHistory(int t)
Saves the metablic history of all strings to a data file parametrised by time |
void |
saveGenotypes(int t,
double frac)
Saves all genotypes above a certain fraction to a data file parametrised by time |
void |
saveInts(java.lang.String file)
Saves the interaction matrix interactions in a data file |
void |
saveState(java.lang.String file)
Saves the no. of organisms in each species (rule) in a data file |
void |
saveStats(java.lang.String file,
java.lang.String stats)
Saves any information in a data file |
void |
setEntLevel(int x)
Sets the level at which the entropy is calculated |
void |
setFlow(double fl)
Sets the flow rate |
void |
setMutRate(double pc)
Sets the mutation rate |
BString |
swapString(BString S)
Swaps the specified bit string with a random string from the resource pool |
void |
update()
Updates all organisms in the population, takes care of the swapping of strings, and calls the divide method of Organism |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.util.Vector<Organism> organisms
public java.util.Vector<BString> resources
public int stringLength
public int noDivisions
public int entropyLevel
public double noStringsFlowing
public double flow
public double bitflipProb
public boolean[] fixedString
public boolean randomStrings
public int randomMode
public int[][] interactions
public double[] productivity
avg
time steps
public static int avg
public double inEntropy
Constructor Detail |
---|
public World(int popSize, int foodSize, int stringLength, double flow, double bitflipProb, int randomMode, int entropyLevel)
popSize
- the number of agents in the populationfoodSize
- the number of bit strings in the resource poolstringLength
- the length of the bit stringsflow
- the flow rate of new strings into the systembitflipProb
- the bitflip probability of the inflowing stringsrandomMode
- the type of random strings flowing into the systementropyLevel
- the block length at which the entropy is calculatedBString.BString(int, double, int)
public World(int popSize, int foodSize, double flow, boolean[] fixedString, int entropyLevel)
popSize
- the number of agents in the populationfoodSize
- the number of bit strings in the resource poolflow
- the flow rate of new strings into the systemfixedString
- the bit string that flows into the systementropyLevel
- the block length at which the entropy is calculatedMethod Detail |
---|
public void Inoculate(int[] rules, double[] fracs)
rules
- the rules with non-zero abundancefracs
- the corresponding frequencies. Should sum to one.public double getAvgEntropy()
public double getAvgIO()
public double getIO(int rule)
rule
- the genotype under consideration
public double getAvgAge()
public double getAvgStringAge()
public double getAvgProd()
public double getEff()
public int getDivides()
public int getNoPhenotypes(double frac)
frac
- the threshold
public double getFraction(int rule)
rule
- the rule
public void setEntLevel(int x)
x
- the levelpublic void setFlow(double fl)
fl
- the ratepublic void setMutRate(double pc)
pc
- the mutation ratepublic void addInt(java.util.Vector<java.lang.Integer> H)
H
- the metabolic history of the bit string manifesting the interactionpublic void update()
Organism.divide()
,
swapString(BString)
public void fakeUpdate()
swapString(BString)
public BString swapString(BString S)
S
- the bit string to be swapped
public void saveGenotypes(int t, double frac) throws java.io.IOException, java.io.FileNotFoundException
t
- the time, used for naming the data filefrac
- the threshold value
java.io.IOException
java.io.FileNotFoundException
public void saveFoodHistory(int t) throws java.io.IOException, java.io.FileNotFoundException
t
- the time, used for naming the data file
java.io.IOException
java.io.FileNotFoundException
public void saveFoodEntropy(int t) throws java.io.IOException, java.io.FileNotFoundException
t
- the time, used for naming the data file
java.io.IOException
java.io.FileNotFoundException
public void saveState(java.lang.String file) throws java.io.IOException, java.io.FileNotFoundException
file
- the name of the data file
java.io.IOException
java.io.FileNotFoundException
public double[] getState()
public void saveStats(java.lang.String file, java.lang.String stats) throws java.io.IOException, java.io.FileNotFoundException
file
- the name of the data filestats
- the data that is being written
java.io.IOException
java.io.FileNotFoundException
public void saveInts(java.lang.String file) throws java.io.IOException, java.io.FileNotFoundException
interactions
in a data file
file
- the name of the data file
java.io.IOException
java.io.FileNotFoundException
addInt(Vector)
public void saveEff(java.lang.String file) throws java.io.IOException, java.io.FileNotFoundException
file
- the name of the data file
java.io.IOException
java.io.FileNotFoundException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |