55 absl::Span<const AffineExpression> times,
56 absl::Span<const AffineExpression> deltas,
57 absl::Span<const Literal> presences,
58 IntegerValue capacity,
Model* model);
66 struct ProfileRectangle {
67 ProfileRectangle() =
default;
68 ProfileRectangle(IntegerValue start, IntegerValue height)
69 : start(start), height(height) {}
71 bool operator<(
const ProfileRectangle& other)
const {
72 return start < other.start;
75 IntegerValue start = IntegerValue(0);
76 IntegerValue height = IntegerValue(0);
85 void FillReasonForProfileAtGivenTime(IntegerValue t,
86 int event_to_ignore = -1);
90 bool TryToIncreaseMin(
int event);
91 bool TryToDecreaseMax(
int event);
94 std::vector<Literal> enforcement_literals_;
95 std::vector<AffineExpression> times_;
96 std::vector<AffineExpression> deltas_;
97 std::vector<Literal> presences_;
98 IntegerValue capacity_;
104 EnforcementId enforcement_id_;
107 std::vector<Literal> literal_reason_;
108 std::vector<IntegerLiteral> integer_reason_;
109 std::vector<ProfileRectangle> profile_;
135 struct ProfileRectangle {
139 ProfileRectangle(IntegerValue start, IntegerValue height)
140 : start(start), height(height) {}
142 bool operator<(
const ProfileRectangle& other)
const {
143 return start < other.start;
153 void ReverseProfile();
158 bool SweepAllTasks();
163 bool SweepTask(
int task_id, IntegerValue initial_start_min,
164 IntegerValue conflict_height,
int* profile_index);
168 bool UpdateStartingTime(
int task_id, IntegerValue left, IntegerValue right);
172 bool IncreaseCapacity(IntegerValue time, IntegerValue new_min);
177 void AddProfileReason(
int task_id, IntegerValue left, IntegerValue right,
178 IntegerValue capacity_threshold);
180 IntegerValue CapacityMin()
const {
184 IntegerValue CapacityMax()
const {
190 bool IsInProfile(
int t)
const {
return cached_demands_min_[t] > 0; }
193 const int num_tasks_;
196 const AffineExpression capacity_;
198 SchedulingConstraintHelper* helper_;
199 SchedulingDemandHelper* demands_;
200 IntegerTrail* integer_trail_;
203 std::vector<ProfileRectangle> profile_;
204 IntegerValue profile_max_height_;
209 std::vector<int> profile_tasks_;
210 int num_profile_tasks_;
214 std::vector<IntegerValue> cached_demands_min_;
218 bool has_demand_equal_to_capacity_ =
false;
219 IntegerValue initial_max_demand_;
void AddReservoirConstraint(absl::Span< const Literal > enforcement_literals, absl::Span< const AffineExpression > times, absl::Span< const AffineExpression > deltas, absl::Span< const Literal > presences, int64_t min_level, int64_t max_level, Model *model)