You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fitness values of a population might contain positive AND negative values in OptProb.eval_mate_probs(). Thus its sum might be positive, negative, or even accidentally zero. So we have to be more careful to avoid negative probabilities that arrive if the sum of the probabilities has a different sign than the probability of a member.
`
Set -1*inf values to 0 to avoid dividing by sum of infinity.
# This forces mate_probs for these pop members to 0.
pop_fitness[pop_fitness == -1.0*np.inf] = 0
# Fitness of the population might contain positive AND negative values.
# Thus its sum can be positive, negative or even accidentally zero.
# All fitness values are zero
if np.count_nonzero(pop_fitness) == 0:
self.mate_probs = np.ones(len(pop_fitness)) \
/ len(pop_fitness)
else:
# Make all values positive, the smallest will be offset by the sdev of the data
pop_fitness += (pop_fitness.min() + pop_fitness.std())
self.mate_probs = pop_fitness/np.sum(pop_fitness)
`
The text was updated successfully, but these errors were encountered:
The fitness values of a population might contain positive AND negative values in
OptProb.eval_mate_probs().
Thus its sum might be positive, negative, or even accidentally zero. So we have to be more careful to avoid negative probabilities that arrive if the sum of the probabilities has a different sign than the probability of a member.`
Set -1*inf values to 0 to avoid dividing by sum of infinity.
`
The text was updated successfully, but these errors were encountered: