SchedulingConfig#

Project-wide scheduling settings. It's the config field of ProjectData, 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#

public class SchedulingConfig extends ValueRecord implements DeepCloneable<SchedulingConfig>

The config is read when project data is solved or analyzed. A Project deep-copies the data it solves, so changing this object afterwards has no effect until the next solve(data, …).

Constructors#

SchedulingConfig()#

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#

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

true turns task constraints (TaskData.constraintType) into hard bounds. Violations are reported as conflicts in the result. false ignores every constraint, MSO and MFO included.

scheduleFromEnd#

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

true plans the project backward (ALAP), from projectEnd and the tasks' end dates. Project#level doesn't support backward projects.

gapBehavior#

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 section below.

moveProjects#

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#

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#

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

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

useProgress#

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.

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.

calendarMode#

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.

strictCalendar#

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.

maxIterations#

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 at config.max_iterations. When the limit is reached, the result's converged is false.

projectStart#

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. In Validation.REPAIR mode it's also the start date given to tasks without dates.

projectEnd#

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#

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

Default unit of TaskData.duration and LinkData.lag, used when a task or link sets no unit of its own. See TimeUnit.

useCalendars#

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

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

defaultResourceCapacity#

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

Capacity of a resource whose ResourceData.capacity 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#

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

The TaskData.parent 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) 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#

public SchedulingConfig deepClone()

Returns a copy that shares no state with this instance.

Returns - a new SchedulingConfig with the same values.

copy#

public SchedulingConfig copy()

Returns a shallow copy. The fields are copied by reference; Moment and Id values are shared with this instance.

Returns - a new SchedulingConfig with the same values.

equals, hashCode and toString come from ValueRecord: 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.

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.

Example#

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);
  }
}