public class ClusterModelStatsByResourceUtilizationDeviationComparator extends Object implements ClusterModelStatsComparator
ClusterModelStats
by resource utilization deviation. It first compares the number of balanced
brokers then compares the standard deviations if the stats after optimization shows less or equal amount of balanced
brokers.Constructor and Description |
---|
ClusterModelStatsByResourceUtilizationDeviationComparator(String goalName,
Resource resource) |
Modifier and Type | Method and Description |
---|---|
int |
compare(ClusterModelStats statsAfterOptimization,
ClusterModelStats statsBeforeOptimization)
Compare the
ClusterModelStats after and before optimization. |
String |
explainLastComparison()
This is a method to get the reason for the last comparison.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public int compare(ClusterModelStats statsAfterOptimization, ClusterModelStats statsBeforeOptimization)
ClusterModelStats
after and before optimization. This method returns a positive value if the
ClusterModelStats
after optimization is more balanced, 0 if equally balanced and negative value if less
balanced.
ClusterModelStats
after optimization is less balanced iff the following conditions are true:
(1) number of balanced brokers after optimization has not increased AND (2) standard deviation of the resource utilization of all brokers has increased.
ClusterModelStats
after optimization is equally balanced iff the following conditions are true:
(1) number of balanced brokers after optimization has not increased AND (2) standard deviation of the resource
utilization of all brokers stay the same within the epsilon defined in Resource.epsilon(double, double)
.
ClusterModelStats
after optimization is more balanced if either the number of balanced brokers after
optimization has increased or the standard deviation of the resource utilization of all brokers has decreased.
compare
in interface ClusterModelStatsComparator
compare
in interface Comparator<ClusterModelStats>
statsAfterOptimization
- statsAfterOptimization to be compared.statsBeforeOptimization
- statsBeforeOptimization to be compared.public String explainLastComparison()
ClusterModelStatsComparator
explainLastComparison
in interface ClusterModelStatsComparator