diff options
Diffstat (limited to 'src/jcgp/backend/population/Mutable.java')
-rw-r--r-- | src/jcgp/backend/population/Mutable.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/jcgp/backend/population/Mutable.java b/src/jcgp/backend/population/Mutable.java index 3ce7065..a5cbe37 100644 --- a/src/jcgp/backend/population/Mutable.java +++ b/src/jcgp/backend/population/Mutable.java @@ -8,8 +8,8 @@ package jcgp.backend.population; * <br><br> * This interface provides a way to deal with mutable elements * generically without having to specify whether they are nodes - * or outputs. In this way a random mutable element can be picked and - * dealt with more easily, facilitating mutations. + * or outputs. When mutating a mutable, {@code mutate()} is guaranteed + * to perform a fair mutation. * * @author Eduardo Pedroni * @@ -17,14 +17,16 @@ package jcgp.backend.population; public interface Mutable { /** - * This method sets the indexed connection to the specified new connection. - * Implementing classes may choose to ignore the given index (such as in the - * case of outputs, which only have one connection). - * - * @param index the connection index to set. - * @param newConnection the chromosome element to connect to. + * This method performs an arbitrary mutation on the {@code Mutable}. + * <br><br> + * In the case of nodes, this chooses to mutate a function or connection + * fairly, and carries out the required mutation by using the node's own + * reference to chromosome. + * <br><br> + * In the case of outputs, this simply picks a random connection to serve + * as the source - any connection is allowed. */ - public void setConnection(int index, Connection newConnection); + public void mutate(); /** * Asserts if the specified element is a copy of the elements @@ -48,6 +50,6 @@ public interface Mutable { * @param element the mutable element to compare to. * @return true if {@code element} is a copy of this element. */ - boolean copyOf(Mutable element); + public boolean copyOf(Mutable element); } |