14#ifndef OR_TOOLS_SAT_DIFFN_UTIL_H_
15#define OR_TOOLS_SAT_DIFFN_UTIL_H_
20#include "absl/container/flat_hash_set.h"
21#include "absl/strings/str_format.h"
47 return absl::StrFormat(
"rectangle(x(%i..%i), y(%i..%i))",
x_min.value(),
58 const std::vector<Rectangle>& rectangles,
59 absl::Span<int> active_rectangles);
64 const std::vector<IntegerValue>& energies,
65 absl::Span<const int> boxes,
66 Rectangle* conflict =
nullptr);
75 SchedulingConstraintHelper* x,
76 SchedulingConstraintHelper* y);
87 const std::vector<Rectangle>& rectangles,
88 const std::vector<IntegerValue>& rectangle_energies,
89 IntegerValue* x_threshold, IntegerValue* y_threshold,
90 Rectangle* conflict =
nullptr);
96 const std::vector<Rectangle>& cached_rectangles, absl::Span<int> boxes,
97 IntegerValue threshold_x, IntegerValue threshold_y, absl::BitGenRef random);
104 const std::vector<Rectangle>& cached_rectangles,
105 const std::vector<IntegerValue>& energies, absl::Span<int> boxes);
121 return std::tie(
a.start,
a.end,
a.index) <
122 std::tie(
b.start,
b.end,
b.index);
127 return a.start <
b.start;
141 std::vector<IndexedInterval>* intervals,
142 std::vector<std::vector<int>>* result);
149 std::vector<IndexedInterval>* intervals,
150 std::vector<std::vector<int>>* components);
157 std::vector<IndexedInterval>* intervals);
std::ostream & operator<<(std::ostream &os, const BoolVar &var)
void GetOverlappingIntervalComponents(std::vector< IndexedInterval > *intervals, std::vector< std::vector< int > > *components)
std::vector< int > GetIntervalArticulationPoints(std::vector< IndexedInterval > *intervals)
std::vector< absl::Span< int > > GetOverlappingRectangleComponents(const std::vector< Rectangle > &rectangles, absl::Span< int > active_rectangles)
absl::Span< int > FilterBoxesAndRandomize(const std::vector< Rectangle > &cached_rectangles, absl::Span< int > boxes, IntegerValue threshold_x, IntegerValue threshold_y, absl::BitGenRef random)
bool AnalyzeIntervals(bool transpose, absl::Span< const int > local_boxes, const std::vector< Rectangle > &rectangles, const std::vector< IntegerValue > &rectangle_energies, IntegerValue *x_threshold, IntegerValue *y_threshold, Rectangle *conflict)
bool ReportEnergyConflict(Rectangle bounding_box, absl::Span< const int > boxes, SchedulingConstraintHelper *x, SchedulingConstraintHelper *y)
void ConstructOverlappingSets(bool already_sorted, std::vector< IndexedInterval > *intervals, std::vector< std::vector< int > > *result)
bool BoxesAreInEnergyConflict(const std::vector< Rectangle > &rectangles, const std::vector< IntegerValue > &energies, absl::Span< const int > boxes, Rectangle *conflict)
absl::Span< int > FilterBoxesThatAreTooLarge(const std::vector< Rectangle > &cached_rectangles, const std::vector< IntegerValue > &energies, absl::Span< int > boxes)
Collection of objects used to extend the Constraint Solver library.
bool operator()(const IndexedInterval &a, const IndexedInterval &b) const
bool operator()(const IndexedInterval &a, const IndexedInterval &b) const
bool operator==(const IndexedInterval &rhs) const
IntegerValue Area() const
std::string DebugString() const
void TakeUnionWith(const Rectangle &other)
bool IsDisjoint(const Rectangle &other) const