C++ Reference: class SchedulingConstraintHelper

This documentation is automatically generated.

Helper class shared by the propagators that manage a given list of tasks.

One of the main advantage of this class is that it allows to share the vectors of tasks sorted by various criteria between propagator for a faster code.
Method
AddDurationMinReason

Return type: void

Arguments: int t

AddDurationMinReason

Return type: void

Arguments: int t, IntegerValue lower_bound

AddEndMaxReason

Return type: void

Arguments: int t, IntegerValue upper_bound

AddEndMinReason

Return type: void

Arguments: int t, IntegerValue lower_bound

AddEnergyAfterReason

Return type: void

Arguments: int t, IntegerValue energy_min, IntegerValue time

AddPresenceReason

Return type: void

Arguments: int t

AddReasonForBeingBefore

Return type: void

Arguments: int before, int after

Adds the reason why task "before" must be before task "after". That is StartMax(before) < EndMin(after).

AddStartMaxReason

Return type: void

Arguments: int t, IntegerValue upper_bound

AddStartMinReason

Return type: void

Arguments: int t, IntegerValue lower_bound

ClearOtherHelper

Return type: void

ClearReason

Return type: void

Functions to clear and then set the current reason.

DecreaseEndMax

Return type: ABSL_MUST_USE_RESULT bool

Arguments: int t, IntegerValue new_max_end

DurationMax

Return type: IntegerValue

Arguments: int t

DurationMin

Return type: IntegerValue

Arguments: int t

Helpers for the current bounds on the current task time window. [(duration-min) ... (duration-min)] ^ ^ ^ ^ start-min end-min start-max end-max Note that for tasks with variable durations, we don't necessarily have duration-min between the XXX-min and XXX-max value.

DurationVars

Return type: const std::vector<IntegerVariable>&

EndIsFixed

Return type: bool

Arguments: int t

EndMax

Return type: IntegerValue

Arguments: int t

EndMin

Return type: IntegerValue

Arguments: int t

EndVars

Return type: const std::vector<IntegerVariable>&

ImportOtherReasons

Return type: void

Arguments: const SchedulingConstraintHelper& other_helper

Adds to this helper reason all the explanation of the other helper. This checks that other_helper_ is null. This is used in the 2D energetic reasoning in the diffn constraint.

IncreaseStartMin

Return type: ABSL_MUST_USE_RESULT bool

Arguments: int t, IntegerValue new_min_start

Push something using the current reason. Note that IncreaseStartMin() will also increase the end-min, and DecreaseEndMax() will also decrease the start-max. Important: IncreaseStartMin() and DecreaseEndMax() can be called on an optional interval whose presence is still unknown and push a bound conditionned on its presence. The functions will do the correct thing depending on whether or not the start_min/end_max are optional variables whose presence implies the interval presence.

IsAbsent

Return type: bool

Arguments: int t

IsOptional

Return type: bool

Arguments: int t

Returns true if the corresponding fact is known for sure. A normal task is always present. For optional task for which the presence is still unknown, both of these function will return false.

IsPresent

Return type: bool

Arguments: int t

MutableIntegerReason

Return type: std::vector<IntegerLiteral>*

MutableLiteralReason

Return type: std::vector<Literal>*

It is also possible to directly manipulates the underlying reason vectors that will be used when pushing something.

NumTasks

Return type: int

Returns the number of task.

PushIntegerLiteral

Return type: ABSL_MUST_USE_RESULT bool

Arguments: IntegerLiteral bound

PushTaskAbsence

Return type: ABSL_MUST_USE_RESULT bool

Arguments: int t

ReportConflict

Return type: ABSL_MUST_USE_RESULT bool

ResetFromSubset

Return type: void

Arguments: const SchedulingConstraintHelper& other, absl::Span<const int> tasks

Resets the class to the same state as if it was constructed with the given subset of tasks from other.

SchedulingConstraintHelper

Arguments: const std::vector<IntervalVariable>& tasks, Model* model

All the functions below refer to a task by its index t in the tasks vector given at construction.

SchedulingConstraintHelper

Arguments: int num_tasks, Model* model

Temporary constructor. The class will not be usable until ResetFromSubset() is called. TODO(user): Remove this. It is a hack because the disjunctive class needs to fetch the maximum possible number of task at construction.

SetOtherHelper

Return type: void

Arguments: SchedulingConstraintHelper* other_helper, IntegerValue event

Manages the other helper (used by the diffn constraint). For each interval appearing in a reason on this helper, another reason will be added. This other reason specifies that on the other helper, the corresponding interval overlaps 'event'.

SetTimeDirection

Return type: void

Arguments: bool is_forward

Sets the time direction to either forward/backward. This will impact all the functions below.

ShiftedStartMin

Return type: IntegerValue

Arguments: int t

In the presense of tasks with a variable duration, we do not necessarily have start_min + duration_min = end_min, we can instead have a situation like: | |<- duration-min ->| ^ ^ ^ start-min | end-min | We define the "shifted start min" to be the right most time such that we known that we must have min-duration "energy" to the right of it if the task is present. Using it in our scheduling propagators allows to propagate more in the presence of tasks with variable duration (or optional task where we also do not necessarily have start_min + duration_min = end_min. To explain this shifted start min, one must use the AddEnergyAfterReason().

StartIsFixed

Return type: bool

Arguments: int t

StartMax

Return type: IntegerValue

Arguments: int t

StartMin

Return type: IntegerValue

Arguments: int t

StartVars

Return type: const std::vector<IntegerVariable>&

Returns the underlying integer variables.

TaskByDecreasingEndMax

Return type: const std::vector<TaskTime>&

TaskByDecreasingStartMax

Return type: const std::vector<TaskTime>&

TaskByIncreasingEndMin

Return type: const std::vector<TaskTime>&

TaskByIncreasingShiftedStartMin

Return type: const std::vector<TaskTime>&

TaskByIncreasingStartMin

Return type: const std::vector<TaskTime>&

Sorts and returns the tasks in corresponding order at the time of the call. Note that we do not mean strictly-increasing/strictly-decreasing, there will be duplicate time values in these vectors. TODO(user): we could merge the first loop of IncrementalSort() with the loop that fill TaskTime.time at each call.

WatchAllTasks

Return type: void

Arguments: int id, GenericLiteralWatcher* watcher, bool watch_start_max = true, bool watch_end_max = true

Registers the given propagator id to be called if any of the tasks in this class change.