[ library(gfd) | Reference Manual | Alphabetic Index ]

disjunctive_optional(+StartTimes, +Durations, +Scheduled)

Constrain the optional tasks with specified start times and durations to not overlap in time.
StartTimes
Collection of N start times for tasks (domain variables or integers)
Durations
Collection of N durations for tasks (non-negative domain variables or integers)
Scheduled
Collection of N scheduled booleans for task (0/1 domain variables or integers)

Description

A disjunctive scheduling constraint. StartTimes, Durations and Scheduled are collections (a la collection_to_list/2) of equal size N. Durations must be non-negative, and Scheduled are booleans (0/1). The declarative meaning is that the scheduled tasks with the given start times and durations do not overlap at any point in time. A task would not be scheduled if its Scheduled boolean is 0, and must be scheduled if 1.

Note that the constraint is implemented by different Gecode propagators, depending on if Durations contains domain variables or not. If Durations does have domain variables, the Gecode propagator requires an extra End domain variable specifying the end time, and a constraint

        
      End #= Start + Duration  
for each task. These are posted as part of the constraint (the End variables are not accessible by the user).

Any input variables which are not already domain variables will be converted into domain variables with default bounds.

This constraint is implemented using Gecode's unary() constraint (with extra constraints on task end times if any task duration is a domain variable).

See Also

disjunctive / 2, lists : collection_to_list / 2