Class ClassCoverageUtils

java.lang.Object
solvers.queueingnet.treeAlgorithms.ClassCoverageUtils

public class ClassCoverageUtils extends Object
Implements functionality related to class coverage.
Author:
Ben Homer, 2014.
  • Field Details

  • Method Details

    • create

      public static ClassCoverageUtils create(QNModel qnm)
      Creates a local instance of a ClassCoverageUtils object to be used.
      Parameters:
      qnm - The queueing network model we are trying to solve.
      Returns:
      The local ClassCoverageUtils instance.
    • inst

      public static ClassCoverageUtils inst()
      Gets the local ClassCoverageUtils instance.
      Returns:
      The local ClassCoverageUtils instance.
    • getClassCoverage

      public ClassCoverageUtils.Covered getClassCoverage(int cls, TreeSet<Integer> subnet)
      With respect to a subset of stations (SUBNET), a) a class of customers is fully covered if the stations that the class visits are a subset of SUBNET, b) a class of customers is noncovered if the intersection between the stations that the class visits and SUBNET is empty, c) a class of customers is partially covered if only some of the stations that the class visits are in SUBNET.
      Parameters:
      cls - The class of customers.
      subnet - The subnetwork of stations.
      Returns:
      An enum describing whether the class is fully, non or partially covered with respect to the subnetwork.
    • getCoveredClasses

      public TreeSet<Integer> getCoveredClasses(ClassCoverageUtils.Covered cover, TreeSet<Integer> subnet)
      Gets the classes which are covered by subnet, with specified level of coverage.
      Parameters:
      cover - The level of coverge we are looking for.
      subnet - The subnetwork of stations to examine.
      Returns:
      the resulting tree set
    • calculateSubnetWeight

      public int calculateSubnetWeight(Node n)
      Calculates the weight of a subnetwork by implementing equation (10) from the LamLien83 paper.
      Parameters:
      n - The tree node to calculate the subnet weight at (subnet consists of all descendents).
      Returns:
      The weight of the subnetwork.
    • contract

      public PopulationVector contract(PopulationVector largePopVec, TreeSet<Integer> largePcs, TreeSet<Integer> smallPcs)
      Contracts a population vector to the necessary size depending on partially covered classes in smallPcs.
      Parameters:
      largePopVec - The population vector containing populations for each class in largePcs.
      largePcs - The set of partially covered classes corresponding to the largePopVec.
      smallPcs - The set of partially covered classes we want to find populations for.
      Returns:
      The population vector containing populations for each class in smallPcs.
    • expand

      public PopulationVector expand(PopulationVector oldPopVec, TreeSet<Integer> oldPcs, PopulationVector newPopVec, TreeSet<Integer> newPcs)
      Expands a population vector to the necessary size depending on partially covered classes in newPcs.
      Parameters:
      oldPopVec - The population vector.
      oldPcs - The old set of partially covered classes.
      newPopVec - The population vector containing max values for all classes in newPcs.
      newPcs - The news set of partially covered classes.
      Returns:
    • getIndex

      public int getIndex(int cls, TreeSet<Integer> pcs)
      Gets the index of the specified class in a set of classes.
      Parameters:
      cls - The class to find the index of.
      pcs - The set of classes to find the class in.
      Returns:
      The index.
    • convertIndex

      public int convertIndex(int idx, TreeSet<Integer> oldPcs, TreeSet<Integer> newPcs)
      Finds the index of a class in one set (oldPcs) then calculates the classes index in the new set (newPcs).
      Parameters:
      idx - The index of the class.
      oldPcs - The set to find the class in initially.
      newPcs - The set for which an index is calculated.
      Returns:
      The index of the class in newPcs.
    • nextPermutation

      public PopulationVector nextPermutation(PopulationVector pv, PopulationVector orig)
      Returns the next permutation of a population vector to be used in the convolution computation, given the current vector and the original start vector.
      Parameters:
      pv - The current permutation of the vector.
      orig - The original/start permutation of the vector.
      Returns:
      The next permutation of the vector.
    • nextPermutationUpwards

      public PopulationVector nextPermutationUpwards(PopulationVector pv, PopulationVector orig)
      Returns the next permutation of a population vector to be used in the convolution computation, given the current vector and the original start vector. This version counts upwards instead of down.
      Parameters:
      pv - The current permutation of the vector.
      orig - The original/start permutation of the vector.
      Returns:
      The next permutation of the vector.