aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/Utilities.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/Utilities.java')
-rw-r--r--src/jcgp/Utilities.java78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/jcgp/Utilities.java b/src/jcgp/Utilities.java
index f052595..394a481 100644
--- a/src/jcgp/Utilities.java
+++ b/src/jcgp/Utilities.java
@@ -25,62 +25,6 @@ public class Utilities {
}
/**
- * Returns a random allowed connection respecting levels back.
- * This method may always pick inputs, as they can be picked
- * regardless of the column.
- *
- * TODO remove?
- *
- * @param chromosome the chromosome to pick from
- * @param column the column to use as reference
- * @return a random connection
- */
- public static Connection getRandomConnection(Chromosome chromosome, int column){
- // work out the allowed range obeying levels back
- int allowedColumns = ((column >= Parameters.getLevelsBack()) ? Parameters.getLevelsBack() : column);
- int offset = column - allowedColumns;
-
- // choose input or node
- int connectionType = getRandomInt(Parameters.getInputs() + (Parameters.getRows() * allowedColumns));
- if (connectionType < Parameters.getInputs()) {
- // input
- return chromosome.getInput(getRandomInt(Parameters.getInputs()));
- } else {
- // node
- return chromosome.getNode(getRandomInt(Parameters.getRows()), getRandomInt(allowedColumns) + offset);
- }
- }
-
- /**
- * Returns a random allowed connection.
- *
- * This method may always pick inputs, as they can be picked
- * regardless of the column.
- *
- * TODO remove?
- *
- * @param chromosome the chromosome to pick from
- * @param column the column to use as reference
- * @param levelsBack whether or not to respect levels back
- * @return a random connection
- */
- public static Connection getRandomConnection(Chromosome chromosome, int column, boolean levelsBack){
- if (levelsBack) {
- return getRandomConnection(chromosome, column);
- } else {
- // choose input or node
- int connectionType = getRandomInt(Parameters.getInputs() + (Parameters.getRows() * column));
- if (connectionType < Parameters.getInputs()) {
- // input
- return chromosome.getInput(getRandomInt(Parameters.getInputs()));
- } else {
- // node
- return chromosome.getNode(getRandomInt(Parameters.getRows()), getRandomInt(column));
- }
- }
- }
-
- /**
* @param chromosome the chromosome to choose from
* @return a random input
*/
@@ -131,28 +75,6 @@ public class Utilities {
}
}
- /**
- * This method picks a random mutable element from the given chromosome.
- *
- * It will pick outputs or nodes fairly.
- *
- * TODO probably remove this
- *
- * @param chromosome the chromosome to pick from
- * @return a random mutable element
- */
- public static MutableElement getRandomMutable(Chromosome chromosome){
- // choose output or node
- int connectionType = getRandomInt(Parameters.getOutputs() + Parameters.getNodeCount());
-
- if (connectionType < Parameters.getOutputs()) {
- // outputs
- return chromosome.getOutput(getRandomInt(Parameters.getOutputs()));
- } else {
- // node
- return chromosome.getNode(getRandomInt(Parameters.getRows()), getRandomInt(Parameters.getRows()));
- }
- }
/**
* pick from any column - use this for setting outputs