protected class AbstractCapacitatedMinimumSpanningTree.CapacitatedSpanningTreeSolutionRepresentation
extends java.lang.Object
implements java.lang.Cloneable
| Constructor and Description |
|---|
CapacitatedSpanningTreeSolutionRepresentation()
Constructs a new solution representation for the CMST problem.
|
CapacitatedSpanningTreeSolutionRepresentation(java.util.Map<V,java.lang.Integer> labels,
java.util.Map<java.lang.Integer,Pair<java.util.Set<V>,java.lang.Double>> partition)
Constructs a new solution representation for the CMST problem based on
labels and partition. |
| Modifier and Type | Method and Description |
|---|---|
CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,E> |
calculateResultingSpanningTree()
Calculates the resulting spanning tree based on this solution representation.
|
void |
cleanUp()
Cleans up the solution representation by removing all empty sets from the partition.
|
AbstractCapacitatedMinimumSpanningTree.CapacitatedSpanningTreeSolutionRepresentation |
clone()
Returns a shallow copy of this solution representation instance.
|
int |
getLabel(V vertex)
Returns the label of the subset that contains
vertex. |
java.util.Set<java.lang.Integer> |
getLabels()
Returns all labels of all subsets.
|
int |
getNextFreeLabel()
Returns the next free label in the label map respectively partition
|
java.util.Set<V> |
getPartitionSet(java.lang.Integer label)
Returns the set of vertices that are in the subset with label
label. |
double |
getPartitionWeight(java.lang.Integer label)
Returns the sum of the weights of all vertices that are in the subset with label
label. |
void |
moveVertex(V vertex,
java.lang.Integer fromLabel,
java.lang.Integer toLabel)
Moves
vertex from the subset represented by fromLabel to the
subset represented by toLabel. |
void |
moveVertices(java.util.Set<V> vertices,
java.lang.Integer fromLabel,
java.lang.Integer toLabel)
Moves all vertices in
vertices from the subset represented by
fromLabel to the subset represented by toLabel. |
java.util.Set<java.lang.Integer> |
partitionSubtreesOfSubset(java.util.Set<V> vertexSubset,
int label)
Refines the partition by adding new subsets if the designated root has more than one
subtree in the subset
label of the partition. |
public CapacitatedSpanningTreeSolutionRepresentation()
public CapacitatedSpanningTreeSolutionRepresentation(java.util.Map<V,java.lang.Integer> labels, java.util.Map<java.lang.Integer,Pair<java.util.Set<V>,java.lang.Double>> partition)
labels and partition. All labels have to be positive.labels - the labels of the subsets in the partitionpartition - the partition mappublic CapacitatedSpanningTreeAlgorithm.CapacitatedSpanningTree<V,E> calculateResultingSpanningTree()
public void moveVertex(V vertex, java.lang.Integer fromLabel, java.lang.Integer toLabel)
vertex from the subset represented by fromLabel to the
subset represented by toLabel.vertex - the vertex to movefromLabel - the subset to move the vertex fromtoLabel - the subset to move the vertex topublic void moveVertices(java.util.Set<V> vertices, java.lang.Integer fromLabel, java.lang.Integer toLabel)
vertices from the subset represented by
fromLabel to the subset represented by toLabel.vertices - the vertices to movefromLabel - the subset to move the vertices fromtoLabel - the subset to move the vertices topublic java.util.Set<java.lang.Integer> partitionSubtreesOfSubset(java.util.Set<V> vertexSubset, int label)
label of the partition.vertexSubset - the subset represented by label, that is the subset that
has to be refinedlabel - the label of the subset of the partition that were refinedpublic void cleanUp()
public int getNextFreeLabel()
public int getLabel(V vertex)
vertex.vertex - the vertex to return the label fromvertexpublic java.util.Set<java.lang.Integer> getLabels()
public java.util.Set<V> getPartitionSet(java.lang.Integer label)
label.label - the label of the subset to return the vertices fromlabelpublic double getPartitionWeight(java.lang.Integer label)
label.label - the label of the subset to return the weight fromlabelpublic AbstractCapacitatedMinimumSpanningTree.CapacitatedSpanningTreeSolutionRepresentation clone()
clone in class java.lang.Objectjava.lang.RuntimeException - in case the clone is not supportedObject.clone()Copyright © 2019. All Rights Reserved.