Last change
on this file since 1174 was
1139,
checked in by Maciej Komosinski, 4 years ago
|
Added --debug mode that prints names of steps; final multiple evaluation now evaluates genotypes in hall of fame instead of the last population
|
File size:
559 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, *args, **kwargs): |
---|
9 | super(IdentitySelection, self).__init__(copy, *args, **kwargs) |
---|
10 | |
---|
11 | def call(self, population, selection_size=None): |
---|
12 | super(IdentitySelection, self).call(population) |
---|
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.