@Override
  void prepare(BalancerClusterState cluster) {
    super.prepare(cluster);
    cost.prepare(cluster.numServers);
    cost.applyCostsChange(costs -> {
      for (int i = 0; i < costs.length; i++) {
        costs[i] = computeCostForRegionServer(i);
      }
    });
  }
Base class the allows writing costs functions from rolling average of some number from
RegionLoad.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CostFromRegionLoadFunction.java