def get_selective_mirrors(self, number=None):
"""get mirror genotypic directions from worst solutions.
Details:
To be called after the mean has been updated.
Takes the last ``number=sp.lam_mirr`` entries in the
``self.pop[self.fit.idx]`` as solutions to be mirrored.
Do not take a mirror if it is suspected to stem from a
previous mirror in order to not go endlessly back and forth.
"""
if number is None:
number = self.sp.lam_mirr
if not hasattr(self, '_indices_of_selective_mirrors'):
self._indices_of_selective_mirrors = []
res = []
for i in range(1, number + 1):
if 'all-selective-mirrors' in self.opts['vv'] or self.fit.idx[-i] not in self._indices_of_selective_mirrors:
res.append(self.mean_old - self.pop[self.fit.idx[-i]])
assert len(res) >= number - len(self._indices_of_selective_mirrors)
return res
# ____________________________________________________________
评论列表
文章目录