| Conditions | 4 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # Author: Simon Blanke |
||
| 31 | def _create_population(self, Optimizer): |
||
| 32 | if isinstance(self.population, int): |
||
| 33 | population = [] |
||
| 34 | for pop_ in range(self.population): |
||
| 35 | population.append( |
||
| 36 | Optimizer(self.conv.search_space, rand_rest_p=self.rand_rest_p) |
||
| 37 | ) |
||
| 38 | else: |
||
| 39 | population = self.population |
||
| 40 | |||
| 41 | n_inits = get_n_inits(self.initialize) |
||
| 42 | |||
| 43 | if n_inits < len(population): |
||
| 44 | print("\n Warning: Not enough initial positions for population size") |
||
| 45 | print(" Population size is reduced to", n_inits) |
||
| 46 | population = population[:n_inits] |
||
| 47 | |||
| 48 | return population |
||
| 49 | |||
| 52 |