14 #ifndef OR_TOOLS_SAT_DIFFN_H_
15 #define OR_TOOLS_SAT_DIFFN_H_
47 void SortBoxesIntoNeighbors(
int box,
absl::Span<const
int> local_boxes,
48 IntegerValue total_sum_of_areas);
49 bool FailWhenEnergyIsTooLarge(
int box,
absl::Span<const
int> local_boxes,
50 IntegerValue total_sum_of_areas);
55 std::vector<
absl::Span<
int>> x_split_;
56 std::vector<
absl::Span<
int>> y_split_;
58 std::vector<
int> active_boxes_;
59 std::vector<IntegerValue> cached_areas_;
67 void TakeUnionWith(
const Dimension& other) {
68 x_min =
std::min(x_min, other.x_min);
69 y_min =
std::min(y_min, other.y_min);
70 x_max =
std::max(x_max, other.x_max);
71 y_max =
std::max(y_max, other.y_max);
74 std::vector<Dimension> cached_dimensions_;
78 IntegerValue distance_to_bounding_box;
79 bool operator<(
const Neighbor& o)
const {
80 return distance_to_bounding_box < o.distance_to_bounding_box;
83 std::vector<Neighbor> neighbors_;
106 void Register(
int fast_priority,
int slow_priority);
109 bool PropagateTwoBoxes();
110 bool FindBoxesThatMustOverlapAHorizontalLineAndPropagate(
112 std::function<
bool()> inner_propagate);
123 std::vector<int> active_boxes_;
124 std::vector<IntegerValue> events_time_;
125 std::vector<std::vector<int>> events_overlapping_boxes_;
127 absl::flat_hash_set<absl::Span<int>> reduced_overlapping_boxes_;
128 std::vector<absl::Span<int>> boxes_to_propagate_;
129 std::vector<absl::Span<int>> disjoint_boxes_;
156 const std::vector<IntervalVariable>& x,
157 const std::vector<IntervalVariable>& y,
bool is_strict) {
163 model->TakeOwnership(x_helper);
164 model->TakeOwnership(y_helper);
171 model->TakeOwnership(energy_constraint);
177 model->TakeOwnership(constraint);
187 #endif // OR_TOOLS_SAT_DIFFN_H_