package jcgp.backend.population; /** * {@code Mutable} declares the expected behaviour of any * part of a chromosome that is mutable, more specifically * nodes or outputs. Inputs are not mutable since they don't have * connections or functions. *

* This interface provides a way to deal with mutable elements * generically without having to specify whether they are nodes * or outputs. When mutating a mutable, {@code mutate()} is guaranteed * to perform a fair mutation. * * @author Eduardo Pedroni * */ public interface Mutable { /** * This method performs an arbitrary mutation on the {@code Mutable}. *

* 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. *

* In the case of outputs, this simply picks a random connection to serve * as the source - any connection is allowed. */ public void mutate(); /** * Asserts if the specified element is a copy of the elements * this is called on.
* This method returns true if and only if: * *

* The relationship computed by this method is: * * @param element the mutable element to compare to. * @return true if {@code element} is a copy of this element. */ public boolean copyOf(Mutable element); }