source: java/ecj/cecj/sampling/SamplingMethod.java @ 35

Last change on this file since 35 was 28, checked in by mszubert, 15 years ago

cecj - coEvolutionary Computation in Java with additional games package

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 1.2 KB
Line 
1package cecj.sampling;
2
3import java.util.Arrays;
4import java.util.List;
5
6import ec.EvolutionState;
7import ec.Individual;
8import ec.Setup;
9
10/**
11 * A method of sampling a collection of individuals. Defines methods used by
12 * <code>CoevolutionaryEvaluator</code> to choose opponents for evaluating concrete individual.
13 *
14 * @author Marcin Szubert
15 *
16 */
17public abstract class SamplingMethod implements Setup {
18
19        /**
20         * Samples the subpopulation specified by <code>subpop</code> index and puts the results into
21         * the <code>inds</code> array.
22         *
23         * @param state
24         *            current evolution state
25         * @param subpop
26         *            the index of sampled subpopulation
27         * @param inds
28         *            the array of sampling results
29         */
30        public List<Individual> sample(EvolutionState state, Individual[] source) {
31                return this.sample(state, Arrays.asList(source));
32        }
33
34        /**
35         * Samples given list of individuals and puts the results int the <code>inds</code> array.
36         *
37         * @param state
38         *            current evolution state
39         * @param list
40         *            the list of individuals to be sampled
41         * @param inds
42         *            the array of sampling results
43         */
44        public abstract List<Individual> sample(EvolutionState state, List<Individual> source);
45}
Note: See TracBrowser for help on using the repository browser.