use of org.evosuite.ga.variables.Variable in project evosuite by EvoSuite.
the class SBXCrossover method crossOver.
@Override
public void crossOver(Chromosome p1, Chromosome p2) throws ConstructionFailedException {
NSGAChromosome n1 = (NSGAChromosome) p1;
NSGAChromosome n2 = (NSGAChromosome) p2;
for (int i = 0; i < n1.getNumberOfVariables(); i++) {
Variable v1 = n1.getVariable(i);
Variable v2 = n2.getVariable(i);
if ((v1 instanceof DoubleVariable) && (v2 instanceof DoubleVariable))
this.doCrossover((DoubleVariable) v1, (DoubleVariable) v2);
}
}
use of org.evosuite.ga.variables.Variable in project evosuite by EvoSuite.
the class NSGAChromosome method clone.
@Override
public Chromosome clone() {
NSGAChromosome c = new NSGAChromosome();
c.setFitnessValues(this.getFitnessValues());
c.setPreviousFitnessValues(this.getPreviousFitnessValues());
for (Variable v : this.getVariables()) {
c.addVariable(v.clone());
}
c.setChanged(this.isChanged());
c.setCoverageValues(this.getCoverageValues());
c.setNumsOfCoveredGoals(this.getNumsOfCoveredGoals());
c.updateAge(this.getAge());
c.setRank(this.getRank());
c.setDistance(this.getDistance());
c.setNumberOfMutations(this.getNumberOfMutations());
c.setNumberOfEvaluations(this.getNumberOfEvaluations());
return c;
}
Aggregations