1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
package jcgp.function; import jcgp.population.Connection; public class Subtraction extends Function { @Override public int run(Connection... connections) { if (connections.length > 1) { return connections[0].evaluate() - connections[1].evaluate(); } else { return 0; } } @Override public int getArity() { return 2; } }