Class RatioSortPolicy

java.lang.Object
com.helix.core.reorder.RatioSortPolicy
All Implemented Interfaces:
ReorderingPolicy

public class RatioSortPolicy extends Object implements ReorderingPolicy
Analytical baseline reordering policy sorting candidate clauses in ascending order of their cost-to-failure ratio (C_i / F_i).

Clauses with the lowest ratio (fastest to evaluate and most likely to fail) are placed first to maximize short-circuit probability.

  • Constructor Details

    • RatioSortPolicy

      public RatioSortPolicy()
  • Method Details

    • determineOrder

      public List<Integer> determineOrder(List<NodeStats> nodes)
      Description copied from interface: ReorderingPolicy
      Determines the optimal evaluation order of candidate AST clauses.
      Specified by:
      determineOrder in interface ReorderingPolicy
      Parameters:
      nodes - list of node statistics corresponding to candidate clauses
      Returns:
      list of 0-based indices representing the new evaluation sequence
    • computeRatio

      public double computeRatio(NodeStats stats)
      Computes the effective cost-to-failure ratio for a node.
      Parameters:
      stats - node statistics
      Returns:
      ratio value