Google OR-Tools
v9.15
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 ORTOOLS_SAT_2D_MANDATORY_OVERLAP_PROPAGATOR_H_
15
#define ORTOOLS_SAT_2D_MANDATORY_OVERLAP_PROPAGATOR_H_
16
17
#include <cstdint>
18
#include <vector>
19
20
#include "
ortools/sat/diffn_util.h
"
21
#include "
ortools/sat/integer.h
"
22
#include "
ortools/sat/model.h
"
23
#include "
ortools/sat/no_overlap_2d_helper.h
"
24
#include "
ortools/sat/synchronization.h
"
25
26
namespace
operations_research
{
27
namespace
sat
{
28
29
// Propagator that checks that no mandatory area of two boxes overlap in
30
// O(N * log N) time.
31
void
CreateAndRegisterMandatoryOverlapPropagator
(
32
NoOverlap2DConstraintHelper
* helper,
Model
* model,
33
GenericLiteralWatcher
* watcher,
int
priority);
34
35
// Exposed for testing.
36
class
MandatoryOverlapPropagator
:
public
PropagatorInterface
{
37
public
:
38
MandatoryOverlapPropagator
(
NoOverlap2DConstraintHelper
* helper,
Model
* model)
39
: helper_(*helper),
40
shared_stats_(model->GetOrCreate<
SharedStatistics
>()) {}
41
42
~MandatoryOverlapPropagator
()
override
;
43
44
bool
Propagate
() final;
45
int
RegisterWith
(
GenericLiteralWatcher
* watcher);
46
47
private:
48
NoOverlap2DConstraintHelper
& helper_;
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
57
MandatoryOverlapPropagator
(const
MandatoryOverlapPropagator
&) = delete;
58
MandatoryOverlapPropagator
& operator=(const
MandatoryOverlapPropagator
&) =
59
delete;
60
};
61
62
}
// namespace sat
63
}
// namespace operations_research
64
65
#endif
// ORTOOLS_SAT_2D_MANDATORY_OVERLAP_PROPAGATOR_H_
operations_research::sat::GenericLiteralWatcher
Definition
integer.h:1324
operations_research::sat::MandatoryOverlapPropagator
Definition
2d_mandatory_overlap_propagator.h:36
operations_research::sat::MandatoryOverlapPropagator::~MandatoryOverlapPropagator
~MandatoryOverlapPropagator() override
Definition
2d_mandatory_overlap_propagator.cc:41
operations_research::sat::MandatoryOverlapPropagator::RegisterWith
int RegisterWith(GenericLiteralWatcher *watcher)
Definition
2d_mandatory_overlap_propagator.cc:35
operations_research::sat::MandatoryOverlapPropagator::Propagate
bool Propagate() final
Definition
2d_mandatory_overlap_propagator.cc:53
operations_research::sat::MandatoryOverlapPropagator::MandatoryOverlapPropagator
MandatoryOverlapPropagator(NoOverlap2DConstraintHelper *helper, Model *model)
Definition
2d_mandatory_overlap_propagator.h:38
operations_research::sat::Model
Definition
model.h:38
operations_research::sat::NoOverlap2DConstraintHelper
Definition
no_overlap_2d_helper.h:40
operations_research::sat::PropagatorInterface::PropagatorInterface
PropagatorInterface()=default
operations_research::sat::SharedStatistics
Definition
synchronization.h:1025
diffn_util.h
integer.h
operations_research::sat
Definition
routing_sat.cc:45
operations_research::sat::CreateAndRegisterMandatoryOverlapPropagator
void CreateAndRegisterMandatoryOverlapPropagator(NoOverlap2DConstraintHelper *helper, Model *model, GenericLiteralWatcher *watcher, int priority)
Definition
2d_mandatory_overlap_propagator.cc:103
operations_research
OR-Tools root namespace.
Definition
binary_indexed_tree.h:21
std
STL namespace.
no_overlap_2d_helper.h
model.h
operations_research::sat::Rectangle
Definition
diffn_util.h:43
synchronization.h
ortools
sat
2d_mandatory_overlap_propagator.h
Generated by
1.15.0