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 correctSet,
Classifier parent1,
Classifier parent2,
Classifier child1,
Classifier child2,
boolean actionMutated1,
boolean actionMutated2,
double[] envState)
It applies the GA subsumption.
|
void |
runGA(Population correctSet,
double[] envState,
int classOfExample,
int tStamp)
It makes an iteration of the genetic algorithm.
|
public void runGA(Population correctSet, double[] envState, int classOfExample, int tStamp)
correctSet
- is the action set where the GA has to be applied.envState
- is the environmental state.classOfExample
- is the class of the input exampletStamp
- is the time stamppublic void doGASubsumption(Population correctSet, 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.
correctSet
- 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.