OR-Tools  8.0
intervals.cc
Go to the documentation of this file.
1 // Copyright 2010-2018 Google LLC
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 #include "ortools/sat/intervals.h"
15 
16 #include <memory>
17 
18 #include "ortools/sat/integer.h"
19 #include "ortools/util/sort.h"
20 
21 namespace operations_research {
22 namespace sat {
23 
24 IntervalVariable IntervalsRepository::CreateInterval(IntegerVariable start,
25  IntegerVariable end,
26  IntegerVariable size,
27  IntegerValue fixed_size,
28  LiteralIndex is_present) {
29  // Create the interval.
30  const IntervalVariable i(start_vars_.size());
31  start_vars_.push_back(start);
32  end_vars_.push_back(end);
33  size_vars_.push_back(size);
34  fixed_sizes_.push_back(fixed_size);
35  is_present_.push_back(is_present);
36 
37  std::vector<Literal> enforcement_literals;
38  if (is_present != kNoLiteralIndex) {
39  enforcement_literals.push_back(Literal(is_present));
40  }
41 
42  // Link properly all its components.
43  precedences_->AddPrecedenceWithAllOptions(StartVar(i), EndVar(i), fixed_size,
44  SizeVar(i), enforcement_literals);
45  precedences_->AddPrecedenceWithAllOptions(EndVar(i), StartVar(i), -fixed_size,
48  : NegationOf(SizeVar(i)),
49  enforcement_literals);
50  return i;
51 }
52 
54  const std::vector<IntervalVariable>& tasks, Model* model)
55  : trail_(model->GetOrCreate<Trail>()),
56  integer_trail_(model->GetOrCreate<IntegerTrail>()),
57  precedences_(model->GetOrCreate<PrecedencesPropagator>()) {
58  auto* repository = model->GetOrCreate<IntervalsRepository>();
59  start_vars_.clear();
60  end_vars_.clear();
61  minus_end_vars_.clear();
62  minus_start_vars_.clear();
63  size_vars_.clear();
64  fixed_sizes_.clear();
65  reason_for_presence_.clear();
66  for (const IntervalVariable i : tasks) {
67  if (repository->IsOptional(i)) {
68  reason_for_presence_.push_back(repository->IsPresentLiteral(i).Index());
69  } else {
70  reason_for_presence_.push_back(kNoLiteralIndex);
71  }
72  if (repository->SizeVar(i) == kNoIntegerVariable) {
73  size_vars_.push_back(kNoIntegerVariable);
74  fixed_sizes_.push_back(repository->MinSize(i));
75  } else {
76  size_vars_.push_back(repository->SizeVar(i));
77  fixed_sizes_.push_back(IntegerValue(0));
78  }
79  start_vars_.push_back(repository->StartVar(i));
80  end_vars_.push_back(repository->EndVar(i));
81  minus_start_vars_.push_back(NegationOf(repository->StartVar(i)));
82  minus_end_vars_.push_back(NegationOf(repository->EndVar(i)));
83  }
84 
85  InitSortedVectors();
86 }
87 
89  Model* model)
90  : trail_(model->GetOrCreate<Trail>()),
91  integer_trail_(model->GetOrCreate<IntegerTrail>()),
92  precedences_(model->GetOrCreate<PrecedencesPropagator>()) {
93  start_vars_.resize(num_tasks);
94  CHECK_EQ(NumTasks(), num_tasks);
95 }
96 
98  const SchedulingConstraintHelper& other, absl::Span<const int> tasks) {
99  current_time_direction_ = other.current_time_direction_;
100 
101  const int num_tasks = tasks.size();
102  start_vars_.resize(num_tasks);
103  end_vars_.resize(num_tasks);
104  minus_end_vars_.resize(num_tasks);
105  minus_start_vars_.resize(num_tasks);
106  size_vars_.resize(num_tasks);
107  fixed_sizes_.resize(num_tasks);
108  reason_for_presence_.resize(num_tasks);
109  for (int i = 0; i < num_tasks; ++i) {
110  const int t = tasks[i];
111  start_vars_[i] = other.start_vars_[t];
112  end_vars_[i] = other.end_vars_[t];
113  minus_end_vars_[i] = other.minus_end_vars_[t];
114  minus_start_vars_[i] = other.minus_start_vars_[t];
115  size_vars_[i] = other.size_vars_[t];
116  fixed_sizes_[i] = other.fixed_sizes_[t];
117  reason_for_presence_[i] = other.reason_for_presence_[t];
118  }
119 
120  InitSortedVectors();
121 }
122 
123 void SchedulingConstraintHelper::InitSortedVectors() {
124  const int num_tasks = start_vars_.size();
125  task_by_increasing_start_min_.resize(num_tasks);
126  task_by_increasing_end_min_.resize(num_tasks);
127  task_by_decreasing_start_max_.resize(num_tasks);
128  task_by_decreasing_end_max_.resize(num_tasks);
129  task_by_increasing_shifted_start_min_.resize(num_tasks);
130  task_by_negated_shifted_end_max_.resize(num_tasks);
131  for (int t = 0; t < num_tasks; ++t) {
132  task_by_increasing_start_min_[t].task_index = t;
133  task_by_increasing_end_min_[t].task_index = t;
134  task_by_decreasing_start_max_[t].task_index = t;
135  task_by_decreasing_end_max_[t].task_index = t;
136  task_by_increasing_shifted_start_min_[t].task_index = t;
137  task_by_negated_shifted_end_max_[t].task_index = t;
138  }
139  shifted_start_min_timestamp_ = -1;
140  negated_shifted_end_max_timestamp_ = -1;
141 }
142 
144  if (current_time_direction_ == is_forward) return;
145  current_time_direction_ = is_forward;
146 
147  std::swap(start_vars_, minus_end_vars_);
148  std::swap(end_vars_, minus_start_vars_);
149  std::swap(task_by_increasing_start_min_, task_by_decreasing_end_max_);
150  std::swap(task_by_increasing_end_min_, task_by_decreasing_start_max_);
151  std::swap(task_by_increasing_shifted_start_min_,
152  task_by_negated_shifted_end_max_);
153  std::swap(shifted_start_min_timestamp_, negated_shifted_end_max_timestamp_);
154 }
155 
156 const std::vector<TaskTime>&
158  const int num_tasks = NumTasks();
159  for (int i = 0; i < num_tasks; ++i) {
160  TaskTime& ref = task_by_increasing_start_min_[i];
161  ref.time = StartMin(ref.task_index);
162  }
163  IncrementalSort(task_by_increasing_start_min_.begin(),
164  task_by_increasing_start_min_.end());
165  return task_by_increasing_start_min_;
166 }
167 
168 const std::vector<TaskTime>&
170  const int num_tasks = NumTasks();
171  for (int i = 0; i < num_tasks; ++i) {
172  TaskTime& ref = task_by_increasing_end_min_[i];
173  ref.time = EndMin(ref.task_index);
174  }
175  IncrementalSort(task_by_increasing_end_min_.begin(),
176  task_by_increasing_end_min_.end());
177  return task_by_increasing_end_min_;
178 }
179 
180 const std::vector<TaskTime>&
182  const int num_tasks = NumTasks();
183  for (int i = 0; i < num_tasks; ++i) {
184  TaskTime& ref = task_by_decreasing_start_max_[i];
185  ref.time = StartMax(ref.task_index);
186  }
187  IncrementalSort(task_by_decreasing_start_max_.begin(),
188  task_by_decreasing_start_max_.end(),
189  std::greater<TaskTime>());
190  return task_by_decreasing_start_max_;
191 }
192 
193 const std::vector<TaskTime>&
195  const int num_tasks = NumTasks();
196  for (int i = 0; i < num_tasks; ++i) {
197  TaskTime& ref = task_by_decreasing_end_max_[i];
198  ref.time = EndMax(ref.task_index);
199  }
200  IncrementalSort(task_by_decreasing_end_max_.begin(),
201  task_by_decreasing_end_max_.end(), std::greater<TaskTime>());
202  return task_by_decreasing_end_max_;
203 }
204 
205 const std::vector<TaskTime>&
207  const int64 new_timestamp = integer_trail_->timestamp();
208  if (new_timestamp > shifted_start_min_timestamp_) {
209  shifted_start_min_timestamp_ = new_timestamp;
210  const int num_tasks = NumTasks();
211  bool is_sorted = true;
212  IntegerValue previous = kMinIntegerValue;
213  for (int i = 0; i < num_tasks; ++i) {
214  TaskTime& ref = task_by_increasing_shifted_start_min_[i];
215  ref.time = ShiftedStartMin(ref.task_index);
216  is_sorted = is_sorted && ref.time >= previous;
217  previous = ref.time;
218  }
219  if (is_sorted) return task_by_increasing_shifted_start_min_;
220  IncrementalSort(task_by_increasing_shifted_start_min_.begin(),
221  task_by_increasing_shifted_start_min_.end());
222  }
223  return task_by_increasing_shifted_start_min_;
224 }
225 
226 // Produces a relaxed reason for StartMax(before) < EndMin(after).
228  int after) {
229  AddOtherReason(before);
230  AddOtherReason(after);
231 
232  // When this happen it is because we used the "Shifted" end min instead.
233  // TODO(user): This is pretty rare, but we could also relax the reason a bit.
234  if (StartMax(before) >= EndMin(after)) {
235  CHECK_LT(StartMax(before), StartMin(after) + SizeMin(after));
236  integer_reason_.push_back(
237  integer_trail_->UpperBoundAsLiteral(start_vars_[before]));
238  integer_reason_.push_back(
239  integer_trail_->LowerBoundAsLiteral(start_vars_[after]));
240  if (size_vars_[after] != kNoIntegerVariable) {
241  integer_reason_.push_back(
242  integer_trail_->LowerBoundAsLiteral(size_vars_[after]));
243  }
244  return;
245  }
246 
247  const IntegerLiteral end_min_lit =
248  integer_trail_->LowerBoundAsLiteral(end_vars_[after]);
249  const IntegerLiteral start_max_lit =
250  integer_trail_->UpperBoundAsLiteral(start_vars_[before]);
251 
252  DCHECK_LT(StartMax(before), EndMin(after));
253  DCHECK_EQ(EndMin(after), end_min_lit.bound);
254  DCHECK_EQ(StartMax(before), -start_max_lit.bound);
255 
256  const IntegerValue slack = end_min_lit.bound + start_max_lit.bound - 1;
257  if (slack == 0) {
258  integer_reason_.push_back(end_min_lit);
259  integer_reason_.push_back(start_max_lit);
260  return;
261  }
262  integer_trail_->AppendRelaxedLinearReason(
263  slack, {IntegerValue(1), IntegerValue(1)},
264  {end_min_lit.var, start_max_lit.var}, &integer_reason_);
265 }
266 
268  CHECK(other_helper_ == nullptr);
269  return integer_trail_->Enqueue(lit, literal_reason_, integer_reason_);
270 }
271 
273  int t, IntegerLiteral lit) {
274  if (IsAbsent(t)) return true;
275  AddOtherReason(t);
276 
277  // TODO(user): we can also push lit.var if its presence implies the interval
278  // presence.
279  if (IsOptional(t) && integer_trail_->OptionalLiteralIndex(lit.var) !=
280  reason_for_presence_[t]) {
281  if (IsPresent(t)) {
282  // We can still push, but we do need the presence reason.
284  } else {
285  // In this case we cannot push lit.var, but we may detect the interval
286  // absence.
287  if (lit.bound > integer_trail_->UpperBound(lit.var)) {
288  integer_reason_.push_back(
289  IntegerLiteral::LowerOrEqual(lit.var, lit.bound - 1));
290  if (!PushTaskAbsence(t)) return false;
291  }
292  return true;
293  }
294  }
295 
297  if (!integer_trail_->Enqueue(lit, literal_reason_, integer_reason_)) {
298  return false;
299  }
300  return true;
301 }
302 
303 // We also run directly the precedence propagator for this variable so that when
304 // we push an interval start for example, we have a chance to push its end.
305 bool SchedulingConstraintHelper::PushIntervalBound(int t, IntegerLiteral lit) {
306  if (!PushIntegerLiteralIfTaskPresent(t, lit)) return false;
307  if (IsAbsent(t)) return true;
308  return precedences_->PropagateOutgoingArcs(lit.var);
309 }
310 
312  IntegerValue new_min_start) {
313  return PushIntervalBound(
314  t, IntegerLiteral::GreaterOrEqual(start_vars_[t], new_min_start));
315 }
316 
318  IntegerValue new_max_end) {
319  return PushIntervalBound(
320  t, IntegerLiteral::LowerOrEqual(end_vars_[t], new_max_end));
321 }
322 
324  DCHECK_NE(reason_for_presence_[t], kNoLiteralIndex);
325  DCHECK(!IsAbsent(t));
326 
327  AddOtherReason(t);
328 
329  if (IsPresent(t)) {
330  literal_reason_.push_back(Literal(reason_for_presence_[t]).Negated());
331  return ReportConflict();
332  }
334  integer_trail_->EnqueueLiteral(Literal(reason_for_presence_[t]).Negated(),
335  literal_reason_, integer_reason_);
336  return true;
337 }
338 
340  DCHECK_NE(reason_for_presence_[t], kNoLiteralIndex);
341  DCHECK(!IsPresent(t));
342 
343  AddOtherReason(t);
344 
345  if (IsAbsent(t)) {
346  literal_reason_.push_back(Literal(reason_for_presence_[t]));
347  return ReportConflict();
348  }
350  integer_trail_->EnqueueLiteral(Literal(reason_for_presence_[t]),
351  literal_reason_, integer_reason_);
352  return true;
353 }
354 
357  return integer_trail_->ReportConflict(literal_reason_, integer_reason_);
358 }
359 
361  GenericLiteralWatcher* watcher,
362  bool watch_start_max,
363  bool watch_end_max) const {
364  const int num_tasks = start_vars_.size();
365  for (int t = 0; t < num_tasks; ++t) {
366  watcher->WatchLowerBound(start_vars_[t], id);
367  watcher->WatchLowerBound(end_vars_[t], id);
368  if (watch_start_max) {
369  watcher->WatchUpperBound(start_vars_[t], id);
370  }
371  if (watch_end_max) {
372  watcher->WatchUpperBound(end_vars_[t], id);
373  }
374  if (size_vars_[t] != kNoIntegerVariable) {
375  watcher->WatchLowerBound(size_vars_[t], id);
376  }
377  if (!IsPresent(t) && !IsAbsent(t)) {
378  watcher->WatchLiteral(Literal(reason_for_presence_[t]), id);
379  }
380  }
381 }
382 
383 void SchedulingConstraintHelper::AddOtherReason(int t) {
384  if (other_helper_ == nullptr || already_added_to_other_reasons_[t]) return;
385  already_added_to_other_reasons_[t] = true;
386  other_helper_->AddStartMaxReason(t, event_for_other_helper_);
387  other_helper_->AddEndMinReason(t, event_for_other_helper_ + 1);
388 }
389 
390 void SchedulingConstraintHelper::ImportOtherReasons() {
391  if (other_helper_ != nullptr) ImportOtherReasons(*other_helper_);
392 }
393 
394 void SchedulingConstraintHelper::ImportOtherReasons(
395  const SchedulingConstraintHelper& other_helper) {
396  literal_reason_.insert(literal_reason_.end(),
397  other_helper.literal_reason_.begin(),
398  other_helper.literal_reason_.end());
399  integer_reason_.insert(integer_reason_.end(),
400  other_helper.integer_reason_.begin(),
401  other_helper.integer_reason_.end());
402 }
403 
405  return absl::StrCat("t=", t, " is_present=", IsPresent(t),
406  " min_size=", SizeMin(t).value(), " start=[",
407  StartMin(t).value(), ",", StartMax(t).value(), "]",
408  " end=[", EndMin(t).value(), ",", EndMax(t).value(), "]");
409 }
410 
411 } // namespace sat
412 } // namespace operations_research
operations_research::sat::IntegerTrail::timestamp
int64 timestamp() const
Definition: integer.h:768
operations_research::sat::IntervalsRepository::CreateInterval
IntervalVariable CreateInterval(IntegerVariable start, IntegerVariable end, IntegerVariable size, IntegerValue fixed_size, LiteralIndex is_present)
Definition: intervals.cc:24
operations_research::sat::SchedulingConstraintHelper::StartMin
IntegerValue StartMin(int t) const
Definition: intervals.h:374
operations_research::sat::IntegerTrail
Definition: integer.h:523
operations_research::sat::kNoIntegerVariable
const IntegerVariable kNoIntegerVariable(-1)
operations_research::sat::GenericLiteralWatcher::WatchLowerBound
void WatchLowerBound(IntegerVariable var, int id, int watch_index=-1)
Definition: integer.h:1301
operations_research::sat::SchedulingConstraintHelper::TaskByIncreasingShiftedStartMin
const std::vector< TaskTime > & TaskByIncreasingShiftedStartMin()
Definition: intervals.cc:206
operations_research::sat::SchedulingConstraintHelper::ImportOtherReasons
void ImportOtherReasons(const SchedulingConstraintHelper &other_helper)
Definition: intervals.cc:394
operations_research::sat::SchedulingConstraintHelper::IncreaseStartMin
ABSL_MUST_USE_RESULT bool IncreaseStartMin(int t, IntegerValue new_min_start)
Definition: intervals.cc:311
operations_research::sat::kNoLiteralIndex
const LiteralIndex kNoLiteralIndex(-1)
operations_research::sat::SchedulingConstraintHelper::WatchAllTasks
void WatchAllTasks(int id, GenericLiteralWatcher *watcher, bool watch_start_max=true, bool watch_end_max=true) const
Definition: intervals.cc:360
operations_research::sat::SchedulingConstraintHelper::EndMin
IntegerValue EndMin(int t) const
Definition: intervals.h:382
gtl::ITIVector::push_back
void push_back(const value_type &x)
Definition: int_type_indexed_vector.h:157
operations_research::sat::IntervalsRepository::EndVar
IntegerVariable EndVar(IntervalVariable i) const
Definition: intervals.h:79
value
int64 value
Definition: demon_profiler.cc:43
operations_research::sat::SchedulingConstraintHelper::IsOptional
bool IsOptional(int t) const
Definition: intervals.h:403
operations_research::sat::SchedulingConstraintHelper::SetTimeDirection
void SetTimeDirection(bool is_forward)
Definition: intervals.cc:143
operations_research::sat::SchedulingConstraintHelper::TaskByDecreasingEndMax
const std::vector< TaskTime > & TaskByDecreasingEndMax()
Definition: intervals.cc:194
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition: dense_doubly_linked_list.h:21
operations_research::sat::IntegerTrail::EnqueueLiteral
void EnqueueLiteral(Literal literal, absl::Span< const Literal > literal_reason, absl::Span< const IntegerLiteral > integer_reason)
Definition: integer.cc:1057
operations_research::sat::NegationOf
std::vector< IntegerVariable > NegationOf(const std::vector< IntegerVariable > &vars)
Definition: integer.cc:42
operations_research::sat::IntegerTrail::OptionalLiteralIndex
LiteralIndex OptionalLiteralIndex(IntegerVariable i) const
Definition: integer.h:617
operations_research::sat::SchedulingConstraintHelper::EndMax
IntegerValue EndMax(int t) const
Definition: intervals.h:386
operations_research::sat::IntegerLiteral::GreaterOrEqual
static IntegerLiteral GreaterOrEqual(IntegerVariable i, IntegerValue bound)
Definition: integer.h:1208
operations_research::sat::SchedulingConstraintHelper::TaskByDecreasingStartMax
const std::vector< TaskTime > & TaskByDecreasingStartMax()
Definition: intervals.cc:181
int64
int64_t int64
Definition: integral_types.h:34
operations_research::sat::SchedulingConstraintHelper::TaskByIncreasingStartMin
const std::vector< TaskTime > & TaskByIncreasingStartMin()
Definition: intervals.cc:157
operations_research::sat::SchedulingConstraintHelper::ShiftedStartMin
IntegerValue ShiftedStartMin(int t) const
Definition: intervals.h:391
operations_research::sat::PrecedencesPropagator::AddPrecedenceWithAllOptions
void AddPrecedenceWithAllOptions(IntegerVariable i1, IntegerVariable i2, IntegerValue offset, IntegerVariable offset_var, absl::Span< const Literal > presence_literals)
Definition: precedences.h:323
operations_research::sat::GenericLiteralWatcher
Definition: integer.h:1067
operations_research::sat::IntegerLiteral::var
IntegerVariable var
Definition: integer.h:187
operations_research::sat::IntegerTrail::UpperBoundAsLiteral
IntegerLiteral UpperBoundAsLiteral(IntegerVariable i) const
Definition: integer.h:1263
operations_research::sat::IntegerTrail::AppendRelaxedLinearReason
void AppendRelaxedLinearReason(IntegerValue slack, absl::Span< const IntegerValue > coeffs, absl::Span< const IntegerVariable > vars, std::vector< IntegerLiteral > *reason) const
Definition: integer.cc:806
operations_research::sat::TaskTime
Definition: intervals.h:125
operations_research::sat::SchedulingConstraintHelper::ReportConflict
ABSL_MUST_USE_RESULT bool ReportConflict()
Definition: intervals.cc:355
operations_research::sat::SchedulingConstraintHelper
Definition: intervals.h:137
operations_research::sat::TaskTime::time
IntegerValue time
Definition: intervals.h:127
operations_research::sat::IntegerTrail::UpperBound
IntegerValue UpperBound(IntegerVariable i) const
Definition: integer.h:1232
operations_research::sat::SchedulingConstraintHelper::StartMax
IntegerValue StartMax(int t) const
Definition: intervals.h:378
operations_research::sat::IntegerTrail::Enqueue
ABSL_MUST_USE_RESULT bool Enqueue(IntegerLiteral i_lit, absl::Span< const Literal > literal_reason, absl::Span< const IntegerLiteral > integer_reason)
Definition: integer.cc:988
operations_research::sat::PrecedencesPropagator
Definition: precedences.h:51
intervals.h
operations_research::IncrementalSort
void IncrementalSort(int max_comparisons, Iterator begin, Iterator end, Compare comp=Compare{}, bool is_stable=false)
Definition: sort.h:46
operations_research::sat::SchedulingConstraintHelper::DecreaseEndMax
ABSL_MUST_USE_RESULT bool DecreaseEndMax(int t, IntegerValue new_max_end)
Definition: intervals.cc:317
operations_research::sat::SchedulingConstraintHelper::IsAbsent
bool IsAbsent(int t) const
Definition: intervals.h:412
operations_research::sat::Model
Class that owns everything related to a particular optimization model.
Definition: sat/model.h:38
operations_research::sat::SchedulingConstraintHelper::PushTaskPresence
ABSL_MUST_USE_RESULT bool PushTaskPresence(int t)
Definition: intervals.cc:339
operations_research::sat::IntegerLiteral::bound
IntegerValue bound
Definition: integer.h:188
operations_research::sat::SchedulingConstraintHelper::NumTasks
int NumTasks() const
Definition: intervals.h:157
operations_research::sat::IntegerTrail::LowerBoundAsLiteral
IntegerLiteral LowerBoundAsLiteral(IntegerVariable i) const
Definition: integer.h:1258
operations_research::sat::SchedulingConstraintHelper::AddReasonForBeingBefore
void AddReasonForBeingBefore(int before, int after)
Definition: intervals.cc:227
operations_research::sat::IntegerLiteral
Definition: integer.h:153
operations_research::sat::SchedulingConstraintHelper::AddStartMaxReason
void AddStartMaxReason(int t, IntegerValue upper_bound)
Definition: intervals.h:468
operations_research::sat::IntegerLiteral::LowerOrEqual
static IntegerLiteral LowerOrEqual(IntegerVariable i, IntegerValue bound)
Definition: integer.h:1214
operations_research::sat::SchedulingConstraintHelper::SchedulingConstraintHelper
SchedulingConstraintHelper(const std::vector< IntervalVariable > &tasks, Model *model)
Definition: intervals.cc:53
gtl::ITIVector::size
size_type size() const
Definition: int_type_indexed_vector.h:146
model
GRBmodel * model
Definition: gurobi_interface.cc:195
operations_research::sat::Literal
Definition: sat_base.h:64
operations_research::sat::SchedulingConstraintHelper::ResetFromSubset
void ResetFromSubset(const SchedulingConstraintHelper &other, absl::Span< const int > tasks)
Definition: intervals.cc:97
sort.h
operations_research::sat::SchedulingConstraintHelper::SizeMin
IntegerValue SizeMin(int t) const
Definition: intervals.h:356
operations_research::sat::IntervalsRepository::SizeVar
IntegerVariable SizeVar(IntervalVariable i) const
Definition: intervals.h:77
operations_research::sat::GenericLiteralWatcher::WatchLiteral
void WatchLiteral(Literal l, int id, int watch_index=-1)
Definition: integer.h:1293
operations_research::sat::IntegerTrail::ReportConflict
bool ReportConflict(absl::Span< const Literal > literal_reason, absl::Span< const IntegerLiteral > integer_reason)
Definition: integer.h:783
operations_research::sat::kMinIntegerValue
constexpr IntegerValue kMinIntegerValue(-kMaxIntegerValue)
operations_research::sat::SchedulingConstraintHelper::IsPresent
bool IsPresent(int t) const
Definition: intervals.h:407
operations_research::sat::IntervalsRepository
Definition: intervals.h:45
operations_research::sat::TaskTime::task_index
int task_index
Definition: intervals.h:126
operations_research::sat::IntervalsRepository::StartVar
IntegerVariable StartVar(IntervalVariable i) const
Definition: intervals.h:78
operations_research::sat::SchedulingConstraintHelper::TaskDebugString
std::string TaskDebugString(int t) const
Definition: intervals.cc:404
operations_research::sat::SchedulingConstraintHelper::AddEndMinReason
void AddEndMinReason(int t, IntegerValue lower_bound)
Definition: intervals.h:476
operations_research::sat::SchedulingConstraintHelper::PushTaskAbsence
ABSL_MUST_USE_RESULT bool PushTaskAbsence(int t)
Definition: intervals.cc:323
operations_research::sat::PrecedencesPropagator::PropagateOutgoingArcs
bool PropagateOutgoingArcs(IntegerVariable var)
Definition: precedences.cc:95
operations_research::sat::SchedulingConstraintHelper::TaskByIncreasingEndMin
const std::vector< TaskTime > & TaskByIncreasingEndMin()
Definition: intervals.cc:169
integer.h
operations_research::sat::GenericLiteralWatcher::WatchUpperBound
void WatchUpperBound(IntegerVariable var, int id, int watch_index=-1)
Definition: integer.h:1310
operations_research::sat::Trail
Definition: sat_base.h:233
operations_research::sat::SchedulingConstraintHelper::AddPresenceReason
void AddPresenceReason(int t)
Definition: intervals.h:426
operations_research::sat::SchedulingConstraintHelper::PushIntegerLiteral
ABSL_MUST_USE_RESULT bool PushIntegerLiteral(IntegerLiteral lit)
Definition: intervals.cc:267
operations_research::sat::SchedulingConstraintHelper::PushIntegerLiteralIfTaskPresent
ABSL_MUST_USE_RESULT bool PushIntegerLiteralIfTaskPresent(int t, IntegerLiteral lit)
Definition: intervals.cc:272