internal override Agent CrossOver(Agent _partner) { FCAgent partner = (FCAgent)_partner; FCAgent child = new FCAgent(topology); for (int i = 1; i < topology.Length; i++) { for (int j = 0; j < topology[i]; j++) { for (int k = 0; k < this.layers[i].Nodes[j].weights.Length; k++) { child.layers[i].Nodes[j].weights[k] = RandomDouble() < 0.5 ? this.layers[i].Nodes[j].weights[k] : partner.layers[i].Nodes[j].weights[k]; if (RandomDouble() < MutationRate) { child.layers[i].Nodes[j].weights[k] = RandomDouble() * 2 - 1; } if (RandomDouble() < MutationRate * 10) { child.layers[i].Nodes[j].weights[k] += MutationRate * (RandomDouble() * 2 - 1); } } } } return((Agent)child); }
public FCAgent(FCAgent n) { topology = n.topology; layers = new Layer[topology.Length]; for (int i = 0; i < topology.Length; i++) { layers[i] = new Layer(topology, i, n.layers[i]); } }
public override void SetSubAgent(FCAgent ewa) { if (ewa != null) { _attackBase = ewa as AttackBase; } else { _attackBase = null; } }
public virtual void SetSubAgent(FCAgent ewa) { }