public class GA
extends java.lang.Object
This is the main class of the genetic algorithm. It has an object of crossover and selection, that can take different selection and crossover models.
Constructor and Description |
---|
GA()
Constructs the GA
|
Modifier and Type | Method and Description |
---|---|
void |
doGASubsumption(Population actionSet,
Classifier parent1,
Classifier parent2,
Classifier child1,
Classifier child2,
boolean actionMutated1,
boolean actionMutated2,
double[] envState)
It applies the GA subsumption.
|
void |
runGA(double[] envState,
Population actionSet,
int tStamp)
It makes an iteration of the genetic algorithm.
|
public void runGA(double[] envState, Population actionSet, int tStamp)
It makes an iteration of the genetic algorithm. It selects two parents, performs crossover, mutate the children and introduces them to the population, accordingly with the doGASubsumption parameter.
actionSet
- is the action set where the GA has to be applied.envState
- is the environmental state.tStamp
- is the tStamppublic void doGASubsumption(Population actionSet, Classifier parent1, Classifier parent2, Classifier child1, Classifier child2, boolean actionMutated1, boolean actionMutated2, double[] envState)
It applies the GA subsumption. It has to see if the parents subsume the children. If they do not, it has to search in the population for a subsumer. Otherwise, it has to insert the new classifier in the population.
actionSet
- is the action set where the GA subsumption has to be applied.parent1
- is the first parent.parent2
- is the second parent.child1
- is the first child.child2
- is the second child.actionMutated1
- indicates if the action 1 has been mutatedactionMutated2
- indicates if the action 2 has been mutatedenvState
- is the environmental state.