Project#
A stateful project. It holds one accepted baseline (the last solved dates), takes incremental edits and answers read-only questions about them: previews, analytics, load, candidate scoring and assignment proposals. Create one with new Project(), then load data with solve.
For a one-shot run over a snapshot, use Engine.schedule instead.
Declaration#
;
Project has no public fields. It isn't AutoCloseable and needs no explicit release; the garbage collector reclaims it.
solve, apply and level change the project. Every other method leaves its state unchanged. All methods are synchronous and CPU-only. Each one throws NullPointerException for a null argument that isn't documented as nullable. All engine exceptions are unchecked; no method declares throws.
Project isn't synchronized, and that includes the read-only methods and copy(), which updates internal sharing flags on the source. Serialize access to one instance. To work from several threads, make one copy() per thread on a single thread first, or score candidates with evaluateWith and Execution.parallel(). See Share a project between threads.
Constructors#
Project()#
public
Creates an empty, unsolved project with strict validation. Same as new Project((ProjectOptions) null).
Project(ProjectOptions)#
public
Creates an empty, unsolved project. The constructor deep-copies options, so later changes to the caller's object don't reach the project.
Parameters
| Name | Type | Description |
|---|---|---|
options |
ProjectOptions |
Project-wide settings, such as the validation mode. Nullable; null uses the defaults (strict validation). |
Returns an empty Project with no baseline.
Project(Project)#
public
Creates a copy of other. Same as other.copy().
Parameters
| Name | Type | Description |
|---|---|---|
other |
Project |
The project to copy |
Methods#
Each method below except copy, equals and hashCode has its own page with the full contract.
solve#
public ScheduleResult
Schedules the project and accepts the scheduled dates as the baseline. A ProjectData replaces the project's data. null reschedules the current state after apply, or returns the cached result when nothing changed since a solve with equal options.
Returns a ScheduleResult that the project keeps as its baseline.
Errors: InputException for invalid data, ProjectException NEEDS_RESYNC for null after a rejected apply. See Project#solve.
preview#
public ScheduleResult
Schedules hypothetical changes on a copy of the solved baseline. The project isn't modified.
Returns a ScheduleResult for the previewed state.
Errors: ProjectException NO_BASELINE / STALE_BASELINE, InputException for a rejected operation. See Project#preview.
analyze#
public ScheduleResult
Computes analytics, cycles and overallocations over supplied dates, or over the current dates when data is null. It doesn't schedule and never installs data.
Returns a ScheduleResult with empty updates.
Errors: InputException for invalid supplied data. See Project#analyze.
apply#
public ApplyReport
Commits edits to the accepted state and marks it unsolved. Rejected operations go into the report, not into an exception, and leave the project needing a full solve(data, …).
Returns an ApplyReport.
Errors: ProjectException NEEDS_RESYNC / STALE_BASELINE. See Project#apply.
level#
public LevelingResult
Solves the current state, resolves resource overallocation with persistent levelingDelay / pauses edits and accepts the leveled state as the baseline. To see leveling without committing it, call level on a copy().
Returns a LevelingResult.
Errors: InputException for invalid options, ProjectException NEEDS_RESYNC. See Project#level.
loadProfile#
public LoadProfile
Reads per-bucket load and capacity of resources on the solved baseline. Wrap a ProfileQuery in new LoadProfileOptions(query).
Returns a LoadProfile.
Errors: ProjectException NO_BASELINE / STALE_BASELINE, InputException for an invalid range or resource. See Project#loadProfile.
evaluate#
public EvaluateResult
public EvaluateResult
Scores alternative change sets against the solved baseline, each on a disposable copy. The project is never modified. A failure inside one candidate goes into that candidate's result.
Returns an EvaluateResult.
Errors: ProjectException NO_BASELINE / STALE_BASELINE, InputException for invalid options. See Project#evaluate.
evaluateWith#
public EvaluateResult
public EvaluateResult
evaluate with a choice of Execution. Execution.parallel(...) scores candidates on a thread pool and blocks until all finish. Results are identical to evaluate and keep input order.
Returns an EvaluateResult.
Errors: same as evaluate. See Project#evaluate.
suggestAssignments#
public SuggestResult
public SuggestResult
Proposes resources for requirement slots and returns the proposal as a change set. The project is never modified; commit the proposal with apply(result.changes).
Returns a SuggestResult.
Errors: ProjectException NO_BASELINE / STALE_BASELINE, InputException for invalid options or slots. See Project#suggestAssignments.
roster#
public Roster
Reads the accepted state without skills: scheduled leaf tasks, resources and active assignments, in model order.
Returns a Roster.
Errors: ProjectException NO_BASELINE when the project is unsolved or has unsolved edits. See Project#roster.
copy#
public Project
Returns an independent copy. Both projects share their state, including the cached solve result, until one of them changes it, so copying is cheap. Edits to one copy never affect the other.
Shared results are the same objects in both projects. Treat them as read-only, or call deepClone() on one before modifying it.
Returns a new Project with the same state, baseline and validation mode.
equals / hashCode#
public boolean
public int
Identity-based: a project equals only itself, and a copy never equals its source.
Example#
Load a project, commit an edit and reschedule it, falling back to a full reload when the edit is rejected.
;
;
Related#
ProjectOptions- the constructor options, such as the validation modeProject#solve- loading data and accepting a baselineProject#apply- committing edits- Data updates - editing a live project
- Share a project between threads - one copy per thread