public class ClassicIndividual extends Individual<ClassicIndividual>
Population
,
DeltaIndividual
Modifier and Type | Field and Description |
---|---|
java.util.concurrent.locks.ReadWriteLock |
rwLock |
Modifier and Type | Method and Description |
---|---|
double |
calculateChangedOverlap(ClassicIndividual original,
java.util.HashSet<java.lang.Integer> changedBlocks) |
double |
calculateOverlap()
Calculates the overlap of all Blocks (PlacementNodes).
|
int |
compareTo(ClassicIndividual other)
Method to compare the badness with another individual.
|
void |
copyFrom(ClassicIndividual other)
Method to copy the genes (Blocks) and badness from another Individual.
|
void |
deriveFrom(ClassicIndividual mom,
ClassicIndividual dad,
java.util.Random rand)
Method to do a crossover of two genomes and write the result to the Individual's genome.
|
double |
distance(ClassicIndividual other) |
void |
evaluate()
Evaluate the individual by calculating an estimate of the network length
|
double |
getBadness()
Method to return the evaluated "un-fitness" of the Individual.
|
Block |
getBlockAt(int i)
Method to get a Block at position i of the genome.
|
double |
getBoundingBoxArea()
Method to calculate the bounding box area of the Blocks.
|
double[] |
getHashes() |
double |
getNetLength() |
double |
getRotHash() |
double |
getSemiperimeterLength()
Method to calculate the semiperimeter of the bounding box of the Blocks.
|
double |
getXHash() |
double |
getYHash() |
void |
mutate(java.util.Random rand)
Method to mutate a random amount of Blocks.
|
void |
mutateAndEvaluate(ClassicIndividual original,
java.util.Random rand)
Method to mutate a random amount of Blocks.
|
void |
reboot(java.util.Random rand) |
void |
setBadness(double[] otherComponents) |
void |
setProgress(double p) |
double |
sqr(double a) |
void |
swapBlocks(int a,
int b)
Method to randomly swap the position of 2 blocks.
|
void |
writeToPlacement(java.util.List<PlacementFrame.PlacementNode> nodesToPlace) |
distance, getBadnessComponents, getHash, getSize
public void setProgress(double p)
setProgress
in class Individual<ClassicIndividual>
public void reboot(java.util.Random rand)
reboot
in class Individual<ClassicIndividual>
public void writeToPlacement(java.util.List<PlacementFrame.PlacementNode> nodesToPlace)
writeToPlacement
in class Individual<ClassicIndividual>
public int compareTo(ClassicIndividual other)
compareTo
in interface java.lang.Comparable<ClassicIndividual>
compareTo
in class Individual<ClassicIndividual>
other
- The Individual to be used as a reference.public void copyFrom(ClassicIndividual other)
copyFrom
in class Individual<ClassicIndividual>
other
- The Individual to be cloned.public void deriveFrom(ClassicIndividual mom, ClassicIndividual dad, java.util.Random rand)
deriveFrom
in class Individual<ClassicIndividual>
mom
- One donor of genes.dad
- The other donor of genes.public double distance(ClassicIndividual other)
distance
in class Individual<ClassicIndividual>
public Block getBlockAt(int i)
i
- The position of the block to get.public void swapBlocks(int a, int b)
public void mutate(java.util.Random rand)
mutate
in class Individual<ClassicIndividual>
public void mutateAndEvaluate(ClassicIndividual original, java.util.Random rand)
public double calculateChangedOverlap(ClassicIndividual original, java.util.HashSet<java.lang.Integer> changedBlocks)
public double calculateOverlap()
calculateOverlap
in class Individual<ClassicIndividual>
public double getBoundingBoxArea()
getBoundingBoxArea
in class Individual<ClassicIndividual>
public double getSemiperimeterLength()
getSemiperimeterLength
in class Individual<ClassicIndividual>
public double getNetLength()
getNetLength
in class Individual<ClassicIndividual>
public void evaluate()
evaluate
in class Individual<ClassicIndividual>
public double sqr(double a)
public double getBadness()
getBadness
in class Individual<ClassicIndividual>
public void setBadness(double[] otherComponents)
setBadness
in class Individual<ClassicIndividual>
public double getXHash()
getXHash
in class Individual<ClassicIndividual>
public double getYHash()
getYHash
in class Individual<ClassicIndividual>
public double getRotHash()
getRotHash
in class Individual<ClassicIndividual>
public double[] getHashes()
getHashes
in class Individual<ClassicIndividual>