Google OR-Tools
v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
2d_distances_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_DISTANCES_PROPAGATOR_H_
15
#define OR_TOOLS_SAT_2D_DISTANCES_PROPAGATOR_H_
16
17
#include <cstdint>
18
#include <utility>
19
#include <vector>
20
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/precedences.h
"
25
#include "
ortools/sat/synchronization.h
"
26
27
namespace
operations_research
{
28
namespace
sat
{
29
30
// This class implements a propagator for non_overlap_2d constraints that uses
31
// the BinaryRelationsMaps to detect precedences between pairs of boxes and
32
// detect a conflict if the precedences implies an overlap between the two
33
// boxes. For doing this efficiently, it keep track of pairs of boxes that have
34
// non-fixed precedences in the BinaryRelationsMaps and only check those in the
35
// propagation.
36
class
Precedences2DPropagator
:
public
PropagatorInterface
{
37
public
:
38
Precedences2DPropagator
(
NoOverlap2DConstraintHelper
* helper,
Model
* model);
39
40
~Precedences2DPropagator
()
override
;
41
42
bool
Propagate
()
final
;
43
int
RegisterWith
(
GenericLiteralWatcher
* watcher);
44
45
private
:
46
void
CollectPairsOfBoxesWithNonTrivialDistance();
47
48
std::vector<std::pair<int, int>> non_trivial_pairs_;
49
50
NoOverlap2DConstraintHelper
& helper_;
51
BinaryRelationsMaps
* binary_relations_maps_;
52
SharedStatistics
* shared_stats_;
53
54
int
last_helper_inprocessing_count_ = -1;
55
int
last_num_expressions_ = -1;
56
57
int64_t num_conflicts_ = 0;
58
int64_t num_calls_ = 0;
59
60
Precedences2DPropagator
(
const
Precedences2DPropagator
&) =
delete
;
61
Precedences2DPropagator
& operator=(
const
Precedences2DPropagator
&) =
delete
;
62
};
63
64
}
// namespace sat
65
}
// namespace operations_research
66
67
#endif
// OR_TOOLS_SAT_2D_DISTANCES_PROPAGATOR_H_
operations_research::sat::BinaryRelationsMaps
Definition
precedences.h:591
operations_research::sat::GenericLiteralWatcher
Definition
integer.h:1104
operations_research::sat::Model
Definition
model.h:40
operations_research::sat::NoOverlap2DConstraintHelper
Definition
no_overlap_2d_helper.h:38
operations_research::sat::Precedences2DPropagator::RegisterWith
int RegisterWith(GenericLiteralWatcher *watcher)
Definition
2d_distances_propagator.cc:199
operations_research::sat::Precedences2DPropagator::Propagate
bool Propagate() final
Definition
2d_distances_propagator.cc:116
operations_research::sat::Precedences2DPropagator::Precedences2DPropagator
Precedences2DPropagator(NoOverlap2DConstraintHelper *helper, Model *model)
Definition
2d_distances_propagator.cc:39
operations_research::sat::Precedences2DPropagator::~Precedences2DPropagator
~Precedences2DPropagator() override
Definition
2d_distances_propagator.cc:206
operations_research::sat::PropagatorInterface::PropagatorInterface
PropagatorInterface()=default
operations_research::sat::SharedStatistics
Simple class to add statistics by name and print them at the end.
Definition
synchronization.h:785
integer.h
operations_research::sat
Definition
routing_sat.cc:45
operations_research
In SWIG mode, we don't want anything besides these top-level includes.
Definition
binary_indexed_tree.h:21
no_overlap_2d_helper.h
precedences.h
model.h
synchronization.h
ortools
sat
2d_distances_propagator.h
Generated by
1.14.0