Last change
on this file since 1297 was
1185,
checked in by Maciej Komosinski, 2 years ago
|
Renamed a module; new name is "evolalg_steps"
|
File size:
571 bytes
|
Rev | Line | |
---|
[1113] | 1 | import copy |
---|
| 2 | |
---|
[1185] | 3 | from evolalg_steps.base.step import Step |
---|
| 4 | from evolalg_steps.selection.selection import Selection |
---|
[1113] | 5 | |
---|
| 6 | |
---|
| 7 | class IdentitySelection(Selection): |
---|
[1139] | 8 | def __init__(self, copy=False, *args, **kwargs): |
---|
| 9 | super(IdentitySelection, self).__init__(copy, *args, **kwargs) |
---|
[1113] | 10 | |
---|
| 11 | def call(self, population, selection_size=None): |
---|
[1139] | 12 | super(IdentitySelection, self).call(population) |
---|
[1113] | 13 | res = population |
---|
| 14 | if selection_size is not None: |
---|
| 15 | res = population[:selection_size] |
---|
| 16 | |
---|
| 17 | if self.copy: |
---|
| 18 | res = copy.deepcopy(res) |
---|
| 19 | return res |
---|
Note: See
TracBrowser
for help on using the repository browser.