Last change
on this file since 10501 was
6152,
checked in by bfarka, 14 years ago
|
added ecj and custom statistics to communicate with the okb services #1441
|
File size:
1.3 KB
|
Line | |
---|
1 | /* |
---|
2 | Portions copyright 2010 by Sean Luke, Robert Hubley, and George Mason University |
---|
3 | Licensed under the Academic Free License version 3.0 |
---|
4 | See the file "LICENSE" for more information |
---|
5 | */ |
---|
6 | |
---|
7 | |
---|
8 | package ec.multiobjective.spea2; |
---|
9 | import ec.*; |
---|
10 | import ec.select.*; |
---|
11 | import ec.simple.*; |
---|
12 | |
---|
13 | /* |
---|
14 | * SPEA2TournamentSelection.java |
---|
15 | * |
---|
16 | * Created: Sat Oct 16 11:24:43 EDT 2010 |
---|
17 | * By: Sean Luke |
---|
18 | * Replaces earlier class by: Robert Hubley, with revisions by Gabriel Balan and Keith Sullivan |
---|
19 | */ |
---|
20 | |
---|
21 | /** |
---|
22 | * This is a special version of TournamentSelection which restricts the selection to only |
---|
23 | * the archive region (the top 'archiveSize' elements in the subpopulation). |
---|
24 | */ |
---|
25 | |
---|
26 | // This all assumes that the archive is the LAST N INDIVIDUALS in the individuals array |
---|
27 | public class SPEA2TournamentSelection extends TournamentSelection |
---|
28 | { |
---|
29 | public int getRandomIndividual(int number, int subpopulation, EvolutionState state, int thread) |
---|
30 | { |
---|
31 | Individual[] oldinds = state.population.subpops[subpopulation].individuals; |
---|
32 | int archiveSize = ((SimpleBreeder)(state.breeder)).elite[subpopulation]; |
---|
33 | int archiveStart = state.population.subpops[subpopulation].individuals.length - archiveSize; |
---|
34 | |
---|
35 | return archiveStart + state.random[thread].nextInt(archiveSize); |
---|
36 | } |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.