Class ResourceLeveler

java.lang.Object
com.codename1.scheduling.ResourceLeveler

public final class ResourceLeveler extends Object

Finds where a project asks more of a resource than there is, and proposes delays that take the excess away.

Leveling never shortens or splits a task and never changes a link. It takes the earliest moment a resource is overbooked, keeps the tasks that can least afford to wait and holds one of the others back until a place is free: the one with the most slack first, so the project's finish moves only when no slack is left, then the one with the lowest priority. A task that is scheduled manually, has a "must" constraint or has priority 1000 is never moved.

This is a heuristic, as it is in every planning tool: the best order is not something that can be computed for a project of any size.

  • Method Details

    • findOverallocations

      public static List<ResourceOverallocation> findOverallocations(ProjectModel model)
      Every stretch in which a resource is overbooked, ordered by resource and then by time.
    • loadProfile

      public static float[] loadProfile(ProjectModel model, String resourceId, long from, long to, int buckets)
      How much of a resource is asked for over time: the most units in use at once in each of the buckets equal slices of [from, to). Divide by the resource's capacity for a load.
    • level

      public static LevelingResult level(ProjectModel model)
      Proposes leveling delays for the whole project, starting from none. The project is left exactly as it was; see LevelingResult.apply.