$darkmode
DENOPTIM
denoptim.ga.PopulationTest Class Reference

Unit test. More...

Collaboration diagram for denoptim.ga.PopulationTest:
[legend]

Public Member Functions

void testXOverCompatibility () throws Exception
 
void testClone () throws Exception
 
void testGetMinMax () throws Exception
 
void testIsInPercentile () throws Exception
 
void testPopulationVersion () throws Exception
 

Static Public Member Functions

static GAParameters prepare () throws DENOPTIMException
 
static DGraph[] getPairOfTestGraphsB () throws Exception
 Builds a pair of graphs that contain templates with ContractLevel#FREE contract. More...
 
static DGraph[] getPairOfTestGraphsBxo () throws Exception
 Builds a pair of graphs that contain templates with ContractLevel#FREE contract. More...
 
static DGraph[] getPairOfTestGraphsBxoxo () throws Exception
 Builds a pair of graphs that contain templates with ContractLevel#FREE contract. More...
 

Static Package Functions

static DGraph makeGraphA () throws DENOPTIMException
 Produced a graph like this: More...
 
static DGraph makeGraphB () throws DENOPTIMException
 Produced a graph like this: More...
 
static DGraph makeGraphC () throws DENOPTIMException
 Produced a graph like this: More...
 
static DGraph makeGraphD () throws DENOPTIMException
 Produced a graph like this: More...
 
static DGraph makeGraphE () throws DENOPTIMException
 Produced a graph like this: More...
 
static DGraph makeGraphF () throws DENOPTIMException
 Produced a graph like this: More...
 

Private Member Functions

void compareSitesLists (List< XoverSite > listA, List< XoverSite > listB)
 Assumes the two lists have equal size. More...
 
void compareSizeOfSites (Candidate parentA, Map< Candidate, Integer > expectedForC1, List< Candidate > partnersForC1, Population pop)
 

Static Private Attributes

static APClass APCA
 
static APClass APCB
 
static APClass APCC
 
static APClass APCD
 

Detailed Description

Unit test.

Author
Marco Foscato

Definition at line 58 of file PopulationTest.java.

Member Function Documentation

◆ compareSitesLists()

void denoptim.ga.PopulationTest.compareSitesLists ( List< XoverSite listA,
List< XoverSite listB 
)
private

Assumes the two lists have equal size.

Definition at line 287 of file PopulationTest.java.

Referenced by denoptim.ga.PopulationTest.testClone().

Here is the caller graph for this function:

◆ compareSizeOfSites()

void denoptim.ga.PopulationTest.compareSizeOfSites ( Candidate  parentA,
Map< Candidate, Integer >  expectedForC1,
List< Candidate partnersForC1,
Population  pop 
)
private

Definition at line 298 of file PopulationTest.java.

References denoptim.graph.Candidate.getName(), and denoptim.ga.Population.getXoverSites().

Referenced by denoptim.ga.PopulationTest.testClone(), and denoptim.ga.PopulationTest.testXOverCompatibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPairOfTestGraphsB()

static DGraph[] denoptim.ga.PopulationTest.getPairOfTestGraphsB ( ) throws Exception
static

Builds a pair of graphs that contain templates with ContractLevel#FREE contract.

First Graph structure:

              (C)--(C)-v1
             /
v0-(A)--(A)-T1-(B)--(B)-v2-(C)--(C)-v3

where template T1 is


   (A)-v0-(A)--(A)-v1-(B)--(B)-v2-(C)
        |           |
       (A)         (A)--(A)-v5
        |                    |
        |                   chord
        |                    |
       (A)         (A)--(A)-v6
        |           |
       v3-(A)--(A)-v4-(B)

The second Graph structure:

v0-(A)--(A)-T2-(B)--(B)-v2-(C)--(C)-v3

where template T2 is


   (A)-v0-(A)--(A)-v1-(B)--(B)-v2
        |           
       (A) 
        |                 
       (A)         (A)--(A)-v5
        |           |
       v3-(A)--(A)-v4-(B)

NB: the graphs from methods getPairOfTestGraphsB() and getPairOfTestGraphsBxo() and
getPairOfTestGraphsBxoxo() are a sequence resulting from crossover operations. Note that the order of APs in on the templates changes as a result of the crossover. For this reason, the backwards crossover of the graphs from getPairOfTestGraphsBxo() does not produce the graphs from getPairOfTestGraphsB(), but those from getPairOfTestGraphsBxoxo().

Definition at line 736 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addRing(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCA, denoptim.ga.PopulationTest.APCB, denoptim.ga.PopulationTest.APCC, denoptim.graph.DGraph.appendVertexOnAP(), denoptim.graph.Template.ContractLevel.FREE, denoptim.graph.Vertex.getAP(), denoptim.graph.Vertex.BBType.NONE, denoptim.graph.Vertex.setAsRCV(), denoptim.graph.Template.setContractLevel(), denoptim.graph.DGraph.setGraphId(), denoptim.graph.Template.setInnerGraph(), denoptim.graph.Vertex.setProperty(), and denoptim.graph.Edge.BondType.SINGLE.

Referenced by denoptim.ga.PopulationTest.getPairOfTestGraphsBxoxo(), denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_FixedStructure(), denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_Free(), and denoptim.utils.GraphConversionToolTest.testGetJGraphKernelFromGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPairOfTestGraphsBxo()

static DGraph[] denoptim.ga.PopulationTest.getPairOfTestGraphsBxo ( ) throws Exception
static

Builds a pair of graphs that contain templates with ContractLevel#FREE contract.

First Graph structure:

              (B)--(C)-v1
             /
v0-(A)--(A)-T1-(B)--(B)-v2-(C)--(C)-v3

where template T1 is

  
                     (B)
                    /
   (A)-v0-(A)--(A)-v4-(A)--(A)-v5
        |           
       (A)         
        |                    
       (A)         (A)--(A)-v3
        |           |
       v1-(A)--(A)-v2-(B)

T
he second Graph structure:

v0-(A)--(A)-T2-(C)--(B)-v2-(C)--(C)-v3

where template T2 is

   (A)-v0-(A)--(A)-v1-(B)--(B)-v2 
        |           
       (A) 
        |                 
       (A)         (A)--(A)-v5
        |           |
       v3-(A)--(A)-v4-(B)--(B)-v6-(C)

NB: the graphs from methods getPairOfTestGraphsB() and getPairOfTestGraphsBxo() and
getPairOfTestGraphsBxoxo() are a sequence resulting from crossover operations. Note that the order of APs in on the templates changes as a result of the crossover. For this reason, the backwards crossover of the graphs from getPairOfTestGraphsBxo() does not produce the graphs from getPairOfTestGraphsB(), but those from getPairOfTestGraphsBxoxo().

Definition at line 945 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCA, denoptim.ga.PopulationTest.APCB, denoptim.ga.PopulationTest.APCC, denoptim.graph.DGraph.appendVertexOnAP(), denoptim.graph.Template.ContractLevel.FREE, denoptim.graph.Vertex.getAP(), denoptim.graph.Vertex.BBType.NONE, denoptim.graph.Vertex.setAsRCV(), denoptim.graph.Template.setContractLevel(), denoptim.graph.DGraph.setGraphId(), denoptim.graph.Template.setInnerGraph(), and denoptim.graph.Vertex.setProperty().

Referenced by denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_Free(), and denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_FreeBackwards().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPairOfTestGraphsBxoxo()

static DGraph[] denoptim.ga.PopulationTest.getPairOfTestGraphsBxoxo ( ) throws Exception
static

Builds a pair of graphs that contain templates with ContractLevel#FREE contract.

First Graph structure:

              (C)--(C)-v1
             /
v0-(A)--(A)-T1-(B)--(B)-v2-(C)--(C)-v3

where template T1 is


   (A)-v0-(A)--(A)-v4-(B)--(B)-v6-(C)
        |           |
       (A)         (A)--(A)-v5
        |                    |
        |                   chord
        |                    |
       (A)         (A)--(A)-v3
        |           |
       v1-(A)--(A)-v2-(B)

The second Graph structure:

v0-(A)--(A)-T2-(B)--(B)-v2-(C)--(C)-v3

where template T2 is


   (A)-v0-(A)--(A)-v1-(B)--(B)-v2
        |           
       (A) 
        |                 
       (A)         (A)--(A)-v5
        |           |
       v3-(A)--(A)-v4-(B)

NB: the graphs from methods getPairOfTestGraphsB() and getPairOfTestGraphsBxo() and
getPairOfTestGraphsBxoxo() are a sequence resulting from crossover operations. Note that the order of APs in on the templates changes as a result of the crossover. For this reason, the backwards crossover of the graphs from getPairOfTestGraphsBxo() does not produce the graphs from getPairOfTestGraphsB(), but those from getPairOfTestGraphsBxoxo(). Still, for simple cases there there is no branching, there is no change in the order of the APs upon crossover. For this reason, the second graph returned here is the same as the second returned by getPairOfTestGraphsB()

Definition at line 1159 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addRing(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCA, denoptim.ga.PopulationTest.APCB, denoptim.ga.PopulationTest.APCC, denoptim.graph.DGraph.appendVertexOnAP(), denoptim.graph.Template.ContractLevel.FREE, denoptim.graph.Vertex.getAP(), denoptim.ga.PopulationTest.getPairOfTestGraphsB(), denoptim.graph.Vertex.BBType.NONE, denoptim.graph.Vertex.setAsRCV(), denoptim.graph.Template.setContractLevel(), denoptim.graph.DGraph.setGraphId(), denoptim.graph.Template.setInnerGraph(), denoptim.graph.Vertex.setProperty(), and denoptim.graph.Edge.BondType.SINGLE.

Referenced by denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_FreeBackwards().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGraphA()

static DGraph denoptim.ga.PopulationTest.makeGraphA ( ) throws DENOPTIMException
staticpackage

Produced a graph like this:

 -(A)v0(A)-(A)v1(A)-(A)v2(A)-(A)v3(B)-(B)v4(B)-(B)v5(B)-

You must run prepare() before asking this class for any graph.

Definition at line 324 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addEdge(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCA, denoptim.ga.PopulationTest.APCB, denoptim.graph.Vertex.getAP(), denoptim.graph.DGraph.renumberGraphVertices(), denoptim.graph.Vertex.BBType.SCAFFOLD, and denoptim.graph.Vertex.setBuildingBlockType().

Referenced by denoptim.ga.EAUtilsTest.testBuildByXOver_SubGraph(), denoptim.ga.PopulationTest.testClone(), denoptim.ga.PopulationTest.testGetMinMax(), denoptim.ga.PopulationTest.testIsInPercentile(), denoptim.ga.PopulationTest.testPopulationVersion(), and denoptim.ga.PopulationTest.testXOverCompatibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGraphB()

static DGraph denoptim.ga.PopulationTest.makeGraphB ( ) throws DENOPTIMException
staticpackage

Produced a graph like this:

v0(A)-(A)v1(A)-(A)v2

You must run prepare() before asking this class for any graph.

Definition at line 373 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addEdge(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCA, denoptim.graph.Vertex.getAP(), denoptim.graph.DGraph.renumberGraphVertices(), denoptim.graph.Vertex.BBType.SCAFFOLD, and denoptim.graph.Vertex.setBuildingBlockType().

Referenced by denoptim.ga.PopulationTest.testClone(), denoptim.ga.PopulationTest.testGetMinMax(), denoptim.ga.PopulationTest.testIsInPercentile(), denoptim.ga.PopulationTest.testPopulationVersion(), and denoptim.ga.PopulationTest.testXOverCompatibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGraphC()

static DGraph denoptim.ga.PopulationTest.makeGraphC ( ) throws DENOPTIMException
staticpackage

Produced a graph like this:

-(C)v0(C)-(C)v1(A)-(A)v2

You must run prepare() before asking this class for any graph.

Definition at line 405 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addEdge(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCA, denoptim.ga.PopulationTest.APCC, denoptim.graph.Vertex.getAP(), denoptim.graph.DGraph.renumberGraphVertices(), denoptim.graph.Vertex.BBType.SCAFFOLD, and denoptim.graph.Vertex.setBuildingBlockType().

Referenced by denoptim.ga.PopulationTest.testGetMinMax(), denoptim.ga.PopulationTest.testPopulationVersion(), and denoptim.ga.PopulationTest.testXOverCompatibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGraphD()

static DGraph denoptim.ga.PopulationTest.makeGraphD ( ) throws DENOPTIMException
staticpackage

Produced a graph like this:

v0(D)-(D)v1

You must run prepare() before asking this class for any graph.

Definition at line 438 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addEdge(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCD, denoptim.graph.Vertex.getAP(), denoptim.graph.DGraph.renumberGraphVertices(), denoptim.graph.Vertex.BBType.SCAFFOLD, and denoptim.graph.Vertex.setBuildingBlockType().

Referenced by denoptim.ga.PopulationTest.testGetMinMax(), and denoptim.ga.PopulationTest.testXOverCompatibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGraphE()

static DGraph denoptim.ga.PopulationTest.makeGraphE ( ) throws DENOPTIMException
staticpackage

Produced a graph like this:

 v0(B)-(B)v1(A)-(A)v2(B)-(B)v3(A)-(A)v4(B)-(B)v5

You must run prepare() before asking this class for any graph.

Definition at line 464 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addEdge(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCA, denoptim.ga.PopulationTest.APCB, denoptim.graph.Vertex.getAP(), denoptim.graph.Vertex.BBType.SCAFFOLD, and denoptim.graph.Vertex.setBuildingBlockType().

Referenced by denoptim.ga.EAUtilsTest.testBuildByXOver_SubGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGraphF()

static DGraph denoptim.ga.PopulationTest.makeGraphF ( ) throws DENOPTIMException
staticpackage

Produced a graph like this:

 -(A)v0(A)-(A)v1(A)-(A)v2(A)-(A)v3(A)-(A)v4(A)-(A)v5(A)-(A)v6(A)-(A)v7(A)-

You must run prepare() before asking this class for any graph.

Definition at line 510 of file PopulationTest.java.

References denoptim.graph.EmptyVertex.addAP(), denoptim.graph.DGraph.addEdge(), denoptim.graph.DGraph.addVertex(), denoptim.ga.PopulationTest.APCA, denoptim.graph.Vertex.getAP(), denoptim.graph.DGraph.renumberGraphVertices(), denoptim.graph.Vertex.BBType.SCAFFOLD, and denoptim.graph.Vertex.setBuildingBlockType().

Here is the call graph for this function:

◆ prepare()

◆ testClone()

◆ testGetMinMax()

void denoptim.ga.PopulationTest.testGetMinMax ( ) throws Exception

◆ testIsInPercentile()

void denoptim.ga.PopulationTest.testIsInPercentile ( ) throws Exception

Definition at line 603 of file PopulationTest.java.

References denoptim.ga.Population.add(), denoptim.ga.Population.isWithinPercentile(), denoptim.ga.PopulationTest.makeGraphA(), denoptim.ga.PopulationTest.makeGraphB(), denoptim.ga.PopulationTest.prepare(), and denoptim.graph.Candidate.setFitness().

Here is the call graph for this function:

◆ testPopulationVersion()

void denoptim.ga.PopulationTest.testPopulationVersion ( ) throws Exception

Definition at line 644 of file PopulationTest.java.

References denoptim.ga.Population.add(), denoptim.ga.Population.getVersionID(), denoptim.ga.PopulationTest.makeGraphA(), denoptim.ga.PopulationTest.makeGraphB(), denoptim.ga.PopulationTest.makeGraphC(), denoptim.ga.PopulationTest.prepare(), denoptim.ga.Population.remove(), and denoptim.ga.Population.set().

Here is the call graph for this function:

◆ testXOverCompatibility()

Member Data Documentation

◆ APCA

◆ APCB

◆ APCC

◆ APCD

APClass denoptim.ga.PopulationTest.APCD
staticprivate

The documentation for this class was generated from the following file: