Search in sources :

Example 46 with Chromosome

use of org.evosuite.ga.Chromosome in project evosuite by EvoSuite.

the class NeighbourhoodTest method testNorthEastNeighbour.

@Test
public void testNorthEastNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.compactNine(population, 5);
    Chromosome exepcted_individual = population.get(2);
    Chromosome returned_individual = neighbors.get(6);
    assertEquals(exepcted_individual, returned_individual);
}
Also used : Neighbourhood(org.evosuite.ga.Neighbourhood) ArrayList(java.util.ArrayList) Chromosome(org.evosuite.ga.Chromosome) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) Test(org.junit.Test)

Example 47 with Chromosome

use of org.evosuite.ga.Chromosome in project evosuite by EvoSuite.

the class NeighbourhoodTest method testRingTopology_mostRightNeighbour.

@Test
public void testRingTopology_mostRightNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.ringTopology(population, 15);
    Chromosome exepcted_individual = population.get(0);
    Chromosome returned_individual = neighbors.get(2);
    assertEquals(exepcted_individual, returned_individual);
}
Also used : Neighbourhood(org.evosuite.ga.Neighbourhood) ArrayList(java.util.ArrayList) Chromosome(org.evosuite.ga.Chromosome) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) Test(org.junit.Test)

Example 48 with Chromosome

use of org.evosuite.ga.Chromosome in project evosuite by EvoSuite.

the class NeighbourhoodTest method testNorthNeighbour.

@Test
public void testNorthNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.linearFive(population, 5);
    Chromosome exepcted_individual = population.get(1);
    Chromosome returned_individual = neighbors.get(0);
    assertEquals(exepcted_individual, returned_individual);
}
Also used : Neighbourhood(org.evosuite.ga.Neighbourhood) ArrayList(java.util.ArrayList) Chromosome(org.evosuite.ga.Chromosome) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) Test(org.junit.Test)

Example 49 with Chromosome

use of org.evosuite.ga.Chromosome in project evosuite by EvoSuite.

the class NeighbourhoodTest method testMostNorthWestNeighbour.

@Test
public void testMostNorthWestNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.CompactThirteen(population, 0);
    Chromosome exepcted_individual = population.get(15);
    Chromosome returned_individual = neighbors.get(4);
    assertEquals(exepcted_individual, returned_individual);
}
Also used : Neighbourhood(org.evosuite.ga.Neighbourhood) ArrayList(java.util.ArrayList) Chromosome(org.evosuite.ga.Chromosome) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) Test(org.junit.Test)

Example 50 with Chromosome

use of org.evosuite.ga.Chromosome in project evosuite by EvoSuite.

the class NeighbourhoodTest method testWestWestNeighbour.

@Test
public void testWestWestNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.CompactThirteen(population, 5);
    Chromosome exepcted_individual = population.get(7);
    Chromosome returned_individual = neighbors.get(11);
    assertEquals(exepcted_individual, returned_individual);
}
Also used : Neighbourhood(org.evosuite.ga.Neighbourhood) ArrayList(java.util.ArrayList) Chromosome(org.evosuite.ga.Chromosome) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) Test(org.junit.Test)

Aggregations

Chromosome (org.evosuite.ga.Chromosome)60 Test (org.junit.Test)41 TestSuiteChromosome (org.evosuite.testsuite.TestSuiteChromosome)32 ArrayList (java.util.ArrayList)29 Neighbourhood (org.evosuite.ga.Neighbourhood)20 FitnessFunction (org.evosuite.ga.FitnessFunction)15 List (java.util.List)13 SBXCrossover (org.evosuite.ga.operators.crossover.SBXCrossover)13 BinaryTournamentSelectionCrowdedComparison (org.evosuite.ga.operators.selection.BinaryTournamentSelectionCrowdedComparison)13 Problem (org.evosuite.ga.problems.Problem)13 NSGAChromosome (org.evosuite.ga.NSGAChromosome)12 NSGAII (org.evosuite.ga.metaheuristics.NSGAII)12 RandomFactory (org.evosuite.ga.metaheuristics.RandomFactory)12 GenerationalDistance (org.evosuite.ga.problems.metrics.GenerationalDistance)9 Spacing (org.evosuite.ga.problems.metrics.Spacing)9 TestChromosome (org.evosuite.testcase.TestChromosome)6 BranchCoverageSuiteFitness (org.evosuite.coverage.branch.BranchCoverageSuiteFitness)5 LineCoverageSuiteFitness (org.evosuite.coverage.line.LineCoverageSuiteFitness)5 DoubleVariable (org.evosuite.ga.variables.DoubleVariable)4 EvoSuite (org.evosuite.EvoSuite)3