Class ComplexityEvaluator
java.lang.Object
solvers.queueingnet.treeAlgorithms.ComplexityEvaluator
- Direct Known Subclasses:
TCComplexityEvaluator, TMVAComplexityEvaluator
Abstract class representing complexity evaluator for calculating the complexity of a tree algorithm if
it were to be run on a given tree representing a network.
- Author:
- Ben Homer, 2014.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classInternal class for storing and comparing time and space complexities. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClassCoverageUtilsThe ClassCoverageUtils object used for calculating the class coverage at certain nodes in the planted tree.protected doubleThe ratio of fully covered classes to partially covered classes for a given tree.protected double[]The per class mean sparsity.protected QNModelThe queueing network model we are trying to solve.protected doubleThe sparsity of the network demand matrix.protected ComplexityEvaluator.ComplexityBundleComplexity of running standard/sequential version of algorithm over specified model.protected ComplexityEvaluator.ComplexityBundleComplexity of running tree version of algorithm over specified model, for a given tree. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecalculateFcsToPcsRatio(Node root) Gets the ratio of fully covered classes to partially covered classes in the network.protected intcalculateNumberOfPcs(Node root) protected abstract ComplexityEvaluator.ComplexityBundlegetLeafNodeComplexity(Node node, PopulationVector pv) Gets the complexity of a leaf node computation in the tree algorithm.voidPrints out information about machine's spec.protected double[]protected doubleCalculates the sparsity of the network's demand matrix.protected abstract ComplexityEvaluator.ComplexityBundleGets the complexity of running standard/sequential algorithm over a network with the specified population vector.protected abstract ComplexityEvaluator.ComplexityBundlegetSubnetNodeComplexity(Node node, PopulationVector pv) Gets the complexity of a subnetwork node computation in the tree algorithm.protected ComplexityEvaluator.ComplexityBundlegetTreeComplexity(Node node, PopulationVector pv) Gets the complexity of running the tree algorithm over the specified tree.intgetTreeWithBestComplexity(Node[] roots, PopulationVector pv) Determines which tree from a list has the best complexity characteristics.protected abstract voidPrints a summary of the complexity evaluators calculations.abstract booleantreeHasAcceptableComplexity(Node root, PopulationVector pv) Determines if the tree algorithm for the specified tree has better complexity characteristics than the standard/sequential algorithm for the same network.
-
Field Details
-
qnm
The queueing network model we are trying to solve. -
ccu
The ClassCoverageUtils object used for calculating the class coverage at certain nodes in the planted tree. -
stdComplexity
Complexity of running standard/sequential version of algorithm over specified model. -
treeComplexity
Complexity of running tree version of algorithm over specified model, for a given tree. -
sparcityOfDemandsMatrix
protected double sparcityOfDemandsMatrixThe sparsity of the network demand matrix. -
perClassSparsityMeasure
protected double[] perClassSparsityMeasureThe per class mean sparsity. -
fcfToPcRatio
protected double fcfToPcRatioThe ratio of fully covered classes to partially covered classes for a given tree.
-
-
Constructor Details
-
ComplexityEvaluator
Constructor.- Parameters:
qnm- The queueing network model we are trying to solve.ccu- The ClassCoverageUtils object used for calculating the class coverage at certain nodes in the planted tree.
-
-
Method Details
-
treeHasAcceptableComplexity
Determines if the tree algorithm for the specified tree has better complexity characteristics than the standard/sequential algorithm for the same network.- Parameters:
root- The root node of the tree to test.pv- The per class population vector of the network.- Returns:
- A boolean indicating whether the tree has an acceptable expected complexity.
-
getStandardAlgorithmComplexity
protected abstract ComplexityEvaluator.ComplexityBundle getStandardAlgorithmComplexity(PopulationVector pv) Gets the complexity of running standard/sequential algorithm over a network with the specified population vector.- Parameters:
pv- The network's population vector.- Returns:
- A ComplexityBundle containing the expected time and space complexities.
-
getTreeComplexity
Gets the complexity of running the tree algorithm over the specified tree.- Parameters:
node- The tree root.pv- The per class population vector of the network.- Returns:
- A ComplexityBundle containing the expected time and space complexities.
-
getTreeWithBestComplexity
Determines which tree from a list has the best complexity characteristics.- Parameters:
roots- The list of tree roots.pv- The population vector of the network.- Returns:
- The index of the tree which has the best complexity characteristics.
-
getLeafNodeComplexity
protected abstract ComplexityEvaluator.ComplexityBundle getLeafNodeComplexity(Node node, PopulationVector pv) Gets the complexity of a leaf node computation in the tree algorithm.- Parameters:
node- The leaf node.pv- The per class population vector of the network.- Returns:
- A ComplexityBundle containing the expected time and space complexities.
-
getSubnetNodeComplexity
protected abstract ComplexityEvaluator.ComplexityBundle getSubnetNodeComplexity(Node node, PopulationVector pv) Gets the complexity of a subnetwork node computation in the tree algorithm.- Parameters:
node- The subnetwork node.pv- The per class population vector of the network.- Returns:
- A ComplexityBundle containing the expected time and space complexities.
-
printSummary
protected abstract void printSummary()Prints a summary of the complexity evaluators calculations. -
getMachineCapabilities
public void getMachineCapabilities()Prints out information about machine's spec. -
getSparcityOfDemandsMatrix
protected double getSparcityOfDemandsMatrix()Calculates the sparsity of the network's demand matrix.- Returns:
- The sparsity measure on scale from 0 to 1.
-
calculateFcsToPcsRatio
Gets the ratio of fully covered classes to partially covered classes in the network.- Parameters:
root- The root node.- Returns:
- The ratio of FCF to PCS.
-
calculateNumberOfPcs
-
getPerClassSparsityIndex
protected double[] getPerClassSparsityIndex()
-