Class ORLibBenchmark


  • public class ORLibBenchmark
    extends AbstractApplication
    Load an ORlib problem to evaluate k-medoids clustering quality.
    Since:
    0.8.0
    Author:
    Erich Schubert
    • Field Detail

      • LOG

        private static final Logging LOG
        Class logger.
      • file

        private java.net.URI file
        Input file.
      • k

        private int k
        Number of clusters override (optional)
    • Constructor Detail

      • ORLibBenchmark

        public ORLibBenchmark​(java.net.URI file,
                              java.lang.Class<? extends ClusteringAlgorithm<?>> alg,
                              KMedoidsInitialization<DBID> init,
                              int k,
                              RandomFactory rnd)
        Constructor.
        Parameters:
        file - Input file name
        alg - Algorithm class
        init - Random generator
        k - Override for the number of clusters
        rnd - Random generator for shuffling
    • Method Detail

      • readEdges

        private static double[] readEdges​(int n,
                                          TokenizedReader reader,
                                          Tokenizer tok)
                                   throws java.io.IOException
        Load the edge list.
        Parameters:
        n - Data set size
        reader - Reader
        tok - Tokenizer
        Returns:
        Matrix (missing values are infinity)
        Throws:
        java.io.IOException
      • allShortestPaths

        private static void allShortestPaths​(int n,
                                             double[] mat)
        Floyd's all-pairs shortest paths
        Parameters:
        n - Number of nodes
        mat - Matrix to complete
      • randomShuffle

        private double[] randomShuffle​(int n,
                                       double[] mat)
        Random shuffle of the matrix.
        Parameters:
        n - Data set size
        mat - Matrix
        Returns:
        New matrix
      • computeOffset

        private static int computeOffset​(int x,
                                         int y)
        Compute the offset within the file.
        Parameters:
        x - First coordinate
        y - Second coordinate
        Returns:
        Linear offset
      • main

        public static void main​(java.lang.String[] args)
        Main method, delegate to super class.
        Parameters:
        args - Command line arguments