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


# SchedulingConfig

Project-wide scheduling settings. It's the `config` field of [`ProjectData`](<https://docs.dhtmlx.com/planning-engine/java/api/data/project-data.md>), which starts as `new SchedulingConfig()`. Create one with the constructor and chain `withX(value)` setters only for the fields that differ from the defaults.

## Declaration

```java
public class SchedulingConfig extends ValueRecord implements DeepCloneable<SchedulingConfig>
```

The config is read when project data is solved or analyzed. A [`Project`](<https://docs.dhtmlx.com/planning-engine/java/api/project/project.md>) deep-copies the data it solves, so changing this object afterwards has no effect until the next `solve(data, …)`.

## Constructors

### SchedulingConfig()

```java
public SchedulingConfig()
```

Creates a config with every field at its default.

## Fields

Every field is public and mutable. Each one has a fluent setter `withX(value)` that assigns the field and returns this instance.

### applyConstraints

```java
public boolean applyConstraints = false;
public SchedulingConfig withApplyConstraints(boolean value)
```

`true` turns task constraints ([`TaskData.constraintType`](<https://docs.dhtmlx.com/planning-engine/java/api/data/task-data.md#constrainttype>)) into hard bounds. Violations are reported as conflicts in the result. `false` ignores every constraint, `MSO` and `MFO` included.

### scheduleFromEnd

```java
public boolean scheduleFromEnd = false;
public SchedulingConfig withScheduleFromEnd(boolean value)
```

`true` plans the project backward (ALAP), from `projectEnd` and the tasks' end dates. [`Project#level`](<https://docs.dhtmlx.com/planning-engine/java/api/project-level.md>) doesn't support backward projects.

### gapBehavior

```java
public GapBehavior gapBehavior = GapBehavior.PRESERVE;
public SchedulingConfig withGapBehavior(GapBehavior value)
```

What happens to the free time between a task and the bound its links put on it. The values are listed in the [`GapBehavior`](<https://docs.dhtmlx.com/planning-engine/java/api/data/scheduling-config.md#gapbehavior-1>) section below.

### moveProjects

```java
public boolean moveProjects = true;
public SchedulingConfig withMoveProjects(boolean value)
```

`true` moves a summary task with its children as one block. `false` expands links on a summary to its leaf tasks.

### projectConstraint

```java
public boolean projectConstraint = false;
public SchedulingConfig withProjectConstraint(boolean value)
```

`true` makes a task without its own constraint inherit the dated constraint of its nearest ancestor. Takes effect only with `applyConstraints`; `groupMode` turns it off.

### groupMode

```java
public boolean groupMode = false;
public SchedulingConfig withGroupMode(boolean value)
```

`true` suppresses the constraint inheritance of `projectConstraint`. It has no other effect.

### useProgress

```java
public boolean useProgress = false;
public SchedulingConfig withUseProgress(boolean value)
```

`true` treats a task with `progress == 1` as completed: it keeps its dates and never moves.

### descendantLinks

```java
public boolean descendantLinks = false;
public SchedulingConfig withDescendantLinks(boolean value)
```

`true` allows a link between a summary task and one of its own descendants. With `false`, such a link is dropped and reported as a [`Note.DroppedLink`](<https://docs.dhtmlx.com/planning-engine/java/api/results/note.md>).

### calendarMode

```java
public CalendarMode calendarMode = CalendarMode.RESOURCE;
public SchedulingConfig withCalendarMode(CalendarMode value)
```

Which calendars place the work: resource calendars intersected with task calendars, or task calendars only. See [`CalendarMode`](<https://docs.dhtmlx.com/planning-engine/java/api/data/calendar-mode.md>).

### strictCalendar

```java
public boolean strictCalendar = false;
public SchedulingConfig withStrictCalendar(boolean value)
```

`true` reports a `Conflict.CalendarNonWorking` when a task that moves with its summary block lands on non-working time. See [`Conflict`](<https://docs.dhtmlx.com/planning-engine/java/api/results/conflict.md>).

### maxIterations

```java
public int maxIterations = 8;
public SchedulingConfig withMaxIterations(int value)
```

Upper limit on planner passes. Must be at least `1`; `0` fails validation with an [`InputException`](<https://docs.dhtmlx.com/planning-engine/java/api/errors/input-exception.md>) at `config.max_iterations`. When the limit is reached, the result's [`converged`](<https://docs.dhtmlx.com/planning-engine/java/api/results/schedule-result.md#converged>) is `false`.

### projectStart

```java
public Moment projectStart = null;
public SchedulingConfig withProjectStart(Moment value)
```

Start bound of a forward project. `null` (default) sets no bound. How the bound applies to tasks with and without predecessors is in [Scheduling a project](<https://docs.dhtmlx.com/planning-engine/java/scheduling/scheduling-a-project.md>). In [`Validation.REPAIR`](<https://docs.dhtmlx.com/planning-engine/java/api/project/validation.md>) mode it's also the start date given to tasks without dates.

### projectEnd

```java
public Moment projectEnd = null;
public SchedulingConfig withProjectEnd(Moment value)
```

End bound of a backward project, used when `scheduleFromEnd` is `true`. `null` (default) sets no bound.

### durationUnit

```java
public TimeUnit durationUnit = TimeUnit.DAY;
public SchedulingConfig withDurationUnit(TimeUnit value)
```

Default unit of [`TaskData.duration`](<https://docs.dhtmlx.com/planning-engine/java/api/data/task-data.md#fields>) and [`LinkData.lag`](<https://docs.dhtmlx.com/planning-engine/java/api/data/link-data.md#lag>), used when a task or link sets no unit of its own. See [`TimeUnit`](<https://docs.dhtmlx.com/planning-engine/java/api/data/time-unit.md>).

### useCalendars

```java
public boolean useCalendars = true;
public SchedulingConfig withUseCalendars(boolean value)
```

`false` makes every calendar flat 24/7 time, so all time is working time.

### defaultResourceCapacity

```java
public double defaultResourceCapacity = 1.0;
public SchedulingConfig withDefaultResourceCapacity(double value)
```

Capacity of a resource whose [`ResourceData.capacity`](<https://docs.dhtmlx.com/planning-engine/java/api/data/resource-data.md#fields>) is `null`, in assignment `value` units (`1.0` = 100 %). Must be finite and non-negative; anything else fails validation with an `InputException` at `config.default_resource_capacity`.

### rootId

```java
public Id rootId = Id.num(0.0);
public SchedulingConfig withRootId(Id value)
```

The [`TaskData.parent`](<https://docs.dhtmlx.com/planning-engine/java/api/data/task-data.md#fields>) value that means "no parent", for data whose virtual root isn't `0`. Ids compare as normalized keys, so the default matches both [`Id.num(0)`](<https://docs.dhtmlx.com/planning-engine/java/api/data/id.md>) and `Id.str("0")`. A parent equal to `rootId` is removed on import, so stored tasks never point at the root. With another `rootId`, a task with id `0` is an ordinary parent. An empty string `""` always means "no parent" as well.

## Methods

### deepClone

```java
public SchedulingConfig deepClone()
```

Returns a copy that shares no state with this instance.

**Returns** - a new `SchedulingConfig` with the same values.

### copy

```java
public SchedulingConfig copy()
```

Returns a shallow copy. The fields are copied by reference; [`Moment`](<https://docs.dhtmlx.com/planning-engine/java/api/data/moment.md>) and `Id` values are shared with this instance.

**Returns** - a new `SchedulingConfig` with the same values.

`equals`, `hashCode` and `toString` come from [`ValueRecord`](<https://docs.dhtmlx.com/planning-engine/java/api/support/value-record.md>): structural equality over the public fields and a `SchedulingConfig{applyConstraints=false, …}` dump.

## GapBehavior

What happens to the gap between a task and the earliest position its links allow. Set through `SchedulingConfig.gapBehavior`.

```java
public enum GapBehavior {
  PRESERVE,
  COMPRESS
}
```

| Value | Description |
|---|---|
| `PRESERVE` | Default. A task keeps its own dates when its links allow them. A link moves it only when the task would otherwise start too early. |
| `COMPRESS` | Every task is pulled to the earliest position its links and constraints allow, closing the gaps. |

How each mode interacts with links and project bounds is in [Links, constraints and summaries](<https://docs.dhtmlx.com/planning-engine/java/scheduling/links-constraints-summaries.md>).

## Example

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

public class ConfigExample {
  public static void main(String[] args) throws Exception {
    Moment kickoff = Moment.fromYmdHm(2026, 3, 2, 8, 0);

    ProjectData data =
        new ProjectData()
            .withConfig(
                new SchedulingConfig()
                    .withApplyConstraints(true)
                    .withGapBehavior(GapBehavior.COMPRESS)
                    .withDurationUnit(TimeUnit.HOUR)
                    .withProjectStart(kickoff))
            .withTasks(
                List.of(
                    new TaskData(Id.num(1)).withStartDate(kickoff).withDuration(16.0),
                    new TaskData(Id.num(2)).withStartDate(kickoff).withDuration(8.0)))
            .withLinks(
                List.of(
                    new LinkData()
                        .withId(Id.num(1))
                        .withSource(Id.num(1))
                        .withTarget(Id.num(2))));

    ScheduleResult result = Engine.schedule(data, new SolveOptions());
    System.out.println(result.converged);
  }
}
```

## Related

- [`ProjectData`](<https://docs.dhtmlx.com/planning-engine/java/api/data/project-data.md>) - where the config is set
- [`CalendarMode`](<https://docs.dhtmlx.com/planning-engine/java/api/data/calendar-mode.md>) - task or resource calendars
- [`TimeUnit`](<https://docs.dhtmlx.com/planning-engine/java/api/data/time-unit.md>) - the default duration unit
- [Scheduling config](<https://docs.dhtmlx.com/planning-engine/java/scheduling/project-data.md#scheduling-config>) - the switches that change scheduling
- [Links, constraints and summaries](<https://docs.dhtmlx.com/planning-engine/java/scheduling/links-constraints-summaries.md>) - constraints, gap behaviour and summaries
