Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
2d_mandatory_overlap_propagator.h
Go to the documentation of this file.
1// Copyright 2010-2025 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#ifndef OR_TOOLS_SAT_2D_MANDATORY_OVERLAP_PROPAGATOR_H_
15#define OR_TOOLS_SAT_2D_MANDATORY_OVERLAP_PROPAGATOR_H_
16
17#include <cstdint>
18#include <vector>
19
21#include "ortools/sat/integer.h"
22#include "ortools/sat/model.h"
25
26namespace operations_research {
27namespace sat {
28
29// Propagator that checks that no mandatory area of two boxes overlap in
30// O(N * log N) time.
32 NoOverlap2DConstraintHelper* helper, Model* model,
33 GenericLiteralWatcher* watcher, int priority);
34
35// Exposed for testing.
37 public:
39 : helper_(*helper),
40 shared_stats_(model->GetOrCreate<SharedStatistics>()) {}
41
43
44 bool Propagate() final;
46
47 private:
49 SharedStatistics* shared_stats_;
50 std::vector<Rectangle> mandatory_regions_;
51 std::vector<int> mandatory_regions_index_;
52
53 int64_t num_conflicts_ = 0;
54 int64_t num_calls_zero_area_ = 0;
55 int64_t num_calls_nonzero_area_ = 0;
56
59 delete;
60};
61
62} // namespace sat
63} // namespace operations_research
64
65#endif // OR_TOOLS_SAT_2D_MANDATORY_OVERLAP_PROPAGATOR_H_
MandatoryOverlapPropagator(NoOverlap2DConstraintHelper *helper, Model *model)
Simple class to add statistics by name and print them at the end.
void CreateAndRegisterMandatoryOverlapPropagator(NoOverlap2DConstraintHelper *helper, Model *model, GenericLiteralWatcher *watcher, int priority)
In SWIG mode, we don't want anything besides these top-level includes.
STL namespace.