public class CompetitiveEvaluator extends Evaluator
CompetitiveEvaluator is a Evaluator which performs competitive fitness evaluations. Competitive fitness is where individuals' fitness is determined by testing them against other members of the same subpopulation. Competitive fitness topologies differ from co-evolution topologies in that co-evolution is a term I generally reserve for multiple sbupopulations which breed separately but compete against other subpopulations during evaluation time. Individuals are evaluated regardless of whether or not they've been evaluated in the past.
Your Problem is responsible for setting up the fitness appropriately. CompetitiveEvaluator expects to use Problems which adhere to the GroupedProblemForm interface, which defines a new evaluate(...) function, plus a preprocess(...) and postprocess(...) function.
This competitive fitness evaluator is single-threaded -- maybe we'll hack in multithreading later. And it only has two individuals competing during any fitness evaluation. The order of individuals in the subpopulation will be changed during the evaluation process. There are seven evaluation topologies presently supported:
Parameters
base.style string with possible values: |
(the style of the tournament) single-elim-tournament (a single elimination tournament) round-robin (a round robin tournament) rand-1-way (K-Random-Opponents, each game counts for only one of the players) rand-2-way (K-Random-Opponents, each game counts for both players) |
base.group-size int |
(how many individuals per group, used in rand-1-way and rand-2-way tournaments) group-size >= 1 for rand-1-way or rand-2-way |
base.over-eval bool = true or false (default) |
(if the tournament style leads to an individual playing more games than others (as can be the case for rand-2-way), should the extra games be used for his fitness evaluatiuon?) |
Modifier and Type | Field and Description |
---|---|
boolean |
allowOverEvaluation |
int |
groupSize |
static java.lang.String |
P_COMPETE_STYLE |
static java.lang.String |
P_GROUP_SIZE |
static java.lang.String |
P_OVER_EVAL |
int |
style |
static int |
STYLE_N_RANDOM_COMPETITORS_ONEWAY |
static int |
STYLE_N_RANDOM_COMPETITORS_TWOWAY |
static int |
STYLE_ROUND_ROBIN |
static int |
STYLE_SINGLE_ELIMINATION |
masterproblem, P_IAMSLAVE, P_MASTERPROBLEM, p_problem, P_PROBLEM, runComplete
Constructor and Description |
---|
CompetitiveEvaluator() |
Modifier and Type | Method and Description |
---|---|
void |
evalNRandomOneWay(EvolutionState state,
int[] from,
int[] numinds,
java.util.ArrayList<Individual> individuals,
int subpop,
GroupedProblemForm prob) |
void |
evalNRandomOneWayPopChunk(EvolutionState state,
int from,
int numinds,
int threadnum,
java.util.ArrayList<Individual> individuals,
int subpop,
GroupedProblemForm prob) |
void |
evalNRandomTwoWay(EvolutionState state,
int[] from,
int[] numinds,
java.util.ArrayList<Individual> individuals,
int subpop,
GroupedProblemForm prob) |
void |
evalNRandomTwoWayPopChunk(EvolutionState state,
int from,
int numinds,
int threadnum,
java.util.ArrayList<Individual> individuals,
int subpop,
GroupedProblemForm prob) |
void |
evalRoundRobin(EvolutionState state,
int[] from,
int[] numinds,
java.util.ArrayList<Individual> individuals,
int subpop,
GroupedProblemForm prob) |
void |
evalRoundRobinPopChunk(EvolutionState state,
int from,
int numinds,
int threadnum,
java.util.ArrayList<Individual> individuals,
int subpop,
GroupedProblemForm prob)
A private helper function for evalutatePopulation which evaluates a chunk
of individuals in a subpopulation for a given thread.
|
void |
evalSingleElimination(EvolutionState state,
java.util.ArrayList<Individual> individuals,
int subpop,
GroupedProblemForm prob) |
void |
evaluatePopulation(EvolutionState state)
An evaluator that performs coevolutionary evaluation.
|
void |
randomizeOrder(EvolutionState state,
java.util.ArrayList<Individual> individuals) |
java.lang.String |
runComplete(EvolutionState state)
Returns non-NULL if the Evaluator believes that the run is
finished: perhaps 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.
|
closeContacts, initializeContacts, postEvaluationGlobalUpdate, postEvaluationLocalUpdate, reinitializeContacts, setRunComplete
public static final int STYLE_SINGLE_ELIMINATION
public static final int STYLE_ROUND_ROBIN
public static final int STYLE_N_RANDOM_COMPETITORS_ONEWAY
public static final int STYLE_N_RANDOM_COMPETITORS_TWOWAY
public static final java.lang.String P_COMPETE_STYLE
public int style
public static final java.lang.String P_GROUP_SIZE
public int groupSize
public static final java.lang.String P_OVER_EVAL
public boolean allowOverEvaluation
public void setup(EvolutionState state, Parameter base)
Setup
public java.lang.String runComplete(EvolutionState state)
Evaluator
runComplete
in class Evaluator
public void randomizeOrder(EvolutionState state, java.util.ArrayList<Individual> individuals)
public void evaluatePopulation(EvolutionState state)
evaluatePopulation
in class Evaluator
public void evalSingleElimination(EvolutionState state, java.util.ArrayList<Individual> individuals, int subpop, GroupedProblemForm prob)
public void evalRoundRobin(EvolutionState state, int[] from, int[] numinds, java.util.ArrayList<Individual> individuals, int subpop, GroupedProblemForm prob)
public void evalRoundRobinPopChunk(EvolutionState state, int from, int numinds, int threadnum, java.util.ArrayList<Individual> individuals, int subpop, GroupedProblemForm prob)
state
- numinds
- from
- threadnum
- prob
- public void evalNRandomOneWay(EvolutionState state, int[] from, int[] numinds, java.util.ArrayList<Individual> individuals, int subpop, GroupedProblemForm prob)
public void evalNRandomOneWayPopChunk(EvolutionState state, int from, int numinds, int threadnum, java.util.ArrayList<Individual> individuals, int subpop, GroupedProblemForm prob)
public void evalNRandomTwoWay(EvolutionState state, int[] from, int[] numinds, java.util.ArrayList<Individual> individuals, int subpop, GroupedProblemForm prob)
public void evalNRandomTwoWayPopChunk(EvolutionState state, int from, int numinds, int threadnum, java.util.ArrayList<Individual> individuals, int subpop, GroupedProblemForm prob)