| @@ 494-510 (lines=17) @@ | ||
| 491 | self.pmax, self.rp = pmax, rp |
|
| 492 | if ukwargs: logger.info('Unused arguments: %s' % (ukwargs)) |
|
| 493 | ||
| 494 | def postSelection(self, pop, task, **kwargs): |
|
| 495 | r"""Post selection operator. |
|
| 496 | ||
| 497 | In this algorithm the post selection operator decrements the population at specific iterations/generations. |
|
| 498 | ||
| 499 | Args: |
|
| 500 | pop (numpy.ndarray[Individual]): Current population. |
|
| 501 | task (Task): Optimization task. |
|
| 502 | kwargs (Dict[str, Any]): Additional arguments. |
|
| 503 | ||
| 504 | Returns: |
|
| 505 | numpy.ndarray[Individual]: Changed current population. |
|
| 506 | """ |
|
| 507 | Gr = task.nFES // (self.pmax * len(pop)) + self.rp |
|
| 508 | nNP = len(pop) // 2 |
|
| 509 | if task.Iters == Gr and len(pop) > 3: pop = objects2array([pop[i] if pop[i].f < pop[i + nNP].f else pop[i + nNP] for i in range(nNP)]) |
|
| 510 | return pop |
|
| 511 | ||
| 512 | def proportional(Lt_min, Lt_max, mu, x_f, avg, *args): |
|
| 513 | r"""Proportional calculation of age of individual. |
|
| @@ 263-275 (lines=13) @@ | ||
| 260 | self.rp, self.pmax = rp, pmax |
|
| 261 | if ukwargs: logger.info('Unused arguments: %s' % (ukwargs)) |
|
| 262 | ||
| 263 | def postSelection(self, pop, task, **kwargs): |
|
| 264 | r"""Post selection operator. |
|
| 265 | ||
| 266 | Args: |
|
| 267 | pop (numpy.ndarray[Individual]): Current population. |
|
| 268 | task (Task): Optimization task. |
|
| 269 | ||
| 270 | Returns: |
|
| 271 | numpy.ndarray[Individual]: New population. |
|
| 272 | """ |
|
| 273 | Gr, nNP = task.nFES // (self.pmax * len(pop)) + self.rp, len(pop) // 2 |
|
| 274 | if task.Iters == Gr and len(pop) > 3: return objects2array([pop[i] if pop[i].f < pop[i + nNP].f else pop[i + nNP] for i in range(nNP)]) |
|
| 275 | return pop |
|
| 276 | ||
| 277 | class MultiStrategySelfAdaptiveDifferentialEvolution(SelfAdaptiveDifferentialEvolution): |
|
| 278 | r"""Implementation of self-adaptive differential evolution algorithm with multiple mutation strategys. |
|