public class GenotypeFuzzyGP extends Genotype
GenotypeFuzzyGP is the base clase to represent the genotype when a fuzzy
model is to be learned with the genetic programming (GP).
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 |
---|
GenotypeFuzzyGP(FuzzyPartition[] a,
FuzzyPartition b,
int mh,
Randomize r)
Class constructor with the following parameters:
|
GenotypeFuzzyGP(GenotypeFuzzyGP 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 p2,
Genotype p3,
Genotype p4,
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 |
setTree(GenotypeFuzzyGP p)
This method copies the given parameter into the current object.
|
public GenotypeFuzzyGP(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 GenotypeFuzzyGP(GenotypeFuzzyGP p)
The copy constructor.
p
- the GenotypeFuzzyGP
to be copiedpublic void setTree(GenotypeFuzzyGP p)
This method copies the given parameter into the current object.
p
- the GenotypeFuzzyGP
to be copiedpublic Genotype clone()
This method is intended for generating a perfect copy of the current Genotype.
public 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 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.MUTACIONGENERICA for the genetic algorithm mutationinvalidMutation
- if mutationID is not validpublic void crossover(Genotype p2, Genotype p3, Genotype p4, int crossoverID) throws invalidCrossover
The method for carrying out the crossover genetic operations.
crossover
in class Genotype
p2
- the second parent in the crossover operation, it's an Genotype
objectp3
- the Genotype
object with the first offspringp4
- the Genotype
object with the second offspringcrossoverID
- an int with the crossover operation to be carried out:
OperatorIdent.CRUCEGENERICO for genetic algorithm 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.