org.apache.sysds.runtime.compress.cost

## Interface ICostEstimate

- All Superinterfaces:
    Serializable
  All Known Implementing Classes:
    ComputationCostEstimator, DistinctCostEstimator, MemoryCostEstimator

      public interface ICostEstimate
      extends Serializable

  A cost estimator interface. Cost here is either memory based or computation based. It is used to estimate the cost of a specific compression layout.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static org.apache.commons.logging.Log` | `LOG`
    `static long` | `serialVersionUID`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `getCostOfCollectionOfGroups(Collection<CompressedSizeInfoColGroup> gs)` Get the computation cost of a collection of column groups information.
    `double` | `getCostOfCollectionOfGroups(Collection<CompressedSizeInfoColGroup> gs, CompressedSizeInfoColGroup g)`
    `double` | `getCostOfColumnGroup(CompressedSizeInfoColGroup g)` If the instruction does not care about the inter column group cost, such as in memory cost or in computation cost of right or left matrix multiplication we simply estimate the cost of individual column groups.
    `double` | `getCostOfTwoGroups(CompressedSizeInfoColGroup g1, CompressedSizeInfoColGroup g2)`
    `double` | `getUncompressedCost(int nRows, int nCols, int sparsity)` Calculate the cost of execution if uncompressed.
    `boolean` | `isCompareAll()` Function that returns true if the cost is based an an all compare all column groups false otherwise.
    `boolean` | `shouldAnalyze(CompressedSizeInfoColGroup g1, CompressedSizeInfoColGroup g2)` Decide if the column groups should be analysed, or the worst case join should be expected.
    `boolean` | `shouldTryJoin(CompressedSizeInfoColGroup g1, CompressedSizeInfoColGroup g2)` Decide if the column groups should try to join, this is to filter obviously bad joins out.

- - ### Field Detail

    - #### serialVersionUID

          static final long serialVersionUID

      See Also:
        Constant Field Values

    - #### LOG

          static final org.apache.commons.logging.Log LOG

  - ### Method Detail

    - #### getUncompressedCost

          double getUncompressedCost(int nRows,
                                     int nCols,
                                     int sparsity)

      Calculate the cost of execution if uncompressed. This is used as an optimization goal to at least achieve, since if the uncompressed cost of calculation is lower than in compressed space we don't want to compress.
      Parameters:
        `nRows` - Number of rows in compression
        `nCols` - Number of columns in compression
        `sparsity` - Sparsity of the input
      Returns:
        The uncompressed cost.

    - #### getCostOfColumnGroup

          double getCostOfColumnGroup(CompressedSizeInfoColGroup g)

      If the instruction does not care about the inter column group cost, such as in memory cost or in computation cost of right or left matrix multiplication we simply estimate the cost of individual column groups.
      Parameters:
        `g` - Column group to estimate the cost of
      Returns:
        The Cost of this column group

    - #### getCostOfCollectionOfGroups

          double getCostOfCollectionOfGroups(Collection<CompressedSizeInfoColGroup> gs)

      Get the computation cost of a collection of column groups information. Since a some operations execution time depends on all compare all calculating the cost needs all the current groups to consider. This method therefore provide a method of comparing cost of all compare all.
      Parameters:
        `gs` - All the groups considered for this cost calculation
      Returns:
        The cost of the calculation

    - #### getCostOfCollectionOfGroups

          double getCostOfCollectionOfGroups(Collection<CompressedSizeInfoColGroup> gs,
                                             CompressedSizeInfoColGroup g)

    - #### getCostOfTwoGroups

          double getCostOfTwoGroups(CompressedSizeInfoColGroup g1,
                                    CompressedSizeInfoColGroup g2)

    - #### isCompareAll

          boolean isCompareAll()

      Function that returns true if the cost is based an an all compare all column groups false otherwise.
      Returns:
        boolean

    - #### shouldTryJoin

          boolean shouldTryJoin(CompressedSizeInfoColGroup g1,
                                CompressedSizeInfoColGroup g2)

      Decide if the column groups should try to join, this is to filter obviously bad joins out.
      Parameters:
        `g1` - Group 1
        `g2` - Group 2
      Returns:
        Boolean specifying if they should try to join.

    - #### shouldAnalyze

          boolean shouldAnalyze(CompressedSizeInfoColGroup g1,
                                CompressedSizeInfoColGroup g2)

      Decide if the column groups should be analysed, or the worst case join should be expected. This is use full if the column groups are very small and the in practice difference between joining or not is small.
      Parameters:
        `g1` - Group 1
        `g2` - Group 2
      Returns:
        If the joining should be analyzed.

Copyright © 2021 The Apache Software Foundation. All rights reserved.