Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/spatial/SpatialMultiPopCoevolutionaryEvaluator.java @ 6152

Last change on this file since 6152 was 6152, checked in by bfarka, 13 years ago

added ecj and custom statistics to communicate with the okb services #1441

File size: 1.4 KB
Line 
1/*
2  Copyright 2006 by Sean Luke and George Mason University
3  Licensed under the Academic Free License version 3.0
4  See the file "LICENSE" for more information
5*/
6
7package ec.spatial;
8
9import ec.*;
10import ec.util.*;
11import ec.coevolve.*;
12
13/*
14 * SpatialMultiPopCoevolutionaryEvaluator.java
15 *
16 * By: Liviu Panait and Sean Luke
17 */
18
19/**
20 * SpatialMultiPopCoevolutionaryEvaluator implements a coevolutionary evaluator involving multiple
21 * spatially-embedded subpopulations.  You ought to use it in conjuction with SpatialTournamentSelection
22 * (for selecting current-generation individuals, set the tournament selection size to 1, which will
23 * pick randomly from the space).
24 *
25 * @author Liviu Panait Sean Luke
26 * @version 2.0
27 */
28
29public class SpatialMultiPopCoevolutionaryEvaluator extends MultiPopCoevolutionaryEvaluator
30    {
31    protected Individual produce(SelectionMethod method, int subpopulation, int individual, EvolutionState state, int thread)
32        {
33        if (!(state.population.subpops[subpopulation] instanceof Space))
34            state.output.fatal("Subpopulation " + subpopulation + " is not a Space.");
35                       
36        Space space = (Space)(state.population.subpops[subpopulation]);
37        space.setIndex(thread, individual);
38               
39        return state.population.subpops[subpopulation].individuals[method.produce(subpopulation, state, thread)];
40        }
41    }
Note: See TracBrowser for help on using the repository browser.