Last change
on this file was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
973 bytes
|
Line | |
---|
1 | package framsticks; |
---|
2 | |
---|
3 | import ec.BreedingPipeline; |
---|
4 | import ec.EvolutionState; |
---|
5 | import ec.Individual; |
---|
6 | import ec.util.Parameter; |
---|
7 | |
---|
8 | public class FramsticksMutationPipeline extends BreedingPipeline { |
---|
9 | |
---|
10 | public static final String P_MUTATION = "mutate"; |
---|
11 | public static final int NUM_SOURCES = 1; |
---|
12 | |
---|
13 | @Override |
---|
14 | public int numSources() { |
---|
15 | return NUM_SOURCES; |
---|
16 | } |
---|
17 | |
---|
18 | @Override |
---|
19 | public int produce(int min, int max, int start, int subpopulation, Individual[] inds, |
---|
20 | EvolutionState state, int thread) { |
---|
21 | int n = sources[0].produce(min, max, start, subpopulation, inds, state, thread); |
---|
22 | |
---|
23 | if (!(sources[0] instanceof BreedingPipeline)) |
---|
24 | for (int q = start; q < n + start; q++) |
---|
25 | inds[q] = (Individual) (inds[q].clone()); |
---|
26 | |
---|
27 | for (int q = start; q < n + start; q++) { |
---|
28 | ((FramsticksIndividual) inds[q]).mutate(state); |
---|
29 | ((FramsticksIndividual) inds[q]).evaluated = false; |
---|
30 | } |
---|
31 | |
---|
32 | return n; |
---|
33 | } |
---|
34 | |
---|
35 | public Parameter defaultBase() { |
---|
36 | return FramsticksDefaults.base().push(P_MUTATION); |
---|
37 | } |
---|
38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.