14 #ifndef OR_TOOLS_SAT_TIMETABLE_H_
15 #define OR_TOOLS_SAT_TIMETABLE_H_
34 std::vector<IntegerValue> deltas,
35 std::vector<Literal> presences,
int64 min_level,
48 const std::vector<IntegerValue>& deltas,
49 const std::vector<Literal>& presences,
58 struct ProfileRectangle {
60 ProfileRectangle(IntegerValue start, IntegerValue height)
61 : start(start), height(height) {}
63 bool operator<(
const ProfileRectangle& other)
const {
64 return start < other.start;
67 IntegerValue start = IntegerValue(0);
68 IntegerValue height = IntegerValue(0);
77 void FillReasonForProfileAtGivenTime(IntegerValue t,
78 int event_to_ignore = -1);
82 bool TryToIncreaseMin(
int event);
83 bool TryToDecreaseMax(
int event);
86 std::vector<AffineExpression> times_;
87 std::vector<IntegerValue> deltas_;
88 std::vector<Literal> presences_;
89 IntegerValue capacity_;
96 std::vector<Literal> literal_reason_;
97 std::vector<IntegerLiteral> integer_reason_;
98 std::vector<ProfileRectangle> profile_;
117 struct ProfileRectangle {
121 ProfileRectangle(IntegerValue start, IntegerValue height)
122 : start(start), height(height) {}
124 bool operator<(
const ProfileRectangle& other)
const {
125 return start < other.start;
135 void ReverseProfile();
140 bool SweepAllTasks(
bool is_forward);
143 bool SweepTask(
int task_id);
147 bool UpdateStartingTime(
int task_id, IntegerValue left, IntegerValue right);
151 bool IncreaseCapacity(IntegerValue
time, IntegerValue new_min);
156 void AddProfileReason(IntegerValue left, IntegerValue right);
158 IntegerValue CapacityMin()
const {
162 IntegerValue CapacityMax()
const {
166 IntegerValue DemandMin(
int task_id)
const {
167 return integer_trail_->
LowerBound(demands_[task_id]);
170 IntegerValue DemandMax(
int task_id)
const {
171 return integer_trail_->
UpperBound(demands_[task_id]);
175 bool IsInProfile(
int t)
const {
176 return positions_in_profile_tasks_[t] < num_profile_tasks_;
180 const int num_tasks_;
183 std::vector<AffineExpression> demands_;
192 std::vector<ProfileRectangle> profile_;
193 IntegerValue profile_max_height_;
197 IntegerValue starting_profile_height_;
203 std::vector<int> forward_tasks_to_sweep_;
204 std::vector<int> backward_tasks_to_sweep_;
205 int forward_num_tasks_to_sweep_;
206 int backward_num_tasks_to_sweep_;
212 std::vector<int> profile_tasks_;
213 std::vector<int> positions_in_profile_tasks_;
214 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 min_level, int64 max_level, Model *model)
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...