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


# SolveOptions

Options for [`Project#solve`](<https://docs.dhtmlx.com/planning-engine/js/api/project-solve.md>) and [`schedule`](<https://docs.dhtmlx.com/planning-engine/js/api/schedule.md>). They set which part of the project is scheduled and what extra data the [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/js/api/types/schedule-result.md>) carries. Every field is optional: `{}` schedules the whole project and reports only the changed tasks.

```ts
interface SolveOptions {
  subtree?: Subtree;
  analytics?: AnalyticsOptions;
  reasons?: boolean;
  includeUnchanged?: boolean;
}
```

## Fields

| Field | Type | Default | Description |
|---|---|---|---|
| `subtree` | [`Subtree`](<https://docs.dhtmlx.com/planning-engine/js/api/types/common.md#subtree>) | whole project | Schedules only one task's subtree and the tasks that depend on it. |
| `analytics` | [`AnalyticsOptions`](<https://docs.dhtmlx.com/planning-engine/js/api/types/common.md#analyticsoptions>) | no analytics | Requests critical path and slack. With `criticalPath` or `slack` set to `true`, the result carries `analytics`; check its `status` before reading the data. |
| `reasons` | `boolean` | `false` | `true` adds a `reason` to each entry of the result's `updates`: why the task moved. |
| `includeUnchanged` | `boolean` | `false` | `true` also reports unchanged tasks in the result's `updates`, so the result holds the full date list. |

### includeUnchanged

With `false`, `updates` holds only the tasks the solve changed or that edits touched. With `true`, `updates` also holds every scheduled task that didn't change, each with `start_date`, `end_date` and `duration` set.

- Every scheduled task is reported: leaves, summaries and milestones. Unscheduled tasks are never reported.
- With `subtree`, every task in the subtree is reported, ancestors of subtree tasks included, plus the usual changed or touched updates outside the subtree.
- On a project with cycles, every scheduled task is reported in model order (`subtree` is ignored), with its stored dates and durations.
- `leveling_delay` and `pauses` never appear in these entries.

The extra entries don't affect the result's `baselineId`, which follows real date changes only. Every other result field is the same as with `includeUnchanged: false`.

## Used by

- [`Project#solve`](<https://docs.dhtmlx.com/planning-engine/js/api/project-solve.md>): the `options` argument
- [`schedule`](<https://docs.dhtmlx.com/planning-engine/js/api/schedule.md>): the `options` argument

[`Project#preview`](<https://docs.dhtmlx.com/planning-engine/js/api/project-preview.md>) takes `PreviewOptions`, which has the same `subtree`, `analytics` and `reasons` fields but no `includeUnchanged`.

## Example

```js
const options = {
  subtree: { task: "design" },
  analytics: { criticalPath: true, slack: true },
  reasons: true,
  includeUnchanged: true,
};
```

## Related

- [`Project#solve`](<https://docs.dhtmlx.com/planning-engine/js/api/project-solve.md>) - the call that takes these options
- [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/js/api/types/schedule-result.md>) - what the options add to the result
- [Scheduling a Project](<https://docs.dhtmlx.com/planning-engine/js/scheduling/scheduling-a-project.md#solve-options>) - the options in context
- [Load all task dates](<https://docs.dhtmlx.com/planning-engine/js/how-to/load-all-task-dates.md>) - `includeUnchanged` on the first solve
- [Reschedule a branch](<https://docs.dhtmlx.com/planning-engine/js/how-to/reschedule-a-branch.md>) - scheduling one subtree
