14#ifndef OR_TOOLS_SAT_TIMETABLE_H_
15#define OR_TOOLS_SAT_TIMETABLE_H_
35 std::vector<IntegerValue> deltas,
36 std::vector<Literal> presences, int64_t min_level,
37 int64_t max_level, Model*
model);
49 const std::vector<IntegerValue>& deltas,
50 const std::vector<Literal>& presences,
59 struct ProfileRectangle {
61 ProfileRectangle(IntegerValue start, IntegerValue height)
62 : start(start), height(height) {}
64 bool operator<(
const ProfileRectangle& other)
const {
65 return start < other.start;
68 IntegerValue start = IntegerValue(0);
69 IntegerValue height = IntegerValue(0);
78 void FillReasonForProfileAtGivenTime(IntegerValue t,
79 int event_to_ignore = -1);
83 bool TryToIncreaseMin(
int event);
84 bool TryToDecreaseMax(
int event);
87 std::vector<AffineExpression> times_;
88 std::vector<IntegerValue> deltas_;
89 std::vector<Literal> presences_;
90 IntegerValue capacity_;
97 std::vector<Literal> literal_reason_;
98 std::vector<IntegerLiteral> integer_reason_;
99 std::vector<ProfileRectangle> profile_;
118 struct ProfileRectangle {
122 ProfileRectangle(IntegerValue start, IntegerValue height)
123 : start(start), height(height) {}
125 bool operator<(
const ProfileRectangle& other)
const {
126 return start < other.start;
136 void ReverseProfile();
141 bool SweepAllTasks(
bool is_forward);
144 bool SweepTask(
int task_id);
148 bool UpdateStartingTime(
int task_id, IntegerValue left, IntegerValue right);
152 bool IncreaseCapacity(IntegerValue
time, IntegerValue new_min);
157 void AddProfileReason(IntegerValue left, IntegerValue right);
159 IntegerValue CapacityMin()
const {
163 IntegerValue CapacityMax()
const {
167 IntegerValue DemandMin(
int task_id)
const {
168 return integer_trail_->
LowerBound(demands_[task_id]);
171 IntegerValue DemandMax(
int task_id)
const {
172 return integer_trail_->
UpperBound(demands_[task_id]);
176 bool IsInProfile(
int t)
const {
177 return positions_in_profile_tasks_[t] < num_profile_tasks_;
181 const int num_tasks_;
184 std::vector<AffineExpression> demands_;
193 std::vector<ProfileRectangle> profile_;
194 IntegerValue profile_max_height_;
198 IntegerValue starting_profile_height_;
204 std::vector<int> forward_tasks_to_sweep_;
205 std::vector<int> backward_tasks_to_sweep_;
206 int forward_num_tasks_to_sweep_;
207 int backward_num_tasks_to_sweep_;
213 std::vector<int> profile_tasks_;
214 std::vector<int> positions_in_profile_tasks_;
215 int num_profile_tasks_;
IntegerValue UpperBound(IntegerVariable i) const
IntegerValue LowerBound(IntegerVariable i) const
Class that owns everything related to a particular optimization model.
ReservoirTimeTabling(const std::vector< AffineExpression > ×, const std::vector< IntegerValue > &deltas, const std::vector< Literal > &presences, IntegerValue capacity, Model *model)
void RegisterWith(GenericLiteralWatcher *watcher)
TimeTablingPerTask(const std::vector< AffineExpression > &demands, AffineExpression capacity, IntegerTrail *integer_trail, SchedulingConstraintHelper *helper)
void AddReservoirConstraint(std::vector< AffineExpression > times, std::vector< IntegerValue > deltas, std::vector< Literal > presences, int64_t min_level, int64_t max_level, Model *model)
Collection of objects used to extend the Constraint Solver library.