public class GenotypeFuzzyGAP extends Genotype
GenotypeFuzzyGAP is the base clase to represent the genotype when a fuzzy
model is to be learned with the genetic algorithm and programming (GAP).
Both the constants and the tree node are learned.
The Fuzzy model variables are characterized with FuzzyPartition
s.
The root node is a NodeRuleBase
.
Constructor and Description |
---|
GenotypeFuzzyGAP(FuzzyPartition[] a,
FuzzyPartition b,
int mh,
Randomize r)
Class constructor with the following parameters:
|
GenotypeFuzzyGAP(GenotypeFuzzyGAP p)
The copy constructor.
|
Modifier and Type | Method and Description |
---|---|
Genotype |
clone()
This method is intended for generating a perfect copy of the current Genotype.
|
void |
crossover(Genotype parent,
Genotype of1,
Genotype of2,
int crossoverID)
The method for carrying out the crossover genetic operations.
|
void |
debug()
This method is intended for printing debug information.
|
Node |
getRootNode()
This method returns the root node.
|
boolean |
isRelated(Genotype g)
This method determines if the given
Genotype is of the same
type thant the current object. |
void |
mutation(double alpha,
int mutationID)
Method for carrying out the mutation genetic operations.
|
void |
Random()
The method intended to randomly initialize a Genotype and then the corresponding individual.
|
void |
rebuild(Genotype g)
This method is intended to rebuild the current object if needed.
|
void |
set(GenotypeFuzzyGAP p)
This method copies the given parameter into the current object.
|
public GenotypeFuzzyGAP(FuzzyPartition[] a, FuzzyPartition b, int mh, Randomize r)
Class constructor with the following parameters:
a
- the FuzzyPartition
array, a FuzzyPartition
for each input variableb
- the FuzzyPartition
for the output variablemh
- the maximum valid height of a treer
- the Randomize
objectpublic GenotypeFuzzyGAP(GenotypeFuzzyGAP p)
The copy constructor.
p
- the GenotypeFuzzyGAP
to be copiedpublic void set(GenotypeFuzzyGAP p)
This method copies the given parameter into the current object.
p
- the GenotypeFuzzyGAP
to be copiedpublic boolean isRelated(Genotype g)
This method determines if the given Genotype
is of the same
type thant the current object.
The nodes are analyzed to be the same tree without considering the
constants values.
public Genotype clone()
This method is intended for generating a perfect copy of the current Genotype.
public void rebuild(Genotype g)
This method is intended to rebuild the current object if needed. In this case, nothing has to be done.
g
- the Genotype
to rebuild.public void mutation(double alpha, int mutationID) throws invalidMutation
Method for carrying out the mutation genetic operations.
mutation
in class Genotype
alpha
- double value kept for compatibility, not used.mutationID
- an int with the crossover operation to be carried out:
OperatorIdent.GAPMUTAGA for the genetic algorithm mutation
OperatorIdent.GAPMUTAGP for the genetic programming mutationinvalidMutation
- if mutationID is not validpublic void crossover(Genotype parent, Genotype of1, Genotype of2, int crossoverID) throws invalidCrossover
The method for carrying out the crossover genetic operations.
crossover
in class Genotype
parent
- the second parent in the crossover operation, it's an Genotype
objectof1
- the Genotype
object with the first offspringof2
- the Genotype
object with the second offspringcrossoverID
- an int with the crossover operation to be carried out:
OperatorIdent.GAPCRUCEGA for genetic algorithm crossover
OperatorIdent.GAPCRUCEGP for genetic programming crossoverinvalidCrossover
- if crossoverID is not validpublic void Random()
The method intended to randomly initialize a Genotype and then the corresponding individual.
public void debug()
This method is intended for printing debug information.