public abstract class Chromosome extends Object implements Comparable<Chromosome>, Serializable, PublicCloneable<Chromosome>
| Modifier and Type | Field and Description |
|---|---|
protected int |
age
Generation in which this chromosome was created
|
protected double |
distance |
protected int |
rank |
protected boolean |
toBeUpdated |
| Modifier | Constructor and Description |
|---|---|
protected |
Chromosome()
only used for testing/debugging
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFitness(FitnessFunction<?> ff)
Adds a fitness function and sets fitness, coverage, and numCoveredGoal
default.
|
void |
addFitness(FitnessFunction<?> ff,
double fitnessValue)
Adds a fitness function with an associated fitness value
|
void |
addFitness(FitnessFunction<?> ff,
double fitnessValue,
double coverage)
Adds a fitness function with an associated fitness value and coverage
value
|
void |
addFitness(FitnessFunction<?> ff,
double fitnessValue,
double coverage,
int numCoveredGoals)
Adds a fitness function with an associated fitness value, coverage value,
and number of covered goals.
|
abstract Chromosome |
clone()
clone
|
abstract <T extends Chromosome> |
compareSecondaryObjective(T o)
Secondary Objectives are specific to chromosome types
|
int |
compareTo(Chromosome c)
Determine relative ordering of this chromosome to another chromosome.
|
void |
crossOver(Chromosome other,
int position)
Fixed single point cross over
|
abstract void |
crossOver(Chromosome other,
int position1,
int position2)
Single point cross over
|
abstract boolean |
equals(Object obj) |
int |
getAge() |
double |
getCoverage()
Getter for the field
coverage. |
double |
getCoverage(FitnessFunction<?> ff)
Gets the coverage value for a given fitness function
|
double |
getCoverageInstanceOf(Class<?> clazz) |
Map<FitnessFunction<?>,Double> |
getCoverageValues() |
double |
getDistance() |
double |
getFitness()
Return current fitness value
|
<T extends Chromosome> |
getFitness(FitnessFunction<T> ff) |
double |
getFitnessInstanceOf(Class<?> clazz) |
Map<FitnessFunction<?>,Double> |
getFitnessValues() |
int |
getNumOfCoveredGoals() |
int |
getNumOfCoveredGoals(FitnessFunction<?> ff)
Gets the number of covered goals for a given fitness function
|
int |
getNumOfNotCoveredGoals() |
int |
getNumOfNotCoveredGoals(FitnessFunction<?> ff)
Gets the number of not covered goals for a given fitness function
|
LinkedHashMap<FitnessFunction<?>,Integer> |
getNumsNotCoveredGoals() |
Map<FitnessFunction<?>,Integer> |
getNumsOfCoveredGoals() |
Map<FitnessFunction<?>,Double> |
getPreviousFitnessValues() |
int |
getRank() |
boolean |
hasExecutedFitness(FitnessFunction<?> ff) |
boolean |
hasFitnessChanged() |
abstract int |
hashCode() |
boolean |
hasLocalSearchBeenApplied() |
boolean |
isChanged()
Return whether the chromosome has changed since the fitness value was
computed last
|
boolean |
isToBeUpdated() |
void |
isToBeUpdated(boolean toBeUpdated) |
abstract boolean |
localSearch(LocalSearchObjective<? extends Chromosome> objective)
Apply the local search
|
abstract void |
mutate()
Apply mutation
|
void |
setChanged(boolean changed)
Set changed status to @param changed
|
void |
setCoverage(FitnessFunction<?> ff,
double coverage)
Sets the coverage value for a given fitness function
|
void |
setCoverageValues(Map<FitnessFunction<?>,Double> coverages) |
void |
setDistance(double d) |
void |
setFitness(FitnessFunction<?> ff,
double value)
Set new fitness value
|
void |
setFitnessValues(Map<FitnessFunction<?>,Double> fits) |
void |
setLocalSearchApplied(boolean localSearchApplied) |
void |
setNumOfCoveredGoals(FitnessFunction<?> ff,
int numCoveredGoals)
Sets the number of covered goals for a given fitness function
|
void |
setNumOfNotCoveredGoals(FitnessFunction<?> ff,
int numCoveredGoals) |
void |
setNumsOfCoveredGoals(Map<FitnessFunction<?>,Integer> fits) |
void |
setNumsOfNotCoveredGoals(Map<FitnessFunction<?>,Integer> fits) |
void |
setPreviousFitnessValues(Map<FitnessFunction<?>,Double> lastFits) |
void |
setRank(int r) |
abstract int |
size()
Return length of individual
|
void |
updateAge(int generation) |
protected boolean toBeUpdated
protected int age
protected int rank
protected double distance
public double getFitness()
public <T extends Chromosome> double getFitness(FitnessFunction<T> ff)
public Map<FitnessFunction<?>,Double> getFitnessValues()
public Map<FitnessFunction<?>,Double> getPreviousFitnessValues()
public boolean hasExecutedFitness(FitnessFunction<?> ff)
public void setFitnessValues(Map<FitnessFunction<?>,Double> fits)
public void setPreviousFitnessValues(Map<FitnessFunction<?>,Double> lastFits)
public boolean isToBeUpdated()
public void isToBeUpdated(boolean toBeUpdated)
public void addFitness(FitnessFunction<?> ff)
ff - a fitness functionpublic void addFitness(FitnessFunction<?> ff, double fitnessValue)
ff - a fitness functionfitnessValue - the fitness value for ffpublic void addFitness(FitnessFunction<?> ff, double fitnessValue, double coverage)
ff - a fitness functionfitnessValue - the fitness value for ffcoverage - the coverage value for ffpublic void addFitness(FitnessFunction<?> ff, double fitnessValue, double coverage, int numCoveredGoals)
ff - a fitness functionfitnessValue - the fitness value for ffcoverage - the coverage value for ffnumCoveredGoals - the number of covered goals for ffpublic void setFitness(FitnessFunction<?> ff, double value) throws IllegalArgumentException
value - a double.IllegalArgumentExceptionpublic boolean hasFitnessChanged()
public abstract Chromosome clone()
clone
Create a deep copy of the chromosomeclone in interface PublicCloneable<Chromosome>clone in class Objectpublic int compareTo(Chromosome c)
compareTo in interface Comparable<Chromosome>public abstract <T extends Chromosome> int compareSecondaryObjective(T o)
o - a Chromosome object.public abstract void mutate()
public void crossOver(Chromosome other, int position) throws ConstructionFailedException
other - a Chromosome object.position - a int.ConstructionFailedException - if any.public abstract void crossOver(Chromosome other, int position1, int position2) throws ConstructionFailedException
other - a Chromosome object.position1 - a int.position2 - a int.ConstructionFailedException - if any.public abstract boolean localSearch(LocalSearchObjective<? extends Chromosome> objective)
objective - a LocalSearchObjective
object.public abstract int size()
public boolean isChanged()
public void setChanged(boolean changed)
changed - a boolean.public boolean hasLocalSearchBeenApplied()
public void setLocalSearchApplied(boolean localSearchApplied)
public double getCoverage()
Getter for the field coverage.
Properties.COMPOSITIONAL_FITNESS is false. Otherwise (
Properties.COMPOSITIONAL_FITNESS==true), returns the average of
coverage values for all fitness functions.public int getNumOfCoveredGoals()
public int getNumOfNotCoveredGoals()
public void setNumsOfCoveredGoals(Map<FitnessFunction<?>,Integer> fits)
public void setNumsOfNotCoveredGoals(Map<FitnessFunction<?>,Integer> fits)
public void setNumOfNotCoveredGoals(FitnessFunction<?> ff, int numCoveredGoals)
public Map<FitnessFunction<?>,Integer> getNumsOfCoveredGoals()
public LinkedHashMap<FitnessFunction<?>,Integer> getNumsNotCoveredGoals()
public Map<FitnessFunction<?>,Double> getCoverageValues()
public void setCoverageValues(Map<FitnessFunction<?>,Double> coverages)
public double getCoverage(FitnessFunction<?> ff)
ff - a fitness functionffpublic void setCoverage(FitnessFunction<?> ff, double coverage)
ff - a fitness functioncoverage - the coverage valuepublic int getNumOfCoveredGoals(FitnessFunction<?> ff)
ff - a fitness functionffpublic int getNumOfNotCoveredGoals(FitnessFunction<?> ff)
ff - a fitness functionffpublic void setNumOfCoveredGoals(FitnessFunction<?> ff, int numCoveredGoals)
ff - a fitness functionnumCoveredGoals - the number of covered goalspublic void updateAge(int generation)
public int getAge()
public int getRank()
public void setRank(int r)
public double getDistance()
public void setDistance(double d)
public double getFitnessInstanceOf(Class<?> clazz)
public double getCoverageInstanceOf(Class<?> clazz)
Copyright © 2010–2017 EvoSuite. All rights reserved.