This commit is contained in:
2023-05-24 19:27:42 +07:00
parent 635b6a728a
commit d12ba02efd

View File

@@ -422,12 +422,15 @@ function neuroplasticity!(n::outputNeuron, firedNeurons::Vector,
# add new synaptic connection to neuron # add new synaptic connection to neuron
for (i, connIndex) in enumerate(zeroWeightConnIndex) for (i, connIndex) in enumerate(zeroWeightConnIndex)
newConn::Int64 = 0 newConn::Int64 = 0
try if length(nFiredPool) != 0
newConn = popfirst!(nFiredPool) newConn = popfirst!(nFiredPool)
catch elseif length(nNonFiredPool) != 0
newConn = popfirst!(nNonFiredPool) newConn = popfirst!(nNonFiredPool)
else
# skip
end end
if newConn != 0
""" conn that is being replaced has to go into nNonFiredPool so nNonFiredPool isn't empty """ conn that is being replaced has to go into nNonFiredPool so nNonFiredPool isn't empty
""" """
push!(nNonFiredPool, n.subscriptionList[connIndex]) push!(nNonFiredPool, n.subscriptionList[connIndex])
@@ -436,6 +439,7 @@ function neuroplasticity!(n::outputNeuron, firedNeurons::Vector,
n.synapticStrength[connIndex] = synapticStrength[i] n.synapticStrength[connIndex] = synapticStrength[i]
end end
end end
end