14 #ifndef OR_TOOLS_SAT_DIFFN_H_ 15 #define OR_TOOLS_SAT_DIFFN_H_ 49 void SortBoxesIntoNeighbors(
int box,
absl::Span<const
int> local_boxes,
50 IntegerValue total_sum_of_areas);
51 bool FailWhenEnergyIsTooLarge(
int box,
absl::Span<const
int> local_boxes,
52 IntegerValue total_sum_of_areas);
60 IntegerValue threshold_x_;
61 IntegerValue threshold_y_;
63 std::vector<
int> active_boxes_;
64 std::vector<IntegerValue> cached_energies_;
65 std::vector<
Rectangle> cached_rectangles_;
69 IntegerValue distance_to_bounding_box;
70 bool operator<(
const Neighbor& o)
const {
71 return distance_to_bounding_box < o.distance_to_bounding_box;
74 std::vector<Neighbor> neighbors_;
97 void Register(
int fast_priority,
int slow_priority);
100 bool PropagateTwoBoxes();
101 bool FindBoxesThatMustOverlapAHorizontalLineAndPropagate(
103 std::function<
bool()> inner_propagate);
113 std::vector<IndexedInterval> indexed_intervals_;
114 std::vector<std::vector<int>> events_overlapping_boxes_;
116 absl::flat_hash_set<absl::Span<int>> reduced_overlapping_boxes_;
117 std::vector<absl::Span<int>> boxes_to_propagate_;
118 std::vector<absl::Span<int>> disjoint_boxes_;
145 const std::vector<IntervalVariable>& x,
146 const std::vector<IntervalVariable>& y,
bool is_strict,
147 bool add_cumulative_relaxation =
true) {
153 model->TakeOwnership(x_helper);
154 model->TakeOwnership(y_helper);
161 model->TakeOwnership(energy_constraint);
167 model->TakeOwnership(constraint);
169 if (add_cumulative_relaxation) {
179 #endif // OR_TOOLS_SAT_DIFFN_H_
Class that owns everything related to a particular optimization model.
void AddCumulativeRelaxation(const std::vector< IntervalVariable > &x_intervals, SchedulingConstraintHelper *x, SchedulingConstraintHelper *y, Model *model)
void Register(int fast_priority, int slow_priority)
void SetPropagatorPriority(int id, int priority)
~NonOverlappingRectanglesEnergyPropagator() override
int RegisterWith(GenericLiteralWatcher *watcher)
NonOverlappingRectanglesDisjunctivePropagator(bool strict, SchedulingConstraintHelper *x, SchedulingConstraintHelper *y, Model *model)
Collection of objects used to extend the Constraint Solver library.
~NonOverlappingRectanglesDisjunctivePropagator() override
std::function< void(Model *)> NonOverlappingRectangles(const std::vector< IntervalVariable > &x, const std::vector< IntervalVariable > &y, bool is_strict, bool add_cumulative_relaxation=true)
NonOverlappingRectanglesEnergyPropagator(SchedulingConstraintHelper *x, SchedulingConstraintHelper *y, Model *model)