Class TreePlanter
java.lang.Object
solvers.queueingnet.treeAlgorithms.TreePlanter
Class responsible for the tree planting phase of the Tree Convolution algorithm.
- Author:
- Ben Homer, 2014.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum for different tree planting approaches. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTreePlanter(QNModel qnm, ClassCoverageUtils ccu, ComplexityEvaluator ce, TreePrinter treePrinter) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateTreeWithClonedStation(int m) Creates a copy of the current tree with station m cloned as an additional leaf node.createTreeWithRemovedStation(int m) Creates a copy of the current tree with the node for station m removed.Gets the plant mode used to plant the current tree.voidPrints the current tree.voidPrints a tree from specific root node.Creates and returns a clone of the planted tree's root node.booleanRuns the main tree planting phase.treeRoot()Gets the planted tree's root node.
-
Field Details
-
treePlantTimer
The timer for the tree planting phase.
-
-
Constructor Details
-
TreePlanter
public TreePlanter(QNModel qnm, ClassCoverageUtils ccu, ComplexityEvaluator ce, TreePrinter treePrinter) Constructor.- Parameters:
qnm- The queueing network model to solve.ccu- The class coverage utilities helper.ce- The complexity evaluator.treePrinter- The tree printer.
-
-
Method Details
-
treeRoot
-
getPlantModeUsed
Gets the plant mode used to plant the current tree.- Returns:
- The plant mode as a string.
-
rootClone
Creates and returns a clone of the planted tree's root node.- Returns:
- The cloned root node.
-
printCurrentTree
public void printCurrentTree()Prints the current tree. -
printTree
Prints a tree from specific root node.- Parameters:
root- The tree root to print from.
-
runTreePlantingPhase
public boolean runTreePlantingPhase()Runs the main tree planting phase. Consists of two steps: 1. Plant the tree. 2. Check this tree has acceptable complexity characteristics, if not go back to step 1.- Returns:
- A boolean indicating whether an adequate tree was found.
-
createTreeWithClonedStation
Creates a copy of the current tree with station m cloned as an additional leaf node. In the Lam/Lien paper this is referred to as the Gm+ tree.- Parameters:
m- The station/queue to clone in the tree.- Returns:
- The parent node of the two cloned nodes.
-
createTreeWithRemovedStation
Creates a copy of the current tree with the node for station m removed. In the Lam/Lien paper this is referred to as the Gm- tree.- Parameters:
m- The station/queue to remove from the tree.- Returns:
- The parent node of the removed node.
-