51 const std::vector<AffineExpression>& deltas,
52 const std::vector<Literal>& presences,
61 struct ProfileRectangle {
62 ProfileRectangle() =
default;
63 ProfileRectangle(IntegerValue start, IntegerValue height)
66 bool operator<(
const ProfileRectangle& other)
const {
67 return start < other.start;
70 IntegerValue
start = IntegerValue(0);
71 IntegerValue
height = IntegerValue(0);
80 void FillReasonForProfileAtGivenTime(IntegerValue t,
81 int event_to_ignore = -1);
85 bool TryToIncreaseMin(
int event);
86 bool TryToDecreaseMax(
int event);
89 std::vector<AffineExpression> times_;
90 std::vector<AffineExpression> deltas_;
91 std::vector<Literal> presences_;
92 IntegerValue capacity_;
99 std::vector<Literal> literal_reason_;
100 std::vector<IntegerLiteral> integer_reason_;
101 std::vector<ProfileRectangle> profile_;
127 struct ProfileRectangle {
131 ProfileRectangle(IntegerValue
start, IntegerValue
height)
134 bool operator<(
const ProfileRectangle& other)
const {
135 return start < other.start;
145 void ReverseProfile();
150 bool SweepAllTasks();
155 bool SweepTask(
int task_id, IntegerValue initial_start_min,
156 IntegerValue conflict_height,
int* profile_index);
160 bool UpdateStartingTime(
int task_id, IntegerValue left, IntegerValue right);
164 bool IncreaseCapacity(IntegerValue
time, IntegerValue new_min);
169 void AddProfileReason(
int task_id, IntegerValue left, IntegerValue right,
170 IntegerValue capacity_threshold);
172 IntegerValue CapacityMin()
const {
176 IntegerValue CapacityMax()
const {
182 bool IsInProfile(
int t)
const {
return cached_demands_min_[t] > 0; }
185 const int num_tasks_;
188 const AffineExpression capacity_;
190 SchedulingConstraintHelper* helper_;
191 SchedulingDemandHelper* demands_;
192 IntegerTrail* integer_trail_;
195 std::vector<ProfileRectangle> profile_;
196 IntegerValue profile_max_height_;
201 std::vector<int> profile_tasks_;
202 int num_profile_tasks_;
206 std::vector<IntegerValue> cached_demands_min_;
210 bool has_demand_equal_to_capacity_ =
false;
211 IntegerValue initial_max_demand_;
void AddReservoirConstraint(std::vector< AffineExpression > times, std::vector< AffineExpression > deltas, std::vector< Literal > presences, int64_t min_level, int64_t max_level, Model *model)