public override DecisionNetDNA <T> mutate() { DecisionNetDNA <T> mutated = Clone(); mutated.m_weights = MatrixCalc.elementwiseRandomMultiply(m_weights, m_mutation_multiplier); mutated.m_weights = MatrixCalc.columnNormalize(mutated.m_weights); return(mutated); }
public DecisionNetDNA(int p_id, DInputFactory <T>[] p_inputs, DOutputFactory <T>[] p_outputs, Matrix <float> p_weights, Range <float> p_mutation_multiplier) { if (!MatrixCalc.isSize(p_weights, p_inputs.Length, p_outputs.Length)) { Debug.LogError("DecisionNetDNA requires Matrix input size inputs by outputs"); } m_id = p_id; m_inputs = ArrayCalc.shallowClone(p_inputs); m_outputs = ArrayCalc.shallowClone(p_outputs); m_weights = MatrixCalc.shallowClone(MatrixCalc.columnNormalize(p_weights)); m_mutation_multiplier = p_mutation_multiplier; }