Last change
on this file since 886 was
193,
checked in by Maciej Komosinski, 11 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | Copyright 2009 by Marcin Szubert |
---|
3 | Licensed under the Academic Free License version 3.0 |
---|
4 | */ |
---|
5 | |
---|
6 | package cecj.archive; |
---|
7 | |
---|
8 | import java.util.ArrayList; |
---|
9 | import java.util.Arrays; |
---|
10 | import java.util.List; |
---|
11 | |
---|
12 | import ec.EvolutionState; |
---|
13 | import ec.Group; |
---|
14 | import ec.Individual; |
---|
15 | import ec.Subpopulation; |
---|
16 | import ec.util.Parameter; |
---|
17 | |
---|
18 | /** |
---|
19 | * |
---|
20 | * @author Marcin Szubert |
---|
21 | * |
---|
22 | */ |
---|
23 | public class ArchivingSubpopulation extends Subpopulation { |
---|
24 | |
---|
25 | private List<Individual> archiveIndividuals; |
---|
26 | |
---|
27 | @Override |
---|
28 | public void setup(EvolutionState state, Parameter base) { |
---|
29 | super.setup(state, base); |
---|
30 | archiveIndividuals = new ArrayList<Individual>(); |
---|
31 | } |
---|
32 | |
---|
33 | @Override |
---|
34 | public Group emptyClone() { |
---|
35 | ArchivingSubpopulation subpopulation = (ArchivingSubpopulation) super.emptyClone(); |
---|
36 | subpopulation.archiveIndividuals = archiveIndividuals; |
---|
37 | return subpopulation; |
---|
38 | } |
---|
39 | |
---|
40 | /** |
---|
41 | * Returns the list of archival individuals. |
---|
42 | * |
---|
43 | * @return the list of archival individuals |
---|
44 | */ |
---|
45 | public List<Individual> getArchivalIndividuals() { |
---|
46 | return archiveIndividuals; |
---|
47 | } |
---|
48 | |
---|
49 | /** |
---|
50 | * Returns the list of population individuals. |
---|
51 | * |
---|
52 | * @return the list of population individuals |
---|
53 | */ |
---|
54 | public List<Individual> getIndividuals() { |
---|
55 | return Arrays.asList(individuals); |
---|
56 | } |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.