Search in sources :

Example 51 with Chromosome

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

the class NeighbourhoodTest method testMostSouthWestNeighbour.

@Test
public void testMostSouthWestNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.CompactThirteen(population, 12);
    Chromosome exepcted_individual = population.get(3);
    Chromosome returned_individual = neighbors.get(5);
    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 52 with Chromosome

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

the class NeighbourhoodTest method testRingTopology_mostLeftNeighbour.

@Test
public void testRingTopology_mostLeftNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.ringTopology(population, 0);
    Chromosome exepcted_individual = population.get(15);
    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 53 with Chromosome

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

the class NeighbourhoodTest method testMostNorthEastNeighbour.

@Test
public void testMostNorthEastNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.CompactThirteen(population, 3);
    Chromosome exepcted_individual = population.get(12);
    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 54 with Chromosome

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

the class NeighbourhoodTest method testRingTopology_rightNeighbour.

@Test
public void testRingTopology_rightNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.ringTopology(population, 2);
    Chromosome exepcted_individual = population.get(3);
    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 55 with Chromosome

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

the class NeighbourhoodTest method testWestNeighbour.

@Test
public void testWestNeighbour() {
    this.constructPopulation();
    Neighbourhood<Chromosome> neighbourhood = new Neighbourhood<>(Properties.POPULATION);
    List<Chromosome> neighbors = new ArrayList<>();
    neighbors = neighbourhood.linearFive(population, 5);
    Chromosome exepcted_individual = population.get(4);
    Chromosome returned_individual = neighbors.get(3);
    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