public class Resources
extends java.lang.Object
Resources
.
Resources
object is passed to modules as the program operates, and
the actual parameter values can be obtained using getter methods. Note that, for code brevity,
this class's getters do not start with the word "get". For instance, to get the number of rows,
one would use rows()
instead of getRows()
which doesn't exist.
The fitness orientation of the problem being solved can also be retrieved using fitnessOrientation()
.
Evolutionary strategies will typically use this to perform selection.
getRandomInt()
and getRandomDouble()
as these methods
use a particular Random
object guaranteed to generate random numbers based on the seed
parameter. Functions from the selected function set can be obtained through this class as well.
Finally, printing to the console should be done via the resources using the report and print
methods, so that these prints also get sent to the GUI console (if one is present).Parameter
Constructor and Description |
---|
Resources() |
Modifier and Type | Method and Description |
---|---|
int |
arity() |
int |
columns() |
int |
currentGeneration() |
int |
currentRun() |
BestFitness |
fitnessOrientation() |
int |
generations() |
Function |
getFunction(int index)
Gets the indexed function out of the
complete set of functions.
|
int |
getFunctionIndex(Function function)
Returns the index of a specified function.
|
FunctionSet |
getFunctionSet() |
double |
getRandomDouble()
Gets the next random integer using the experiment's random
number generator.
|
double |
getRandomDouble(int limit)
Gets the next random double using the experiment's random
number generator.
|
Function |
getRandomFunction()
Gets a random allowed function from the problem function set.
|
int |
getRandomInt(int limit)
Gets the next random integer using the experiment's random
number generator.
|
int |
inputs() |
int |
levelsBack() |
int |
nodes() |
int |
outputs() |
int |
populationSize() |
void |
print(java.lang.String message)
Prints a message to the consoles ignoring
report interval.
|
void |
println(java.lang.String message)
Prints a message to the consoles ignoring
report interval.
|
void |
report(java.lang.String message)
Prints a message to the consoles taking into account the
report interval parameter.
|
int |
reportInterval() |
void |
reportln(java.lang.String message)
Prints a message to the consoles taking into account the
report interval parameter.
|
int |
rows() |
int |
runs() |
int |
seed() |
public int rows()
public int columns()
public int inputs()
public int outputs()
public int populationSize()
public int levelsBack()
public int nodes()
public int currentGeneration()
public int generations()
public int currentRun()
public int runs()
public int arity()
public int seed()
public int reportInterval()
public BestFitness fitnessOrientation()
public int getRandomInt(int limit)
limit
- the limit value.public double getRandomDouble(int limit)
limit
- the limit value.public double getRandomDouble()
public Function getRandomFunction()
getRandomInt()
to choose the random
function.public Function getFunction(int index)
index
- the function to return.public FunctionSet getFunctionSet()
public int getFunctionIndex(Function function)
function
- the function with unknown index.public void reportln(java.lang.String message)
message
- the message to print.public void report(java.lang.String message)
message
- the message to print.public void println(java.lang.String message)
message
- the message to print.public void print(java.lang.String message)
message
- the message to print.