source:
framspy/evolalg/selection/identity.py
@
1113
Last change on this file since 1113 was 1113, checked in by , 4 years ago | |
---|---|
File size: 469 bytes |
Line | |
---|---|
1 | import copy |
2 | |
3 | from evolalg.base.step import Step |
4 | from evolalg.selection.selection import Selection |
5 | |
6 | |
7 | class IdentitySelection(Selection): |
8 | def __init__(self, copy=False): |
9 | super(IdentitySelection, self).__init__(copy) |
10 | |
11 | def call(self, population, selection_size=None): |
12 | res = population |
13 | if selection_size is not None: |
14 | res = population[:selection_size] |
15 | |
16 | if self.copy: |
17 | res = copy.deepcopy(res) |
18 | return res |
Note: See TracBrowser
for help on using the repository browser.