Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/coevolve/GroupedProblemForm.java @ 13229

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

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

File size: 4.7 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
7
8package ec.coevolve;
9import ec.*;
10
11/**
12 * GroupedProblemForm.java
13 *
14
15 <p>GroupedProblemForm is an interface which defines methods
16 for Problems to implement simple coevolutionary evaluation.
17 In particular, the evaluate method receives as parameters a
18 set of individuals that need to be evaluated. An additional
19 vector-parameter (updateFitness) marks which individual
20 fitnesses need to be updated during the evaluation process.
21
22 *
23 * @author Sean Luke & Liviu Panait
24 * @version 1.0
25 */
26
27public interface GroupedProblemForm
28    {
29    /** Set up the population <tt>pop</tt> (such as fitness information) prior to evaluation.
30        Although this method is not static, you should not use it to write to any instance
31        variables in the GroupedProblem instance; this is because it's possible that
32        the instance used is in fact the prototype, and you will have no guarantees that
33        your instance variables will remain valid during the evaluate(...) process.
34        Do not assume that <tt>pop</tt> will be the same as <tt>state.pop</tt> -- it
35        may not.  <tt>state</tt> is only provided to give you access to EvolutionState
36        features.   Typically you'd use this method to set the Fitness values of all
37        Individuals to 0.
38               
39        <p> <i>countVictoriesOnly</i> will be set if Individuals' fitness is to be based on
40        whether they're the winner of a test, instead of based on the specifics of the scores
41        in the tests.  This really only happens for Single-Elimination Tournament
42        one-population competitive coevolution.
43    */
44    public void preprocessPopulation(final EvolutionState state, Population pop, final boolean countVictoriesOnly);
45
46    /** Finish processing the population (such as fitness information) after evaluation.
47        Although this method is not static, you should not use it to write to any instance
48        variables in the GroupedProblem instance; this is because it's possible that
49        the instance used is in fact the prototype, and you will have no guarantees that
50        your instance variables will remain valid during the evaluate(...) process.
51        Do not assume that <tt>pop</tt> will be the same as <tt>state.pop</tt> -- it
52        may not.  <tt>state</tt> is only provided to give you access to EvolutionState
53        features.
54               
55        <p> <i>countVictoriesOnly</i> will be set if Individuals' fitness is to be based on
56        whether they're the winner of a test, instead of based on the specifics of the scores
57        in the tests.  This really only happens for Single-Elimination Tournament
58        one-population competitive coevolution.  If this is set, probably would leave the Fitnesses
59        as they are here (they've been set and incremented in evaluate(...)), but if it's not set,
60        you may want to set the Fitnesses to the maximum or average or the various trials
61        performed.
62    */
63    public void postprocessPopulation(final EvolutionState state, Population pop, final boolean countVictoriesOnly);
64
65    /** Evaluates the individuals found in ind together.  If updateFitness[i] is true,
66        then you should use this evaluation to update the fitness of the individual in
67        ind[i].  Individuals which are updated should have their fitnesses modified so
68        that immediately after evaluation (and prior to postprocessPopulation(...) being
69        called) individuals' fitnesses can be checked to see which is better than which.
70        Do not assume that the individuals in <tt>ind</tt> will actually be in <tt>state.pop</tt>
71        (they may not -- this method may be called at the end of a run to determine the
72        best individual of the run in some kind of contest).
73               
74        <p> <i>countVictoriesOnly</i> will be set if Individuals' fitness is to be based on
75        whether they're the winner of a test, instead of based on the specifics of the scores
76        in the tests.  This really only happens for Single-Elimination Tournament
77        one-population competitive coevolution.  If this is set, you should increment the Fitness of the winner
78        each time.  If it's not set, you should update Fitness as you see fit, then set
79        the final Fitness in preprocessPopulation.
80    */
81    public void evaluate(final EvolutionState state,
82        final Individual[] ind,  // the individuals to evaluate together
83        final boolean[] updateFitness,  // should this individuals' fitness be updated?
84        final boolean countVictoriesOnly, // don't bother updating Fitness with socres, just victories
85        final int[] subpops,
86        final int threadnum);
87    }
88
89
90
91
92
Note: See TracBrowser for help on using the repository browser.