ec.coevolve
Class MultiPopCoevolutionaryEvaluator

java.lang.Object
  extended by ec.Evaluator
      extended by ec.coevolve.MultiPopCoevolutionaryEvaluator
All Implemented Interfaces:
Setup, Singleton, java.io.Serializable

public class MultiPopCoevolutionaryEvaluator
extends Evaluator

MultiPopCoevolutionaryEvaluator.java

MultiPopCoevolutionaryEvaluator is an Evaluator which performs competitive or cooperative multi-population coevolution. Competitive coevolution is where individuals' fitness is determined by testing them against individuals from other subpopulation. Cooperative coevolution is where individuals form teams together with members of other subpopulations, and the individuals' fitness is computed based on the performance of such teams. This evaluator assumes that the problem can only evaluate groups of individuals containing one individual from each subpopulation. Individuals are evaluated regardless of whether or not they've been evaluated in the past.

Your Problem is responsible for updating up the fitness appropriately with values usually obtained from teaming up the individual with different partners from the other subpopulations. MultiPopCoevolutionaryEvaluator expects to use Problems which adhere to the GroupedProblemForm interface, which defines a new evaluate(...) function, plus a preprocess(...) and postprocess(...) function.

This coevolutionary evaluator is single-threaded -- maybe we'll hack in multithreading later. It allows any number of subpopulations (implicitly, any number of individuals being evaluated together). The order of individuals in the subpopulation may be changed during the evaluation process.

Parameters

base.subpop.X.num-rand-ind
int >= 0
(the number of random individuals from subpopulation X to be selected as partners for evaluating individuals in other subpopulations -- individuals are selected at random, with replacement, and they are usually different for each of the individuals in the other subpopulations)
base.subpop.X.num-elites
int >= 0
(the number of elite individuals from subpopulation X to be selected as partners for evaluating individuals in other subpopulations)
base.subpop.X.num-ind
int >= 0
(the number of individuals from subpopulation X in the previous generation to be selected as partners for evaluating individuals in other subpopulations -- individuals are selected, with replacement, by using SelectionMethods described next, and they are usually different for each of the individuals in the other subpopulations)
base.subpop.X.select
instance of ec.SelectionMethod
(the SelectionMethod used to select partners from the individuals in subpopulation X at the previous generation)

Version:
2.0
Author:
Liviu Panait
See Also:
Serialized Form

Field Summary
protected  int[] numElite
           
protected  int[] numInd
           
protected  int[] numRand
           
protected  int[] numSelected
           
static java.lang.String P_NUM_ELITE
           
static java.lang.String P_NUM_IND
           
static java.lang.String P_NUM_RAND_IND
           
static java.lang.String P_SELECTIONMETHOD
           
static java.lang.String P_SUBPOP
           
 
Fields inherited from class ec.Evaluator
P_IAMSLAVE, P_MASTERPROBLEM, p_problem, P_PROBLEM
 
Constructor Summary
MultiPopCoevolutionaryEvaluator()
           
 
Method Summary
 void afterCoevolutionaryEvaluation(EvolutionState state, Population population, GroupedProblemForm prob)
           
 void beforeCoevolutionaryEvaluation(EvolutionState state, Population population, GroupedProblemForm prob)
           
 void evaluatePopulation(EvolutionState state)
          Evaluates the fitness of an entire population.
 int getNumEliteIndividuals(int subpop)
           
 int getNumPartners(int subpop)
           
 int getNumPreviousGenerationPartners(int subpop)
           
 int getNumRandomPartners(int subpop)
           
 void loadElites(EvolutionState state, Subpopulation subpop, int whichSubpop)
           
 void performCoevolutionaryEvaluation(EvolutionState state, Population population, GroupedProblemForm prob)
           
 boolean runComplete(EvolutionState state)
          Returns true if an ideal individual has been found or some other run result has shortcircuited the run so that it should end prematurely right now.
 void setup(EvolutionState state, Parameter base)
          Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.
 
Methods inherited from class ec.Evaluator
closeContacts, initializeContacts, reinitializeContacts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P_SUBPOP

public static final java.lang.String P_SUBPOP
See Also:
Constant Field Values

P_NUM_RAND_IND

public static final java.lang.String P_NUM_RAND_IND
See Also:
Constant Field Values

numRand

protected int[] numRand

P_NUM_ELITE

public static final java.lang.String P_NUM_ELITE
See Also:
Constant Field Values

numElite

protected int[] numElite

P_NUM_IND

public static final java.lang.String P_NUM_IND
See Also:
Constant Field Values

numInd

protected int[] numInd

P_SELECTIONMETHOD

public static final java.lang.String P_SELECTIONMETHOD
See Also:
Constant Field Values

numSelected

protected int[] numSelected
Constructor Detail

MultiPopCoevolutionaryEvaluator

public MultiPopCoevolutionaryEvaluator()
Method Detail

getNumRandomPartners

public int getNumRandomPartners(int subpop)

getNumEliteIndividuals

public int getNumEliteIndividuals(int subpop)

getNumPreviousGenerationPartners

public int getNumPreviousGenerationPartners(int subpop)

getNumPartners

public int getNumPartners(int subpop)

setup

public void setup(EvolutionState state,
                  Parameter base)
Description copied from interface: Setup
Sets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else.

Specified by:
setup in interface Setup
Overrides:
setup in class Evaluator

runComplete

public boolean runComplete(EvolutionState state)
Description copied from class: Evaluator
Returns true if an ideal individual has been found or some other run result has shortcircuited the run so that it should end prematurely right now.

Specified by:
runComplete in class Evaluator

evaluatePopulation

public void evaluatePopulation(EvolutionState state)
Description copied from class: Evaluator
Evaluates the fitness of an entire population. You will have to determine how to handle multiple threads on your own, as this is a very domain-specific thing.

Specified by:
evaluatePopulation in class Evaluator

beforeCoevolutionaryEvaluation

public void beforeCoevolutionaryEvaluation(EvolutionState state,
                                           Population population,
                                           GroupedProblemForm prob)

performCoevolutionaryEvaluation

public void performCoevolutionaryEvaluation(EvolutionState state,
                                            Population population,
                                            GroupedProblemForm prob)

afterCoevolutionaryEvaluation

public void afterCoevolutionaryEvaluation(EvolutionState state,
                                          Population population,
                                          GroupedProblemForm prob)

loadElites

public void loadElites(EvolutionState state,
                       Subpopulation subpop,
                       int whichSubpop)