21import java.util.ArrayList;
24import denoptim.exception.DENOPTIMException;
25import denoptim.graph.AttachmentPoint;
26import denoptim.graph.DGraph;
27import denoptim.graph.Template;
28import denoptim.graph.Vertex;
29import denoptim.utils.CrossoverType;
103 this.subGraphA =
new ArrayList<Vertex>(
subGraphA);
104 this.subGraphB =
new ArrayList<Vertex>(
subGraphB);
136 this.subGraphA =
new ArrayList<Vertex>(
subGraphA);
137 this.subGraphB =
new ArrayList<Vertex>(
subGraphB);
138 this.needyAPsOnA =
new ArrayList<AttachmentPoint>(
needyAPsOnA);
139 this.needyAPsOnB =
new ArrayList<AttachmentPoint>(
needyAPsOnB);
152 mirror.subGraphA =
new ArrayList<Vertex>(this.subGraphB);
153 mirror.subGraphB =
new ArrayList<Vertex>(this.subGraphA);
154 mirror.needyAPsOnA =
new ArrayList<AttachmentPoint>(
156 mirror.needyAPsOnB =
new ArrayList<AttachmentPoint>(
171 clone.subGraphA =
new ArrayList<Vertex>(this.subGraphA);
172 clone.subGraphB =
new ArrayList<Vertex>(this.subGraphB);
173 clone.needyAPsOnA =
new ArrayList<AttachmentPoint>(
175 clone.needyAPsOnB =
new ArrayList<AttachmentPoint>(
257 return this.xoverType==other.xoverType
258 && this.subGraphA.equals(other.
subGraphA)
259 && this.subGraphB.equals(other.
subGraphB)
282 DGraph cloneOutermostGraphA, cloneA;
283 DGraph cloneOutermostGraphB, cloneB;
284 if (embeddingPathA.size()==0)
286 cloneOutermostGraphA = gA.
clone();
287 cloneA = cloneOutermostGraphA;
289 cloneOutermostGraphA = embeddingPathA.get(0)
290 .getGraphOwner().
clone();
292 embeddingPathA.get(0).getGraphOwner(), embeddingPathA);
294 if (embeddingPathB.size()==0)
296 cloneOutermostGraphB = gB.
clone();
297 cloneB = cloneOutermostGraphB;
299 cloneOutermostGraphB = embeddingPathB.get(0)
300 .getGraphOwner().
clone();
302 embeddingPathB.get(0).getGraphOwner(), embeddingPathB);
307 List<Vertex> refsOnCloneA =
new ArrayList<Vertex>();
308 List<AttachmentPoint> needyOnCloneA =
309 new ArrayList<AttachmentPoint>();
313 vA.getGraphOwner().indexOf(vA));
314 refsOnCloneA.add(vCloneA);
319 needyOnCloneA.add(vCloneA.
getAP(ap.getIndexInOwner()));
323 List<Vertex> refsOnCloneB =
new ArrayList<Vertex>();
324 List<AttachmentPoint> needyOnCloneB =
325 new ArrayList<AttachmentPoint>();
329 vB.getGraphOwner().indexOf(vB));
330 refsOnCloneB.add(vCloneB);
335 needyOnCloneB.add(vCloneB.
getAP(ap.getIndexInOwner()));
This class collects the data identifying the subgraphs that would be swapped by a crossover event.
List< AttachmentPoint > needyAPsOnB
List of attachment points on subgraph A and that need to be replaced by a corresponding attachment po...
List< Vertex > subGraphB
The other of the two subgraphs.
XoverSite clone()
Creates a new XoverSite that contains the same information of this one, i.e., a shallow copy.
List< Vertex > subGraphA
One of the two subgraphs.
XoverSite projectToClonedGraphs()
Creates a new instance of this class that contains the list of vertexes that correspond to those cont...
XoverSite()
Initiate an empty data structure.
List< AttachmentPoint > getAPsNeedingMappingA()
Returns the collection of attachment points that need to be mapped in order to achieve a valid crosso...
List< AttachmentPoint > needyAPsOnA
List of attachment points on subgraph B and that need to be replaced by a corresponding attachment po...
XoverSite(List< Vertex > subGraphA, List< AttachmentPoint > needyAPsOnA, List< Vertex > subGraphB, List< AttachmentPoint > needyAPsOnB, CrossoverType xoverType)
Create a site by listing the vertexes that belong to each of the subgraphs that should be swapped by ...
List< AttachmentPoint > getAPsNeedingMappingB()
Returns the collection of attachment points that need to be mapped in order to achieve a valid crosso...
CrossoverType getType()
Returns the type of crossover.
String toString()
Produced a string for showing what this object is.
XoverSite createMirror()
Creates a new XoverSite that considers the opposite order of candidates of this one.
List< Vertex > getA()
Returns the collection of vertexes belonging to the first subgraph.
boolean equals(Object o)
Compares this and another instance.
XoverSite(List< Vertex > subGraphA, List< Vertex > subGraphB, CrossoverType xoverType)
Create a site by listing the vertexes that belong to each of the subgraphs that should be swapped by ...
CrossoverType xoverType
Type of crossover.
List< Vertex > getB()
Returns the collection of vertexes belonging to the second subgraph.
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
Container for the list of vertices and the edges that connect them.
Vertex getVertexAtPosition(int pos)
Returns the vertex that is in the given position of the list of vertices belonging to this graph.
static DGraph getEmbeddedGraphInClone(DGraph graphY, DGraph graphB, List< Template > path)
Searches for a graphs (X) embedded at any level in a graph (Y) by knowing.
List< AttachmentPoint > getInterfaceAPs(List< Vertex > subGraphB)
Searches for all AttachmentPoints that represent the interface between a subgraph,...
DGraph clone()
Returns almost "deep-copy" of this graph.
void renumberGraphVertices()
Reassign vertex IDs to all vertices of this graph.
List< Template > getEmbeddingPath()
Find the path that one has to traverse to reach this graph from any template-embedding structure.
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.
Types of crossover defined.