14#ifndef OR_TOOLS_SAT_TIMETABLE_H_
15#define OR_TOOLS_SAT_TIMETABLE_H_
38 std::vector<IntegerValue> deltas,
39 std::vector<Literal> presences, int64_t min_level,
40 int64_t max_level, Model*
model);
52 const std::vector<IntegerValue>& deltas,
53 const std::vector<Literal>& presences,
62 struct ProfileRectangle {
64 ProfileRectangle(IntegerValue
start, IntegerValue height)
67 bool operator<(
const ProfileRectangle& other)
const {
68 return start < other.start;
71 IntegerValue
start = IntegerValue(0);
72 IntegerValue height = IntegerValue(0);
81 void FillReasonForProfileAtGivenTime(IntegerValue t,
82 int event_to_ignore = -1);
86 bool TryToIncreaseMin(
int event);
87 bool TryToDecreaseMax(
int event);
90 std::vector<AffineExpression> times_;
91 std::vector<IntegerValue> deltas_;
92 std::vector<Literal> presences_;
93 IntegerValue capacity_;
100 std::vector<Literal> literal_reason_;
101 std::vector<IntegerLiteral> integer_reason_;
102 std::vector<ProfileRectangle> profile_;
121 struct ProfileRectangle {
125 ProfileRectangle(IntegerValue
start, IntegerValue height)
128 bool operator<(
const ProfileRectangle& other)
const {
129 return start < other.start;
139 void ReverseProfile();
144 bool SweepAllTasks(
bool is_forward);
147 bool SweepTask(
int task_id);
151 bool UpdateStartingTime(
int task_id, IntegerValue left, IntegerValue right);
155 bool IncreaseCapacity(IntegerValue
time, IntegerValue new_min);
160 void AddProfileReason(IntegerValue left, IntegerValue right);
162 IntegerValue CapacityMin()
const {
166 IntegerValue CapacityMax()
const {
170 IntegerValue DemandMin(
int task_id)
const {
171 return integer_trail_->
LowerBound(demands_[task_id]);
174 IntegerValue DemandMax(
int task_id)
const {
175 return integer_trail_->
UpperBound(demands_[task_id]);
179 bool IsInProfile(
int t)
const {
180 return positions_in_profile_tasks_[t] < num_profile_tasks_;
184 const int num_tasks_;
187 std::vector<AffineExpression> demands_;
196 std::vector<ProfileRectangle> profile_;
197 IntegerValue profile_max_height_;
201 IntegerValue starting_profile_height_;
207 std::vector<int> forward_tasks_to_sweep_;
208 std::vector<int> backward_tasks_to_sweep_;
209 int forward_num_tasks_to_sweep_;
210 int backward_num_tasks_to_sweep_;
216 std::vector<int> profile_tasks_;
217 std::vector<int> positions_in_profile_tasks_;
218 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.