Initializing help system before first use

# set_duration_with_idle_times

Purpose
If the task is assigned to this resource, the then the following statements will be enforced:
From the given nominal duration, the duration variable will be constrained to take the following values:

- duration if the task does not intersect any idle time window
- duration increased by total length of the intersecting idle time windows

For example, if a resource is idle on two time windows [s1, e1) and [s2, e2), then this method declares that the tasks intersecting those idle times windows will be extended.

- If a task T1 starts before s1 but its duration make it intersect [s1, e1), then its duration variable will be T1.duration = duration + e1 - s1
- If a task T2 starts before s1 but its updated duration make it intersect [s1, e1) and [s2, e2), then its duration variable will be T2.duration = duration + (e1 - s1) + (e2 - s2)
- If a task T3 starts in the idle interval [s1, e1), then its duration variable will be T3.duration = duration + (e1 - T3.start)
- If a task T4 starts in the idle interval [s1, e1) and its updated duration make it intersect [s2, e2) then its duration variable will be T4.duration = duration + (e1 - T4.start) + (e2 - s2)

Note that if allow_start_in_idle is false then T3 and T4 cases will be forbidden. The idle time windows can be given in any order and can be intersecting (union is made). Note that idle time windows are a strict end interval (end time step is not in the interval). If the nominal duration is dependent on the start time of the task, the update_duration_with_idle_times procedure can be used instead.
When developing the model, it is recommended to check the start-based duration constraint by printing the constraint: cp_show_var_constraints(getduration(task))
Synopsis
`procedure set_duration_with_idle_times(resource: cpresource, task:cptask, duration:integer, idle_starts:list of integer, idle_ends:list of integer, allow_start_in_idle:boolean)`
Arguments

resource | a resource
task | a task
duration | The expected nominal duration of the task without idle times
idle_starts | The idle time windows start (must be of same length as idle_ends)
idle_ends | The idle time windows end (must be of same length as idle_starts)
allow_start_in_idle | If true, the task will be able to start in an idle time window.

Related topics
get_start_based_duration setduration update_duration_with_idle_times cp_show_var_constraints
Parent Topic Scheduling

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.