public void DeleteHiddenLayer(LayerViewModel l) { if (HiddenLayers.Contains(l)) { HiddenLayers.Remove(l); for (int i = 0; i < HiddenLayers.Count; i++) { HiddenLayers[i].Number = i + 1; } } CanCreateChanged?.Invoke(); }
private void DelNeuron() { if (!HiddenLayers.Any()) { return; } int tmp = RandomGenerator.Next(HiddenLayers.Count); Neuron oldNeu = HiddenLayers.Values.ToList()[tmp]; foreach (var synapse in oldNeu.InputSynapses) { synapse.InputNeuron.OutputSynapses.Remove(synapse); AllSynapses.Remove(synapse.InnovationNo); } foreach (var synapse in oldNeu.OutputSynapses) { synapse.OutputNeuron.InputSynapses.Remove(synapse); AllSynapses.Remove(synapse.InnovationNo); } HiddenLayers.Remove(oldNeu.InnovationNo); }