14#ifndef OR_TOOLS_SAT_DISJUNCTIVE_H_
15#define OR_TOOLS_SAT_DISJUNCTIVE_H_
22#include "absl/types/span.h"
48 const std::vector<IntervalVariable>& intervals, Model*
model);
56 explicit TaskSet(
int num_tasks) { sorted_tasks_.reserve(num_tasks); }
69 sorted_tasks_.clear();
70 optimized_restart_ = 0;
87 void Sort() { std::sort(sorted_tasks_.begin(), sorted_tasks_.end()); }
108 IntegerValue
ComputeEndMin(
int task_to_ignore,
int* critical_index)
const;
116 const std::vector<Entry>&
SortedTasks()
const {
return sorted_tasks_; }
119 std::vector<Entry> sorted_tasks_;
120 mutable int optimized_restart_ = 0;
133class DisjunctiveOverloadChecker :
public PropagatorInterface {
138 task_to_event_(new int[helper->NumTasks()]) {}
144 bool PropagateSubwindow(
int relevat_size, IntegerValue global_window_end);
150 std::unique_ptr<
int[]> task_to_event_;
161 : time_direction_(time_direction),
163 task_set_(helper->NumTasks()) {}
168 bool PropagateSubwindow();
171 std::vector<
TaskTime> task_by_increasing_start_max_;
173 std::vector<
bool> processed_;
174 std::vector<
int> to_propagate_;
176 const
bool time_direction_;
193template <
bool time_direction>
200 void AddNoOverlap(absl::Span<const IntervalVariable>
var);
202 bool Propagate() final;
206 std::vector<
std::vector<
int>> task_to_disjunctives_;
207 std::vector<
bool> task_is_added_;
209 std::vector<IntegerValue> end_mins_;
215 : time_direction_(time_direction),
217 task_set_(helper->NumTasks()) {}
218 bool Propagate() final;
222 bool PropagateSubwindow();
227 const
bool time_direction_;
236 : time_direction_(time_direction), helper_(helper) {}
237 bool Propagate() final;
241 bool PropagateSubwindow(IntegerValue window_end_min);
243 const
bool time_direction_;
252 std::vector<IntegerValue> event_size_;
255 std::vector<
int> non_gray_task_to_event_;
256 std::vector<
bool> is_gray_;
268 : time_direction_(time_direction),
270 integer_trail_(integer_trail),
271 precedences_(precedences),
272 task_set_(helper->NumTasks()),
273 task_to_arc_index_(helper->NumTasks()) {}
274 bool Propagate() final;
278 bool PropagateSubwindow();
280 const
bool time_direction_;
286 std::vector<IntegerVariable> index_to_end_vars_;
289 std::vector<
int> task_to_arc_index_;
301 bool Propagate() final;
DisjunctiveOverloadChecker(SchedulingConstraintHelper *helper)
int RegisterWith(GenericLiteralWatcher *watcher)
Base class for CP like propagators.
PropagatorInterface()=default
void NotifyEntryIsNowLastIfPresent(const Entry &e)
int GetCriticalIndex() const
void AddEntry(const Entry &e)
void AddUnsortedEntry(const Entry &e)
IntegerValue ComputeEndMin() const
const std::vector< Entry > & SortedTasks() const
void AddShiftedStartMinEntry(const SchedulingConstraintHelper &helper, int t)
void Clear()
Insertion and modification. These leave sorted_tasks_ sorted.
void AddDisjunctiveWithBooleanPrecedencesOnly(const std::vector< IntervalVariable > &intervals, Model *model)
void AddDisjunctive(const std::vector< IntervalVariable > &intervals, Model *model)
In SWIG mode, we don't want anything besides these top-level includes.
bool operator<(Entry other) const