[Canonical page](<https://docs.dhtmlx.com/planning-engine/java/api/project/project/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# 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()`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#constructors>), then load data with [`solve`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#solve>).

For a one-shot run over a snapshot, use [`Engine.schedule`](<https://docs.dhtmlx.com/planning-engine/java/api/engine-schedule.md>) instead.

## Declaration

```java
package org.dhtmlx.plen;

public class Project extends ValueRecord
```

`Project` has no public fields. It isn't `AutoCloseable` and needs no explicit release; the garbage collector reclaims it.

[`solve`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#solve>), [`apply`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#apply>) and [`level`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#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()`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#copy>) per thread on a single thread first, or score candidates with [`evaluateWith`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#evaluatewith>) and [`Execution.parallel()`](<https://docs.dhtmlx.com/planning-engine/java/api/evaluate/execution.md>). See [Share a project between threads](<https://docs.dhtmlx.com/planning-engine/java/how-to/share-a-project-between-threads.md>).

## Constructors

### Project()

```java
public Project()
```

Creates an empty, unsolved project with strict validation. Same as `new Project((ProjectOptions) null)`.

### Project(ProjectOptions)

```java
public Project(ProjectOptions options)
```

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`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project-options.md>) | Project-wide settings, such as the validation mode. Nullable; `null` uses the defaults (strict validation). |

**Returns** an empty `Project` with no baseline.

### Project(Project)

```java
public Project(Project other)
```

Creates a copy of `other`. Same as [`other.copy()`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#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

```java
public ScheduleResult solve(ProjectData data, SolveOptions options)
```

Schedules the project and accepts the scheduled dates as the baseline. A [`ProjectData`](<https://docs.dhtmlx.com/planning-engine/java/api/data/project-data.md>) 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`](<https://docs.dhtmlx.com/planning-engine/java/api/results/schedule-result.md>) that the project keeps as its baseline.

**Errors**: [`InputException`](<https://docs.dhtmlx.com/planning-engine/java/api/errors/input-exception.md>) for invalid data, [`ProjectException`](<https://docs.dhtmlx.com/planning-engine/java/api/errors/project-exception.md>) `NEEDS_RESYNC` for `null` after a rejected `apply`. See [`Project#solve`](<https://docs.dhtmlx.com/planning-engine/java/api/project-solve.md>).

### preview

```java
public ScheduleResult preview(SchedulingChanges changes, PreviewOptions options)
```

Schedules hypothetical changes on a copy of the solved baseline. The project isn't modified.

**Returns** a [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/java/api/results/schedule-result.md>) for the previewed state.

**Errors**: `ProjectException` `NO_BASELINE` / `STALE_BASELINE`, `InputException` for a rejected operation. See [`Project#preview`](<https://docs.dhtmlx.com/planning-engine/java/api/project-preview.md>).

### analyze

```java
public ScheduleResult analyze(ProjectData data, AnalyzeOptions options)
```

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`](<https://docs.dhtmlx.com/planning-engine/java/api/results/schedule-result.md>) with empty `updates`.

**Errors**: `InputException` for invalid supplied data. See [`Project#analyze`](<https://docs.dhtmlx.com/planning-engine/java/api/project-analyze.md>).

### apply

```java
public ApplyReport apply(SchedulingChanges changes)
```

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`](<https://docs.dhtmlx.com/planning-engine/java/api/changes/apply-report.md>).

**Errors**: `ProjectException` `NEEDS_RESYNC` / `STALE_BASELINE`. See [`Project#apply`](<https://docs.dhtmlx.com/planning-engine/java/api/project-apply.md>).

### level

```java
public LevelingResult level(LevelingOptions options)
```

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()`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md#copy>).

**Returns** a [`LevelingResult`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/leveling-result.md>).

**Errors**: `InputException` for invalid options, `ProjectException` `NEEDS_RESYNC`. See [`Project#level`](<https://docs.dhtmlx.com/planning-engine/java/api/project-level.md>).

### loadProfile

```java
public LoadProfile loadProfile(LoadProfileOptions options)
```

Reads per-bucket load and capacity of resources on the solved baseline. Wrap a [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/profile-query.md>) in [`new LoadProfileOptions(query)`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/load-profile-options.md>).

**Returns** a [`LoadProfile`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/load-profile.md>).

**Errors**: `ProjectException` `NO_BASELINE` / `STALE_BASELINE`, `InputException` for an invalid range or resource. See [`Project#loadProfile`](<https://docs.dhtmlx.com/planning-engine/java/api/project-load-profile.md>).

### evaluate

```java
public EvaluateResult evaluate(Vec<Candidate> candidates, EvaluateOptions options)
public EvaluateResult evaluate(Collection<Candidate> candidates, EvaluateOptions options)
```

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`](<https://docs.dhtmlx.com/planning-engine/java/api/evaluate/evaluate-result.md>).

**Errors**: `ProjectException` `NO_BASELINE` / `STALE_BASELINE`, `InputException` for invalid options. See [`Project#evaluate`](<https://docs.dhtmlx.com/planning-engine/java/api/project-evaluate.md>).

### evaluateWith

```java
public EvaluateResult evaluateWith(
    Vec<Candidate> candidates, EvaluateOptions options, Execution execution)
public EvaluateResult evaluateWith(
    Collection<Candidate> candidates, EvaluateOptions options, Execution execution)
```

`evaluate` with a choice of [`Execution`](<https://docs.dhtmlx.com/planning-engine/java/api/evaluate/execution.md>). `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`](<https://docs.dhtmlx.com/planning-engine/java/api/evaluate/evaluate-result.md>).

**Errors**: same as `evaluate`. See [`Project#evaluate`](<https://docs.dhtmlx.com/planning-engine/java/api/project-evaluate.md>).

### suggestAssignments

```java
public SuggestResult suggestAssignments(Vec<Slot> slots, SuggestOptions options)
public SuggestResult suggestAssignments(Collection<Slot> slots, SuggestOptions options)
```

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`](<https://docs.dhtmlx.com/planning-engine/java/api/suggest/suggest-result.md>).

**Errors**: `ProjectException` `NO_BASELINE` / `STALE_BASELINE`, `InputException` for invalid options or slots. See [`Project#suggestAssignments`](<https://docs.dhtmlx.com/planning-engine/java/api/project-suggest-assignments.md>).

### roster

```java
public Roster roster()
```

Reads the accepted state without skills: scheduled leaf tasks, resources and active assignments, in model order.

**Returns** a [`Roster`](<https://docs.dhtmlx.com/planning-engine/java/api/suggest/roster.md>).

**Errors**: `ProjectException` `NO_BASELINE` when the project is unsolved or has unsolved edits. See [`Project#roster`](<https://docs.dhtmlx.com/planning-engine/java/api/project-roster.md>).

### copy

```java
public Project copy()
```

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

```java
public boolean equals(Object other)
public int hashCode()
```

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.

```java
import java.util.List;
import org.dhtmlx.plen.*;

public class ProjectExample {
  public static void main(String[] args) throws Exception {
    Moment monday = Moment.fromYmdHm(2026, 8, 10, 8, 0);
    ProjectData data = new ProjectData()
        .withTasks(List.of(new TaskData(Id.num(1)).withStartDate(monday).withDuration(2.0)));

    SolveOptions options = new SolveOptions();
    Project project = new Project();
    project.solve(data, options);

    SchedulingChanges changes = new SchedulingChanges();
    changes.tasks.update.add(new TaskUpdate(Id.num(1)).withDuration(Patch.of(3.0)));

    ApplyReport report = project.apply(changes);
    ScheduleResult result = report.needsResync
        ? project.solve(data, options)
        : project.solve(null, options);

    for (Mutation update : result.updates) {
      System.out.println("task " + update.id + ": " + update.startDate + " .. " + update.endDate);
    }
  }
}
```

## Related

- [`ProjectOptions`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project-options.md>) - the constructor options, such as the validation mode
- [`Project#solve`](<https://docs.dhtmlx.com/planning-engine/java/api/project-solve.md>) - loading data and accepting a baseline
- [`Project#apply`](<https://docs.dhtmlx.com/planning-engine/java/api/project-apply.md>) - committing edits
- [Data updates](<https://docs.dhtmlx.com/planning-engine/java/live-projects/editing-a-project.md>) - editing a live project
- [Share a project between threads](<https://docs.dhtmlx.com/planning-engine/java/how-to/share-a-project-between-threads.md>) - one copy per thread
