public class Subpopulation
extends java.lang.Object
Constructor and Description |
---|
Subpopulation(int id,
double[][] train,
int[] out)
Builder.
|
Modifier and Type | Method and Description |
---|---|
void |
doGeneration()
Performs a new generation of the subpopulation
|
int[] |
getBody(int key)
Returns the body of an individual, given its ID
|
void |
HUX(int a,
int b,
int newIndex)
Crosses two selectors of the subpopulation and generates two new childs
|
java.lang.String |
print()
Prints the population
|
java.lang.String |
printIndividual(int val)
Prints an individual of the population
|
int |
rouletteSelection()
Performs a roulette selection process
|
static void |
setElitism(double value)
Sets the Elitism percentage
|
static void |
setK(int value)
Sets the K parameter
|
static void |
setPBit(double value)
Sets the bit flip probability
|
static void |
setPRandom(double value)
Sets the random mutation probability
|
static void |
setPRnn(double value)
Sets the RNN mutation probability
|
static void |
setSize(int value)
Sets the size of the population
|
static void |
setWDifference(double value)
Sets the WDifference parameter
|
static void |
setWError(double value)
Sets the WError parameter
|
static void |
setWReduction(double value)
Sets the WReduction parameter
|
public Subpopulation(int id, double[][] train, int[] out)
id
- Identifier of the populationtrain
- Subset of training dataout
- Output attribute of the subset of training datapublic static void setK(int value)
value
- Value for the K parameterpublic static void setSize(int value)
value
- Size of the populationpublic static void setWError(double value)
value
- Value for the WError parameterpublic static void setWReduction(double value)
value
- Value for the WReduction parameterpublic static void setWDifference(double value)
value
- Value for the WDifference parameterpublic static void setElitism(double value)
value
- Value for the Elitism percentagepublic static void setPRnn(double value)
value
- Value for the RNN mutation probabilitypublic static void setPRandom(double value)
value
- Value for the random mutation probabilitypublic static void setPBit(double value)
value
- Value for the bit flip probabilitypublic void doGeneration()
public void HUX(int a, int b, int newIndex)
a
- First selectorb
- Second selectornewIndex
- Base index for the offspringpublic int[] getBody(int key)
key
- ID of the individualpublic int rouletteSelection()
public java.lang.String print()
public java.lang.String printIndividual(int val)
val
- index of the individual