Publisher | MTM |
---|---|
File size | 43.44kB |
Number of files | 5 |
Latest version | 1 |
Latest release date | 2017-06-30 05:47:25 |
First release date | 2017-06-30 05:47:25 |
Supported Unity versions | 2018.4.2 or higher |
Simple way to simulate genetic advances of groups of individuals based on their characteristics. Thus adapting these individuals to each generation that passes and making them become more competent in the execution of the tasks in which they are being evaluated.
//Useful functions and methods You can modify it to change the convergence (max of evolution) speed:
genetico.setProbabilityMutation(int [Value 0 to 100]); //3% default
genetico.setProbabilityCrossover(int [Value 0 to 100]); //75% default
//population initialize
public void initializePopulation(int SIZE, string LABEL)
//insert a new gene for each subject in population
//use, (int max value, int min value, float the value, how much genes with same setup)
public void addGenes(int mx, int min, float vlr, int qtdGene = 1)
//set the values using, 0 or 1, to mix parents genes on CROSSOVER
public void setMixParents(int[] GENSALTERADOS)
//it is the beginning of Genetics generation
//use this function preview Fitness "calc"
public void firstStep(bool ELITISMO = true)
//it is the end of Genetics generation
//use this function after Fitness "calc"
public void endStep()
//set in index of subject the value of fitness
public void setFitness(int IndSub, float VALUEFITNESS)
//return the subject fitness value, when sending index of subject in population array
public float getFitness(int IndSub)
//return the list of numbers, with values (1 or 0), used on crossover
public int[] getMixParents()
//to send number of genes, using first subject
public int getGensSize()
//set the value of gen, of subject
public void setAleloValue(int indSub, int indGen, float VALUE)
//value of alelo's cromossomo in subject gene
//get value of OBJ(IndOBJ)->cromossomo->gene(indGen)->alelo->value
public float getAleloValue(int indSub, int indGen)
//return population data
public Populacao getPopulation()
//return subject data
public Individuo getSubject(int ind)
//return subject TNG data
public Individuo getSubjectTNG(int ind)
//return number of subjects in population
public int getPopulationSize()
//return number of subjects in population in next generation
public int getPopulationTNGSize()
//set value max of gene_alelo
public void setMaxValue(int indSub, int indGen, int VALUE)
//GET value max of gene_alelo
public int getMaxValue(int indSub, int indGen)
//set value min of gene_alelo
public void setMinValue(int indSub, int indGen, int VALUE)
//GET value min of gene_alelo
public int getMinValue(int indSub, int indGen)
//Useful functions and methods You can modify it to change the convergence (max of evolution) speed:
genetico.setProbabilityMutation(int [Value 0 to 100]); //3% default
genetico.setProbabilityCrossover(int [Value 0 to 100]); //75% default
//population initialize
public void initializePopulation(int SIZE, string LABEL)
//insert a new gene for each subject in population
//use, (int max value, int min value, float the value, how much genes with same setup)
public void addGenes(int mx, int min, float vlr, int qtdGene = 1)
//set the values using, 0 or 1, to mix parents genes on CROSSOVER
public void setMixParents(int[] GENSALTERADOS)
//it is the beginning of Genetics generation
//use this function preview Fitness "calc"
public void firstStep(bool ELITISMO = true)
//it is the end of Genetics generation
//use this function after Fitness "calc"
public void endStep()
//set in index of subject the value of fitness
public void setFitness(int IndSub, float VALUEFITNESS)
//return the subject fitness value, when sending index of subject in population array
public float getFitness(int IndSub)
//return the list of numbers, with values (1 or 0), used on crossover
public int[] getMixParents()
//to send number of genes, using first subject
public int getGensSize()
//set the value of gen, of subject
public void setAleloValue(int indSub, int indGen, float VALUE)
//value of alelo's cromossomo in subject gene
//get value of OBJ(IndOBJ)->cromossomo->gene(indGen)->alelo->value
public float getAleloValue(int indSub, int indGen)
//return population data
public Populacao getPopulation()
//return subject data
public Individuo getSubject(int ind)
//return subject TNG data
public Individuo getSubjectTNG(int ind)
//return number of subjects in population
public int getPopulationSize()
//return number of subjects in population in next generation
public int getPopulationTNGSize()
//set value max of gene_alelo
public void setMaxValue(int indSub, int indGen, int VALUE)
//GET value max of gene_alelo
public int getMaxValue(int indSub, int indGen)
//set value min of gene_alelo
public void setMinValue(int indSub, int indGen, int VALUE)
//GET value min of gene_alelo
public int getMinValue(int indSub, int indGen)