public class GenotypePitts extends Genotype
GenotypePitts is the base clase to represent the genotype when a fuzzy model is to be learned with the genetic algorithm and the Pittsburg approach.
Constructor and Description |
---|
GenotypePitts(GenotypePitts p)
The copy constructor.
|
GenotypePitts(int n,
int nlabels,
Randomize r)
Class constructor with the following parameters:
|
Modifier and Type | Method and Description |
---|---|
Genotype |
clone()
This method is intended for generating a perfect copy of the current Genotype.
|
void |
crossover(Genotype padre2,
Genotype offspng1,
Genotype offspng2,
int crossoverID)
The method for carrying out the crossover genetic operations.
|
void |
debug()
This method is intended for printing debug information.
|
int |
getInvolvedRule(int n)
This method returns a rule in the rule base.
|
double |
getRuleWeight(int n)
This method returns the weight of a rule
|
boolean |
isRelated(Genotype p)
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 |
set(GenotypePitts p)
This method copies the given parameter into the current object.
|
void |
setInvolvedRule(int n,
int v)
This method updates the rule base.
|
void |
setRuleWeight(int n,
double v)
This method updates the weight of a rule.
|
int |
size()
This method returns the number of rules of the FRBS
|
public GenotypePitts(int n, int nlabels, Randomize r)
Class constructor with the following parameters:
n
- the number of allelesnlabels
- the number of output available labelsr
- the Randomize
objectpublic GenotypePitts(GenotypePitts p)
The copy constructor.
p
- the GenotypePitts
to be copiedpublic void set(GenotypePitts p)
This method copies the given parameter into the current object.
p
- the GenotypePitts
to be copiedpublic Genotype clone()
This method is intended for generating a perfect copy of the current Genotype.
public boolean isRelated(Genotype p)
This method determines if the given Genotype
is of the same
type thant the current object.
public void Random()
The method intended to randomly initialize a Genotype and then the corresponding individual.
public void crossover(Genotype padre2, Genotype offspng1, Genotype offspng2, int crossoverID) throws invalidCrossover
The method for carrying out the crossover genetic operations.
crossover
in class Genotype
padre2
- the second parent in the crossover operation, it's an Genotype
objectoffspng1
- the Genotype
object with the first offspringoffspng2
- 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 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 debug()
This method is intended for printing debug information.
public int getInvolvedRule(int n)
This method returns a rule in the rule base.
n
- index of the desired rulepublic void setInvolvedRule(int n, int v)
This method updates the rule base.
n
- the index of the rule in the FRBS to updatev
- the new rule, an int valuepublic double getRuleWeight(int n)
This method returns the weight of a rule
n
- the index of the rule which weight is desiredpublic void setRuleWeight(int n, double v)
This method updates the weight of a rule.
n
- the index of the rule to updatev
- the double value to fix in the corresponding weightpublic int size()
This method returns the number of rules of the FRBS