public static SpConnection GetConnectionFromGene(SpConnectionGene gene, SpNeuron source, SpikeNet net) { var connection = new SpConnection(); connection.ImprintGene(gene, source, net); return(connection); }
public SpConnectionGene Clone() { var gene = new SpConnectionGene(); gene.Target = Target; gene.Strength = Strength; gene.Delay = Delay; return(gene); }
public void ImprintGene(SpConnectionGene gene, SpNeuron source, SpikeNet net) { SpNeuron target; if (gene.IsOutputConnection) { target = net.OutputNeurons[gene.Target]; } else { target = net.HiddenNeurons[gene.Target]; } Source = source; Target = target; Weight = gene.Strength.Value; Delay = (int)Math.Round(gene.Delay.Value * MaxDelay, 0); }
public SpConnectionGene GetRandomConnection(int target, bool isOutputConnection) { var gene = new SpConnectionGene(); double strength = Pseudo.Random.NextDouble(0, 1); if (InhibitoryConnectionChance > Pseudo.Random.NextDouble()) { strength = -strength; } gene.Strength.Value = strength; gene.Delay.Value = Pseudo.Random.NextDouble(gene.Delay.Min, gene.Delay.Max); gene.Target = target; gene.IsOutputConnection = isOutputConnection; return(gene); }