Project#level#
Resolves resource overallocation in a Project. It runs solve(null, …) with default options first, then writes persistent levelingDelay and pauses edits and accepts the leveled state as the baseline.
Signature#
public LevelingResult
Synchronous and CPU-only. Changes the project's state. Not synchronized: serialize calls on one instance.
Parameters#
| Name | Type | Description |
|---|---|---|
options |
LevelingOptions |
Scope, order, basis and how leveling may move tasks. Must not be null |
Behavior#
- Forward scheduling only.
- On a cyclic project, it returns the initial solve's result with
rounds= 0. - The leveled dates replace the baseline. To see leveling without committing it, call
levelon acopy(). - Known bug: the call doesn't return when an assignment asks for more units than its resource can ever supply, for example
value1.25on capacity1.
Returns#
A LevelingResult. The project keeps its schedule as the baseline and shares it with copies. Treat schedule as read-only, or call deepClone() before changing it.
Errors#
All exceptions are unchecked.
| Error | When |
|---|---|
InputException |
An unknown id in options.scope.resources or options.scope.tasks (path is scope.resources / scope.tasks); the project has config.scheduleFromEnd = true (path is config.schedule_from_end) |
ProjectException with code == ProjectError.NEEDS_RESYNC |
Thrown by the initial solve |
NullPointerException |
options is null |
Example#
Level two tasks that share one resource, first on a copy, then on the project itself.
;
;
Related#
LevelingOptions- scope, order, basis and how tasks may moveLevelingResult- the leveled schedule and what changed- Leveling resources - delays, pauses, selection order and reading the result
- Preview leveling - leveling a copy without committing it
- Clear leveling - removing leveling delays and pauses