Package ga
Class Chromosome
java.lang.Object
ga.Chromosome
public class Chromosome
extends java.lang.Object
A chromosome of the population.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Chromosome(double[] c)
Initialize this chromosome on given mapping.Chromosome(int d)
Initialize the phenotype of this chromosome.Chromosome(int[] c)
Initialize this chromosome on given mapping.Chromosome(int[][] parameter_dom, int edges)
Generates random parameter values.Chromosome(int[][] parameter_dom, int edges, int m)
Generates heuristic parameter values.Chromosome(int f, int[] m)
Initialize the object on given phenotype and fitnessChromosome(java.lang.String[] c)
Initialize object on given mapping. -
Method Summary
Modifier and Type Method Description void
change(int index, int value)
Change one value of the chromosome.java.lang.String[]
changem(int index, int value)
Change one value of the chromosome and return phenotype.double
getfitness()
Get fitness.int[]
getgenes()
Get phenotype.java.lang.String[]
getstringmap()
Get phenotype as string arrayvoid
hergeneration(int m)
Generate chromosome values using heuristic.void
randomgeneration(int[][] parameter_dom)
Generate random chromosome values.void
setfitness(double newfit)
Set fitness.void
setgenes(int[] ma)
Set phenotype.void
strtomap(java.lang.String[] c)
String to map.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
genes
private int[] genesThe phenotypo of the chromosome. -
fitness
private double fitnessFitness for this chromosome.
-
-
Constructor Details
-
Chromosome
public Chromosome(int[][] parameter_dom, int edges)Generates random parameter values. -
Chromosome
public Chromosome(int[][] parameter_dom, int edges, int m)Generates heuristic parameter values. -
Chromosome
public Chromosome(int d)Initialize the phenotype of this chromosome. -
Chromosome
public Chromosome(int[] c)Initialize this chromosome on given mapping. -
Chromosome
public Chromosome(double[] c)Initialize this chromosome on given mapping. -
Chromosome
public Chromosome(java.lang.String[] c)Initialize object on given mapping. -
Chromosome
public Chromosome(int f, int[] m)Initialize the object on given phenotype and fitness
-
-
Method Details
-
strtomap
public void strtomap(java.lang.String[] c)String to map. -
randomgeneration
public void randomgeneration(int[][] parameter_dom)Generate random chromosome values. -
hergeneration
public void hergeneration(int m)Generate chromosome values using heuristic. -
change
public void change(int index, int value)Change one value of the chromosome. -
changem
public java.lang.String[] changem(int index, int value)Change one value of the chromosome and return phenotype. -
getgenes
public int[] getgenes()Get phenotype. -
getstringmap
public java.lang.String[] getstringmap()Get phenotype as string array -
setfitness
public void setfitness(double newfit)Set fitness. -
setgenes
public void setgenes(int[] ma)Set phenotype. -
getfitness
public double getfitness()Get fitness.
-