Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/simple/SimpleInitializer.java @ 6703

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

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

File size: 1.6 KB
RevLine 
[6152]1/*
2  Copyright 2006 by Sean Luke
3  Licensed under the Academic Free License version 3.0
4  See the file "LICENSE" for more information
5*/
6
7
8package ec.simple;
9import ec.Initializer;
10import ec.EvolutionState;
11import ec.util.Parameter;
12import ec.Population;
13
14/*
15 * SimpleInitializer.java
16 *
17 * Created: Tue Aug 10 21:07:42 1999
18 * By: Sean Luke
19 */
20
21/**
22 * SimpleInitializer is a default Initializer which initializes a Population
23 * by calling the Population's populate(...) method.  For most applications,
24 * this should suffice.
25 *
26 * @author Sean Luke
27 * @version 1.0
28 */
29
30public class SimpleInitializer extends Initializer
31    {
32    public void setup(final EvolutionState state, final Parameter base)
33        {
34        }
35
36    /** Creates, populates, and returns a new population by making a new
37        population, calling setup(...) on it, and calling populate(...)
38        on it, assuming an unthreaded environment (thread 0).
39        Obviously, this is an expensive method.  It should only
40        be called once typically in a run. */
41
42    public Population initialPopulation(final EvolutionState state, int thread)
43        {
44        Population p = setupPopulation(state, thread);
45        p.populate(state, thread);
46        return p;
47        }
48               
49    public Population setupPopulation(final EvolutionState state, int thread)
50        {
51        Parameter base = new Parameter(P_POP);
52        Population p = (Population) state.parameters.getInstanceForParameterEq(base,null,Population.class);  // Population.class is fine
53        p.setup(state,base);
54        return p;
55        }
56    }
Note: See TracBrowser for help on using the repository browser.