Package evo.search.ga
Class AnalysisUtils
- java.lang.Object
- 
- evo.search.ga.AnalysisUtils
 
- 
 public class AnalysisUtils extends Object This class provides several analysis metrics to evaluate individuals upon
- 
- 
Constructor SummaryConstructors Constructor Description AnalysisUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleareaCovered(List<DiscreteGene> points)Calculates the maximised area covered by the points.static doubleareaInSector(double distanceA, double distanceB, int rayCount)Calculates the triangle area in a sector between two rays given the two distances of the outer edges and the amount of all rays.static List<DiscreteGene>fill(List<DiscreteGene> chromosome)Returns a filled list of points visited on each sector by the chromosome.static booleanfinds(DiscreteGene point, DiscreteGene treasure)static List<DiscreteGene>inBetween(DiscreteGene a, DiscreteGene b)Returns a list of intersections between the line through points a and b and the rays between these points.static doublenewAreaCovered(List<DiscreteGene> points)Computes the sum of newly covered area per step of the chromosome.static doublespiralLikeness(List<DiscreteGene> chromosome)The spiral-likeness measures the similarity between the individuals structure and a spiral.static doublespiralLikenessInvariant(List<DiscreteGene> chromosome)Measure for the spiral-likeness of the chromosome with rotation invariance.static doubletraceLength(List<DiscreteGene> points)Calculates the trace length of a path consisting of the list of points.static doubletraceLength(List<DiscreteGene> chromosome, DiscreteGene treasure)Computes the trace length necessary for theDiscreteGenechromosome to find the given treasureDiscreteGene.static doubleworstCase(List<DiscreteGene> points, float minDistance)Calculates the worst case trace length of a trace barely missing a treasure.static doubleworstCaseMean(List<DiscreteGene> points, float epsilon)Compute the mean worst case over all points in the strategy.static doubleworstCaseSpiralStrategy(List<DiscreteGene> chromosome)Calculate the optimal worst case factor for the strategy.
 
- 
- 
- 
Method Detail- 
spiralLikenesspublic static double spiralLikeness(List<DiscreteGene> chromosome) The spiral-likeness measures the similarity between the individuals structure and a spiral. This likeness is expressed as the summed up distances between where a point should sit in a spiral and the actual placed point. Therefore, it starts at the first position, that the individual visits. Then, it spirals out both clock-wise and counter-clockwise counting the individual distances. Finally, the minimum of the clockwise and counter-clockwise likenesses is returned.- Parameters:
- chromosome- the individual measured
- Returns:
- Spiral likeness between 0.0 and infinity 0.0 means spiral
 
 - 
spiralLikenessInvariantpublic static double spiralLikenessInvariant(List<DiscreteGene> chromosome) Measure for the spiral-likeness of the chromosome with rotation invariance. Analyses the likeness pairwise.- Parameters:
- chromosome- chromosome to measure
- Returns:
- rotation independent spiral likeness
 
 - 
worstCaseSpiralStrategypublic static double worstCaseSpiralStrategy(List<DiscreteGene> chromosome) Calculate the optimal worst case factor for the strategy. This fitness is the worst case factor of the strategy's spiral counterpart.- Parameters:
- chromosome- individual to analyze
- Returns:
- optimal worst case factor
 
 - 
traceLengthpublic static double traceLength(List<DiscreteGene> chromosome, DiscreteGene treasure) Computes the trace length necessary for theDiscreteGenechromosome to find the given treasureDiscreteGene.- Parameters:
- chromosome- chromosome to evaluate the trace length on
- treasure- treasure point to be found
- Returns:
- trace length necessary for the individual to find the treasure
 
 - 
traceLengthpublic static double traceLength(List<DiscreteGene> points) Calculates the trace length of a path consisting of the list of points.- Parameters:
- points- points forming a trace
- Returns:
- trace length of the path of points
 
 - 
findspublic static boolean finds(DiscreteGene point, DiscreteGene treasure) Compute for twoDiscreteGenes, whether the first pointpointfinds the second pointtreasure.That equals the following statement: point.position == treasure.position && point.distance >= treasure.distance- Parameters:
- point- Point to check, if it finds the second point.
- treasure- point to be found
- Returns:
- whether the first point finds the second point
 
 - 
fillpublic static List<DiscreteGene> fill(List<DiscreteGene> chromosome) Returns a filled list of points visited on each sector by the chromosome. The chromosome may jump above multiple sectors. To resolve this behaviour for the fitness evaluation using area coverage, the list of points need consecutive position indices.- Parameters:
- chromosome- chromosome with jumping genes
- Returns:
- list of visited points with consecutive position indices
 
 - 
inBetweenpublic static List<DiscreteGene> inBetween(DiscreteGene a, DiscreteGene b) Returns a list of intersections between the line through points a and b and the rays between these points.- Parameters:
- a- point a for the line
- b- point b for the line
- Returns:
- list of intersections between the line ab and the rays between a and b
 
 - 
areaInSectorpublic static double areaInSector(double distanceA, double distanceB, int rayCount)Calculates the triangle area in a sector between two rays given the two distances of the outer edges and the amount of all rays. The points have to lay on consecutive rays hence the need for a fix throughinBetween(DiscreteGene, DiscreteGene)before invoking this method.- Parameters:
- distanceA- first outer edge distance
- distanceB- second outer edge distance
- rayCount- amount of rays, gives the inner degree of the triangle
- Returns:
- triangle area in a sector given two point distances
 
 - 
areaCoveredpublic static double areaCovered(List<DiscreteGene> points) Calculates the maximised area covered by the points. A covered area in a sector is the area of the triangle formed between two points on the rays limiting the sector and the origin. This fitness maximises a area already covered and every time a sector is explored again, the area already covered is subtracted to induce larger areas being visited the next time in a same sector.- Parameters:
- points- list of points distributed on consecutive rays
- Returns:
- maximised area covered by the points
 
 - 
newAreaCoveredpublic static double newAreaCovered(List<DiscreteGene> points) Computes the sum of newly covered area per step of the chromosome.- Parameters:
- points- path of the chromosome
- Returns:
- sum of the newly covered area per step
 
 - 
worstCasepublic static double worstCase(List<DiscreteGene> points, float minDistance) Calculates the worst case trace length of a trace barely missing a treasure.- Parameters:
- points- list of points forming a path
- minDistance- minimum distance a worst case is placed away from the origin
- Returns:
- worst case scenario fitness
 
 - 
worstCaseMeanpublic static double worstCaseMean(List<DiscreteGene> points, float epsilon) Compute the mean worst case over all points in the strategy.- Parameters:
- points- list of points of the strategy
- epsilon- distance the worst case is missed by
- Returns:
- mean worst case fitness
 
 
- 
 
-