Class FastCLARANS.Assignment

    • Field Detail

      • loss

        double[] loss
        Array for storing the per-medoid loss.
      • lastbest

        protected int lastbest
        Last best medoid number
    • Constructor Detail

      • Assignment

        public Assignment​(DistanceQuery<?> distQ,
                          DBIDs ids,
                          int k)
        Constructor.
        Parameters:
        distQ - Distance query
        ids - IDs to process
        k - Number of medoids
    • Method Detail

      • computeRemovalCost

        protected void computeRemovalCost​(double[] pcost)
        Precompute the costs of reassigning to the second closest medoid.
        Parameters:
        pcost - Output cost
      • computeCostDifferential

        protected double computeCostDifferential​(DBIDRef h,
                                                 double[] pcost)
        Compute the reassignment cost, for one swap.
        Parameters:
        h - Current object to swap with any medoid
        pcost - Prior cost for removing
        Returns:
        Cost change
      • performLastSwap

        protected void performLastSwap​(DBIDRef h)
        Compute the reassignment cost, for one swap.
        Parameters:
        h - Current object to swap with the best medoid