protected class AbstractCapacitatedMinimumSpanningTree.CapacitatedSpanningTreeSolutionRepresentation extends Object implements Cloneable
| Constructor and Description |
|---|
CapacitatedSpanningTreeSolutionRepresentation()
Constructs a new solution representation for the CMST problem.
|
CapacitatedSpanningTreeSolutionRepresentation(Map<V,Integer> labels,
Map<Integer,Pair<Set<V>,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. |
Set<Integer> |
getLabels()
Returns all labels of all subsets.
|
int |
getNextFreeLabel()
Returns the next free label in the label map respectively partition
|
Set<V> |
getPartitionSet(Integer label)
Returns the set of vertices that are in the subset with label
label. |
double |
getPartitionWeight(Integer label)
Returns the sum of the weights of all vertices that are in the subset with label
label. |
void |
moveVertex(V vertex,
Integer fromLabel,
Integer toLabel)
Moves
vertex from the subset represented by fromLabel to the
subset represented by toLabel. |
void |
moveVertices(Set<V> vertices,
Integer fromLabel,
Integer toLabel)
Moves all vertices in
vertices from the subset represented by
fromLabel to the subset represented by toLabel. |
Set<Integer> |
partitionSubtreesOfSubset(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(Map<V,Integer> labels, Map<Integer,Pair<Set<V>,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, Integer fromLabel, 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(Set<V> vertices, Integer fromLabel, 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 Set<Integer> partitionSubtreesOfSubset(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 Set<Integer> getLabels()
public Set<V> getPartitionSet(Integer label)
label.label - the label of the subset to return the vertices fromlabelpublic double getPartitionWeight(Integer label)
label.label - the label of the subset to return the weight fromlabelpublic AbstractCapacitatedMinimumSpanningTree.CapacitatedSpanningTreeSolutionRepresentation clone()
clone in class ObjectRuntimeException - in case the clone is not supportedObject.clone()Copyright © 2019. All rights reserved.