Class LoadBalanceImpl<Balanced_>

java.lang.Object
ai.timefold.solver.core.impl.score.stream.collector.LoadBalanceImpl<Balanced_>
All Implemented Interfaces:
LoadBalance<Balanced_>

public final class LoadBalanceImpl<Balanced_> extends Object implements LoadBalance<Balanced_>
  • Constructor Details

    • LoadBalanceImpl

      public LoadBalanceImpl()
  • Method Details

    • registerBalanced

      public Runnable registerBalanced(Balanced_ balanced, long metricValue, long initialMetricValue)
    • unregisterBalanced

      public void unregisterBalanced(Balanced_ balanced, long metricValue)
    • loads

      public @NonNull Map<Balanced_,Long> loads()
      Description copied from interface: LoadBalance
      Returns the items being balanced, along with their total load. The iteration order of the map is undefined. For use in justifications, create a defensive copy of the map; the map itself is mutable and will be mutated by the constraint collector.
      Specified by:
      loads in interface LoadBalance<Balanced_>
    • unfairness

      public @NonNull BigDecimal unfairness()
      Description copied from interface: LoadBalance
      The unfairness measure describes how fairly the load is distributed over the items; the higher the number, the higher the imbalance. When zero, the load is perfectly balanced.

      Unfairness is a dimensionless number which is solution-specific. Comparing unfairness between solutions of different input problems is not helpful. Only compare unfairness measures of solutions which have the same set of balanced items as input.

      Specified by:
      unfairness in interface LoadBalance<Balanced_>
      Returns:
      never negative, six decimal places