def firstNonFullGeneration(self, swarmId, minNumParticles):
if not swarmId in self._swarmNumParticlesPerGeneration:<EOL><INDENT>return None<EOL><DEDENT>numPsPerGen = self._swarmNumParticlesPerGeneration[swarmId]<EOL>numPsPerGen = numpy.array(numPsPerGen)<EOL>firstNonFull = numpy.where(numPsPerGen < minNumParticles)[<NUM_LIT:0>]<EOL>if len(firstNonFull) == <NUM_LIT:0>:<EOL><INDENT>return len(numPsPerGen)<EOL><DEDENT>else:<EOL><INDENT>return firstNonFull[<NUM_LIT:0>]<EOL><DEDENT>
Return the generation index of the first generation in the given
        swarm that does not have numParticles particles in it, either still in the
        running state or completed. This does not include orphaned particles.

        Parameters:
        ---------------------------------------------------------------------
        swarmId:  A string representation of the sorted list of encoders in this
                     swarm. For example '__address_encoder.__gym_encoder'
        minNumParticles: minium number of partices required for a full
                      generation.

        retval:  generation index, or None if no particles at all.