public TxAutotrophChrome2 Crossover(ref Random random) { int a = random.NextInt(0, TxAutotrophChrome2.LENGTH); int b = random.NextInt(0, TxAutotrophChrome2.LENGTH); if (a > b) { var temp = a; a = b; b = temp; } var result = new TxAutotrophChrome2(); for (int i = 0; i < a; i++) { result[i] = ValueA[i]; } for (int i = a; i < b; i++) { result[i] = ValueB[i]; } for (int i = b; i < TxAutotrophChrome2.LENGTH; i++) { result[i] = ValueA[i]; } return(result); }
public TxAutotrophChrome2 Copy() { var result = new TxAutotrophChrome2(); for (int i = 0; i < LENGTH; i++) { result[i] = this[i]; } return(result); }
public TxAutotrophChrome2 MaxNorm() { var result = new TxAutotrophChrome2(); for (int i = 0; i < TxAutotrophChrome2.LENGTH; i++) { result[i] = (ValueA[i] + ValueB[i]) / MAX; } return(result); }