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/util/sort.h"
19 
20 namespace operations_research {
21 namespace sat {
22 
23 IntervalVariable IntervalsRepository::CreateInterval(IntegerVariable start,
24  IntegerVariable end,
25  IntegerVariable size,
26  IntegerValue fixed_size,
27  LiteralIndex is_present) {
28  // Create the interval.
29  const IntervalVariable i(start_vars_.size());
30  start_vars_.push_back(start);
31  end_vars_.push_back(end);
32  size_vars_.push_back(size);
33  fixed_sizes_.push_back(fixed_size);
34  is_present_.push_back(is_present);
35 
36  std::vector<Literal> enforcement_literals;
37  if (is_present != kNoLiteralIndex) {
38  enforcement_literals.push_back(Literal(is_present));
39  }
40 
41  // Link properly all its components.
42  precedences_->AddPrecedenceWithAllOptions(StartVar(i), EndVar(i), fixed_size,
43  SizeVar(i), enforcement_literals);
44  precedences_->AddPrecedenceWithAllOptions(EndVar(i), StartVar(i), -fixed_size,
47  : NegationOf(SizeVar(i)),
48  enforcement_literals);
49  return i;
50 }
51 
53  const std::vector<IntervalVariable>& tasks, Model* model)
54  : trail_(model->GetOrCreate<Trail>()),
55  integer_trail_(model->GetOrCreate<IntegerTrail>()),
56  precedences_(model->GetOrCreate<PrecedencesPropagator>()) {
57  auto* repository = model->GetOrCreate<IntervalsRepository>();
58  start_vars_.clear();
59  end_vars_.clear();
60  minus_end_vars_.clear();
61  minus_start_vars_.clear();
62  duration_vars_.clear();
63  fixed_durations_.clear();
64  reason_for_presence_.clear();
65  for (const IntervalVariable i : tasks) {
66  if (repository->IsOptional(i)) {
67  reason_for_presence_.push_back(repository->IsPresentLiteral(i).Index());
68  } else {
69  reason_for_presence_.push_back(kNoLiteralIndex);
70  }
71  if (repository->SizeVar(i) == kNoIntegerVariable) {
72  duration_vars_.push_back(kNoIntegerVariable);
73  fixed_durations_.push_back(repository->MinSize(i));
74  } else {
75  duration_vars_.push_back(repository->SizeVar(i));
76  fixed_durations_.push_back(IntegerValue(0));
77  }
78  start_vars_.push_back(repository->StartVar(i));
79  end_vars_.push_back(repository->EndVar(i));
80  minus_start_vars_.push_back(NegationOf(repository->StartVar(i)));
81  minus_end_vars_.push_back(NegationOf(repository->EndVar(i)));
82  }
83 
84  InitSortedVectors();
85 }
86 
88  Model* model)
89  : trail_(model->GetOrCreate<Trail>()),
90  integer_trail_(model->GetOrCreate<IntegerTrail>()),
91  precedences_(model->GetOrCreate<PrecedencesPropagator>()) {
92  start_vars_.resize(num_tasks);
93  CHECK_EQ(NumTasks(), num_tasks);
94 }
95 
97  const SchedulingConstraintHelper& other, absl::Span<const int> tasks) {
98  current_time_direction_ = other.current_time_direction_;
99 
100  const int num_tasks = tasks.size();
101  start_vars_.resize(num_tasks);
102  end_vars_.resize(num_tasks);
103  minus_end_vars_.resize(num_tasks);
104  minus_start_vars_.resize(num_tasks);
105  duration_vars_.resize(num_tasks);
106  fixed_durations_.resize(num_tasks);
107  reason_for_presence_.resize(num_tasks);
108  for (int i = 0; i < num_tasks; ++i) {
109  const int t = tasks[i];
110  start_vars_[i] = other.start_vars_[t];
111  end_vars_[i] = other.end_vars_[t];
112  minus_end_vars_[i] = other.minus_end_vars_[t];
113  minus_start_vars_[i] = other.minus_start_vars_[t];
114  duration_vars_[i] = other.duration_vars_[t];
115  fixed_durations_[i] = other.fixed_durations_[t];
116  reason_for_presence_[i] = other.reason_for_presence_[t];
117  }
118 
119  InitSortedVectors();
120 }
121 
122 void SchedulingConstraintHelper::InitSortedVectors() {
123  const int num_tasks = start_vars_.size();
124  task_by_increasing_start_min_.resize(num_tasks);
125  task_by_increasing_end_min_.resize(num_tasks);
126  task_by_decreasing_start_max_.resize(num_tasks);
127  task_by_decreasing_end_max_.resize(num_tasks);
128  task_by_increasing_shifted_start_min_.resize(num_tasks);
129  task_by_negated_shifted_end_max_.resize(num_tasks);
130  for (int t = 0; t < num_tasks; ++t) {
131  task_by_increasing_start_min_[t].task_index = t;
132  task_by_increasing_end_min_[t].task_index = t;
133  task_by_decreasing_start_max_[t].task_index = t;
134  task_by_decreasing_end_max_[t].task_index = t;
135  task_by_increasing_shifted_start_min_[t].task_index = t;
136  task_by_negated_shifted_end_max_[t].task_index = t;
137  }
138  shifted_start_min_timestamp_ = -1;
139  negated_shifted_end_max_timestamp_ = -1;
140 }
141 
143  if (current_time_direction_ == is_forward) return;
144  current_time_direction_ = is_forward;
145 
146  std::swap(start_vars_, minus_end_vars_);
147  std::swap(end_vars_, minus_start_vars_);
148  std::swap(task_by_increasing_start_min_, task_by_decreasing_end_max_);
149  std::swap(task_by_increasing_end_min_, task_by_decreasing_start_max_);
150  std::swap(task_by_increasing_shifted_start_min_,
151  task_by_negated_shifted_end_max_);
152  std::swap(shifted_start_min_timestamp_, negated_shifted_end_max_timestamp_);
153 }
154 
155 const std::vector<TaskTime>&
157  const int num_tasks = NumTasks();
158  for (int i = 0; i < num_tasks; ++i) {
159  TaskTime& ref = task_by_increasing_start_min_[i];
160  ref.time = StartMin(ref.task_index);
161  }
162  IncrementalSort(task_by_increasing_start_min_.begin(),
163  task_by_increasing_start_min_.end());
164  return task_by_increasing_start_min_;
165 }
166 
167 const std::vector<TaskTime>&
169  const int num_tasks = NumTasks();
170  for (int i = 0; i < num_tasks; ++i) {
171  TaskTime& ref = task_by_increasing_end_min_[i];
172  ref.time = EndMin(ref.task_index);
173  }
174  IncrementalSort(task_by_increasing_end_min_.begin(),
175  task_by_increasing_end_min_.end());
176  return task_by_increasing_end_min_;
177 }
178 
179 const std::vector<TaskTime>&
181  const int num_tasks = NumTasks();
182  for (int i = 0; i < num_tasks; ++i) {
183  TaskTime& ref = task_by_decreasing_start_max_[i];
184  ref.time = StartMax(ref.task_index);
185  }
186  IncrementalSort(task_by_decreasing_start_max_.begin(),
187  task_by_decreasing_start_max_.end(),
188  std::greater<TaskTime>());
189  return task_by_decreasing_start_max_;
190 }
191 
192 const std::vector<TaskTime>&
194  const int num_tasks = NumTasks();
195  for (int i = 0; i < num_tasks; ++i) {
196  TaskTime& ref = task_by_decreasing_end_max_[i];
197  ref.time = EndMax(ref.task_index);
198  }
199  IncrementalSort(task_by_decreasing_end_max_.begin(),
200  task_by_decreasing_end_max_.end(), std::greater<TaskTime>());
201  return task_by_decreasing_end_max_;
202 }
203 
204 const std::vector<TaskTime>&
206  const int64 new_timestamp = integer_trail_->timestamp();
207  if (new_timestamp > shifted_start_min_timestamp_) {
208  shifted_start_min_timestamp_ = new_timestamp;
209  const int num_tasks = NumTasks();
210  bool is_sorted = true;
211  IntegerValue previous = kMinIntegerValue;
212  for (int i = 0; i < num_tasks; ++i) {
213  TaskTime& ref = task_by_increasing_shifted_start_min_[i];
214  ref.time = ShiftedStartMin(ref.task_index);
215  is_sorted = is_sorted && ref.time >= previous;
216  previous = ref.time;
217  }
218  if (is_sorted) return task_by_increasing_shifted_start_min_;
219  IncrementalSort(task_by_increasing_shifted_start_min_.begin(),
220  task_by_increasing_shifted_start_min_.end());
221  }
222  return task_by_increasing_shifted_start_min_;
223 }
224 
225 // Produces a relaxed reason for StartMax(before) < EndMin(after).
227  int after) {
228  AddOtherReason(before);
229  AddOtherReason(after);
230 
231  // When this happen it is because we used the "Shifted" end min instead.
232  // TODO(user): This is pretty rare, but we could also relax the reason a bit.
233  if (StartMax(before) >= EndMin(after)) {
234  CHECK_LE(StartMax(before), StartMin(after) + DurationMin(after));
235  integer_reason_.push_back(
236  integer_trail_->UpperBoundAsLiteral(start_vars_[before]));
237  integer_reason_.push_back(
238  integer_trail_->LowerBoundAsLiteral(start_vars_[after]));
239  if (duration_vars_[after] != kNoIntegerVariable) {
240  integer_reason_.push_back(
241  integer_trail_->LowerBoundAsLiteral(duration_vars_[after]));
242  }
243  return;
244  }
245 
246  const IntegerLiteral end_min_lit =
247  integer_trail_->LowerBoundAsLiteral(end_vars_[after]);
248  const IntegerLiteral start_max_lit =
249  integer_trail_->UpperBoundAsLiteral(start_vars_[before]);
250 
251  DCHECK_LT(StartMax(before), EndMin(after));
252  DCHECK_EQ(EndMin(after), end_min_lit.bound);
253  DCHECK_EQ(StartMax(before), -start_max_lit.bound);
254 
255  const IntegerValue slack = end_min_lit.bound + start_max_lit.bound - 1;
256  if (slack == 0) {
257  integer_reason_.push_back(end_min_lit);
258  integer_reason_.push_back(start_max_lit);
259  return;
260  }
261  integer_trail_->AppendRelaxedLinearReason(
262  slack, {IntegerValue(1), IntegerValue(1)},
263  {end_min_lit.var, start_max_lit.var}, &integer_reason_);
264 }
265 
267  CHECK(other_helper_ == nullptr);
268  return integer_trail_->Enqueue(bound, literal_reason_, integer_reason_);
269 }
270 
272  int t, IntegerLiteral lit) {
273  if (IsAbsent(t)) return true;
274  AddOtherReason(t);
275 
276  // TODO(user): we can also push lit.var if its presence implies the interval
277  // presence.
278  if (IsOptional(t) && integer_trail_->OptionalLiteralIndex(lit.var) !=
279  reason_for_presence_[t]) {
280  if (IsPresent(t)) {
281  // We can still push, but we do need the presence reason.
283  } else {
284  // In this case we cannot push lit.var, but we may detect the interval
285  // absence.
286  if (lit.bound > integer_trail_->UpperBound(lit.var)) {
287  integer_reason_.push_back(
288  IntegerLiteral::LowerOrEqual(lit.var, lit.bound - 1));
289  if (!PushTaskAbsence(t)) return false;
290  }
291  return true;
292  }
293  }
294 
296  if (!integer_trail_->Enqueue(lit, literal_reason_, integer_reason_)) {
297  return false;
298  }
299  return true;
300 }
301 
302 // We also run directly the precedence propagator for this variable so that when
303 // we push an interval start for example, we have a chance to push its end.
304 bool SchedulingConstraintHelper::PushIntervalBound(int t, IntegerLiteral lit) {
305  if (!PushIntegerLiteralIfTaskPresent(t, lit)) return false;
306  if (IsAbsent(t)) return true;
307  return precedences_->PropagateOutgoingArcs(lit.var);
308 }
309 
311  IntegerValue new_min_start) {
312  return PushIntervalBound(
313  t, IntegerLiteral::GreaterOrEqual(start_vars_[t], new_min_start));
314 }
315 
317  IntegerValue new_max_end) {
318  return PushIntervalBound(
319  t, IntegerLiteral::LowerOrEqual(end_vars_[t], new_max_end));
320 }
321 
323  DCHECK_NE(reason_for_presence_[t], kNoLiteralIndex);
324  DCHECK(!IsAbsent(t));
325 
326  AddOtherReason(t);
327 
328  if (IsPresent(t)) {
329  literal_reason_.push_back(Literal(reason_for_presence_[t]).Negated());
330  return ReportConflict();
331  }
333  integer_trail_->EnqueueLiteral(Literal(reason_for_presence_[t]).Negated(),
334  literal_reason_, integer_reason_);
335  return true;
336 }
337 
340  return integer_trail_->ReportConflict(literal_reason_, integer_reason_);
341 }
342 
344  GenericLiteralWatcher* watcher,
345  bool watch_start_max,
346  bool watch_end_max) const {
347  const int num_tasks = start_vars_.size();
348  for (int t = 0; t < num_tasks; ++t) {
349  watcher->WatchLowerBound(start_vars_[t], id);
350  watcher->WatchLowerBound(end_vars_[t], id);
351  if (watch_start_max) {
352  watcher->WatchUpperBound(start_vars_[t], id);
353  }
354  if (watch_end_max) {
355  watcher->WatchUpperBound(end_vars_[t], id);
356  }
357  if (duration_vars_[t] != kNoIntegerVariable) {
358  watcher->WatchLowerBound(duration_vars_[t], id);
359  }
360  if (!IsPresent(t) && !IsAbsent(t)) {
361  watcher->WatchLiteral(Literal(reason_for_presence_[t]), id);
362  }
363  }
364 }
365 
366 void SchedulingConstraintHelper::AddOtherReason(int t) {
367  if (other_helper_ == nullptr || already_added_to_other_reasons_[t]) return;
368  already_added_to_other_reasons_[t] = true;
369  other_helper_->AddStartMaxReason(t, event_for_other_helper_);
370  other_helper_->AddEndMinReason(t, event_for_other_helper_ + 1);
371 }
372 
373 void SchedulingConstraintHelper::ImportOtherReasons() {
374  if (other_helper_ != nullptr) ImportOtherReasons(*other_helper_);
375 }
376 
377 void SchedulingConstraintHelper::ImportOtherReasons(
378  const SchedulingConstraintHelper& other_helper) {
379  literal_reason_.insert(literal_reason_.end(),
380  other_helper.literal_reason_.begin(),
381  other_helper.literal_reason_.end());
382  integer_reason_.insert(integer_reason_.end(),
383  other_helper.integer_reason_.begin(),
384  other_helper.integer_reason_.end());
385 }
386 
387 } // namespace sat
388 } // namespace operations_research
operations_research::sat::Trail
Definition: sat_base.h:233
operations_research::sat::IntervalsRepository::EndVar
IntegerVariable EndVar(IntervalVariable i) const
Definition: intervals.h:79
operations_research::sat::IntegerLiteral
Definition: integer.h:164
operations_research::sat::IntegerTrail::OptionalLiteralIndex
LiteralIndex OptionalLiteralIndex(IntegerVariable i) const
Definition: integer.h:621
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:795
operations_research::sat::IntegerLiteral::GreaterOrEqual
static IntegerLiteral GreaterOrEqual(IntegerVariable i, IntegerValue bound)
Definition: integer.h:1197
operations_research::sat::kNoIntegerVariable
const IntegerVariable kNoIntegerVariable(-1)
operations_research::sat::SchedulingConstraintHelper::IsAbsent
bool IsAbsent(int t) const
Definition: intervals.h:397
operations_research::sat::SchedulingConstraintHelper::EndMax
IntegerValue EndMax(int t) const
Definition: intervals.h:371
bound
int64 bound
Definition: routing_search.cc:972
operations_research::sat::IntegerLiteral::var
IntegerVariable var
Definition: integer.h:198
operations_research::sat::kNoLiteralIndex
const LiteralIndex kNoLiteralIndex(-1)
operations_research::sat::GenericLiteralWatcher::WatchUpperBound
void WatchUpperBound(IntegerVariable var, int id, int watch_index=-1)
Definition: integer.h:1294
operations_research::sat::SchedulingConstraintHelper::EndMin
IntegerValue EndMin(int t) const
Definition: intervals.h:367
operations_research::sat::IntegerTrail::UpperBound
IntegerValue UpperBound(IntegerVariable i) const
Definition: integer.h:1221
operations_research::sat::SchedulingConstraintHelper::AddReasonForBeingBefore
void AddReasonForBeingBefore(int before, int after)
Definition: intervals.cc:226
operations_research::sat::SchedulingConstraintHelper::SetTimeDirection
void SetTimeDirection(bool is_forward)
Definition: intervals.cc:142
operations_research::sat::SchedulingConstraintHelper::TaskByIncreasingEndMin
const std::vector< TaskTime > & TaskByIncreasingEndMin()
Definition: intervals.cc:168
operations_research::sat::SchedulingConstraintHelper
Definition: intervals.h:137
operations_research::sat::IntervalsRepository::SizeVar
IntegerVariable SizeVar(IntervalVariable i) const
Definition: intervals.h:77
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::TaskTime::time
IntegerValue time
Definition: intervals.h:127
operations_research::sat::NegationOf
std::vector< IntegerVariable > NegationOf(const std::vector< IntegerVariable > &vars)
Definition: integer.cc:42
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:965
operations_research::sat::PrecedencesPropagator::PropagateOutgoingArcs
bool PropagateOutgoingArcs(IntegerVariable var)
Definition: precedences.cc:90
operations_research::sat::IntegerTrail
Definition: integer.h:534
operations_research::sat::IntervalsRepository::StartVar
IntegerVariable StartVar(IntervalVariable i) const
Definition: intervals.h:78
operations_research::sat::SchedulingConstraintHelper::ImportOtherReasons
void ImportOtherReasons(const SchedulingConstraintHelper &other_helper)
Definition: intervals.cc:377
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
int64
int64_t int64
Definition: integral_types.h:34
gtl::ITIVector::size
size_type size() const
Definition: int_type_indexed_vector.h:146
operations_research::sat::SchedulingConstraintHelper::TaskByIncreasingStartMin
const std::vector< TaskTime > & TaskByIncreasingStartMin()
Definition: intervals.cc:156
operations_research::sat::Model
Class that owns everything related to a particular optimization model.
Definition: sat/model.h:38
operations_research::sat::GenericLiteralWatcher::WatchLiteral
void WatchLiteral(Literal l, int id, int watch_index=-1)
Definition: integer.h:1277
operations_research::sat::SchedulingConstraintHelper::TaskByDecreasingStartMax
const std::vector< TaskTime > & TaskByDecreasingStartMax()
Definition: intervals.cc:180
operations_research::sat::SchedulingConstraintHelper::NumTasks
int NumTasks() const
Definition: intervals.h:157
operations_research::sat::Literal
Definition: sat_base.h:64
operations_research::sat::SchedulingConstraintHelper::PushIntegerLiteralIfTaskPresent
ABSL_MUST_USE_RESULT bool PushIntegerLiteralIfTaskPresent(int t, IntegerLiteral bound)
Definition: intervals.cc:271
operations_research::sat::SchedulingConstraintHelper::TaskByDecreasingEndMax
const std::vector< TaskTime > & TaskByDecreasingEndMax()
Definition: intervals.cc:193
operations_research::sat::SchedulingConstraintHelper::StartMin
IntegerValue StartMin(int t) const
Definition: intervals.h:359
operations_research::sat::GenericLiteralWatcher
Definition: integer.h:1056
operations_research::sat::SchedulingConstraintHelper::AddEndMinReason
void AddEndMinReason(int t, IntegerValue lower_bound)
Definition: intervals.h:453
operations_research::sat::SchedulingConstraintHelper::IsOptional
bool IsOptional(int t) const
Definition: intervals.h:388
operations_research::sat::SchedulingConstraintHelper::StartMax
IntegerValue StartMax(int t) const
Definition: intervals.h:363
intervals.h
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:343
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::IntegerLiteral::bound
IntegerValue bound
Definition: integer.h:199
operations_research::sat::SchedulingConstraintHelper::TaskByIncreasingShiftedStartMin
const std::vector< TaskTime > & TaskByIncreasingShiftedStartMin()
Definition: intervals.cc:205
operations_research::sat::IntegerTrail::UpperBoundAsLiteral
IntegerLiteral UpperBoundAsLiteral(IntegerVariable i) const
Definition: integer.h:1252
operations_research::sat::SchedulingConstraintHelper::IncreaseStartMin
ABSL_MUST_USE_RESULT bool IncreaseStartMin(int t, IntegerValue new_min_start)
Definition: intervals.cc:310
operations_research::sat::SchedulingConstraintHelper::PushTaskAbsence
ABSL_MUST_USE_RESULT bool PushTaskAbsence(int t)
Definition: intervals.cc:322
operations_research::sat::SchedulingConstraintHelper::IsPresent
bool IsPresent(int t) const
Definition: intervals.h:392
operations_research::sat::IntegerTrail::ReportConflict
bool ReportConflict(absl::Span< const Literal > literal_reason, absl::Span< const IntegerLiteral > integer_reason)
Definition: integer.h:784
operations_research::sat::IntegerTrail::LowerBoundAsLiteral
IntegerLiteral LowerBoundAsLiteral(IntegerVariable i) const
Definition: integer.h:1247
operations_research::sat::SchedulingConstraintHelper::ResetFromSubset
void ResetFromSubset(const SchedulingConstraintHelper &other, absl::Span< const int > tasks)
Definition: intervals.cc:96
operations_research::sat::SchedulingConstraintHelper::AddStartMaxReason
void AddStartMaxReason(int t, IntegerValue upper_bound)
Definition: intervals.h:445
operations_research::sat::SchedulingConstraintHelper::PushIntegerLiteral
ABSL_MUST_USE_RESULT bool PushIntegerLiteral(IntegerLiteral bound)
Definition: intervals.cc:266
model
GRBmodel * model
Definition: gurobi_interface.cc:195
operations_research::sat::TaskTime::task_index
int task_index
Definition: intervals.h:126
sort.h
operations_research::sat::kMinIntegerValue
constexpr IntegerValue kMinIntegerValue(-kMaxIntegerValue)
operations_research::sat::SchedulingConstraintHelper::ShiftedStartMin
IntegerValue ShiftedStartMin(int t) const
Definition: intervals.h:376
operations_research::sat::IntervalsRepository::CreateInterval
IntervalVariable CreateInterval(IntegerVariable start, IntegerVariable end, IntegerVariable size, IntegerValue fixed_size, LiteralIndex is_present)
Definition: intervals.cc:23
operations_research::sat::IntegerLiteral::LowerOrEqual
static IntegerLiteral LowerOrEqual(IntegerVariable i, IntegerValue bound)
Definition: integer.h:1203
operations_research::sat::IntegerTrail::EnqueueLiteral
void EnqueueLiteral(Literal literal, absl::Span< const Literal > literal_reason, absl::Span< const IntegerLiteral > integer_reason)
Definition: integer.cc:1034
operations_research::sat::SchedulingConstraintHelper::ReportConflict
ABSL_MUST_USE_RESULT bool ReportConflict()
Definition: intervals.cc:338
operations_research::sat::PrecedencesPropagator
Definition: precedences.h:51
gtl::ITIVector::push_back
void push_back(const value_type &x)
Definition: int_type_indexed_vector.h:157
operations_research::sat::IntervalsRepository
Definition: intervals.h:45
operations_research::sat::SchedulingConstraintHelper::DurationMin
IntegerValue DurationMin(int t) const
Definition: intervals.h:347
operations_research::sat::IntegerTrail::timestamp
int64 timestamp() const
Definition: integer.h:769
operations_research::sat::SchedulingConstraintHelper::SchedulingConstraintHelper
SchedulingConstraintHelper(const std::vector< IntervalVariable > &tasks, Model *model)
Definition: intervals.cc:52
operations_research::sat::GenericLiteralWatcher::WatchLowerBound
void WatchLowerBound(IntegerVariable var, int id, int watch_index=-1)
Definition: integer.h:1285
operations_research::sat::SchedulingConstraintHelper::AddPresenceReason
void AddPresenceReason(int t)
Definition: intervals.h:411
operations_research::sat::TaskTime
Definition: intervals.h:125
operations_research::sat::SchedulingConstraintHelper::DecreaseEndMax
ABSL_MUST_USE_RESULT bool DecreaseEndMax(int t, IntegerValue new_max_end)
Definition: intervals.cc:316