Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <disjunctive.h>
Classes | |
struct | Entry |
Public Member Functions | |
TaskSet (int num_tasks) | |
void | Clear () |
Insertion and modification. These leave sorted_tasks_ sorted. | |
void | AddEntry (const Entry &e) |
void | AddShiftedStartMinEntry (const SchedulingConstraintHelper &helper, int t) |
void | NotifyEntryIsNowLastIfPresent (const Entry &e) |
void | AddUnsortedEntry (const Entry &e) |
void | Sort () |
IntegerValue | ComputeEndMin (int task_to_ignore, int *critical_index) const |
IntegerValue | ComputeEndMin () const |
int | GetCriticalIndex () const |
absl::Span< const Entry > | SortedTasks () const |
Helper class to compute the end-min of a set of tasks given their start-min and size-min. In Petr Vilim's PhD "Global Constraints in Scheduling", this corresponds to his Theta-tree except that we use a O(n) implementation for most of the function here, not a O(log(n)) one.
Definition at line 54 of file disjunctive.h.
|
inlineexplicit |
Definition at line 56 of file disjunctive.h.
void operations_research::sat::TaskSet::AddEntry | ( | const Entry & | e | ) |
If the task is added after optimized_restart_, we know that we don't need to scan the task before optimized_restart_ in the next ComputeEndMin().
Definition at line 165 of file disjunctive.cc.
void operations_research::sat::TaskSet::AddShiftedStartMinEntry | ( | const SchedulingConstraintHelper & | helper, |
int | t ) |
Same as AddEntry({t, helper->ShiftedStartMin(t), helper->SizeMin(t)}). This is a minor optimization to not call SizeMin(t) twice.
Definition at line 180 of file disjunctive.cc.
|
inline |
Advanced usage. Instead of calling many AddEntry(), it is more efficient to call AddUnsortedEntry() instead, but then Sort() MUST be called just after the insertions. Nothing is checked here, so it is up to the client to do that properly.
Definition at line 86 of file disjunctive.h.
|
inline |
Insertion and modification. These leave sorted_tasks_ sorted.
Definition at line 68 of file disjunctive.h.
IntegerValue operations_research::sat::TaskSet::ComputeEndMin | ( | ) | const |
Definition at line 204 of file disjunctive.cc.
IntegerValue operations_research::sat::TaskSet::ComputeEndMin | ( | int | task_to_ignore, |
int * | critical_index ) const |
Returns the end-min for the task in the set. The time profile of the tasks packed to the left will always be a set of contiguous tasks separated by empty space:
[Bunch of tasks] ... [Bunch of tasks] ... [critical tasks].
We call "critical tasks" the last group. These tasks will be solely responsible for the end-min of the whole set. The returned critical_index will be the index of the first critical task in SortedTasks().
A reason for the min end is:
It is possible to behave like if one task was not in the set by setting task_to_ignore to the id of this task. This returns 0 if the set is empty in which case critical_index will be left unchanged.
The order in which we process tasks with the same start-min doesn't matter.
If the ignored task is last and was the start of the critical block, then we need to reset optimized_restart_.
Definition at line 220 of file disjunctive.cc.
|
inline |
Warning, this is only valid if ComputeEndMin() was just called. It is the same index as if one called ComputeEndMin(-1, &critical_index), but saves another unneeded loop.
Definition at line 114 of file disjunctive.h.
void operations_research::sat::TaskSet::NotifyEntryIsNowLastIfPresent | ( | const Entry & | e | ) |
Advanced usage, if the entry is present, this assumes that its start_min is >= the end min without it, and update the datastructure accordingly.
Definition at line 186 of file disjunctive.cc.
|
inline |
Definition at line 87 of file disjunctive.h.
|
inline |
Definition at line 116 of file disjunctive.h.