![]() |
Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
|
#include <no_overlap_2d_helper.h>
Public Member Functions | |
NoOverlap2DConstraintHelper (std::vector< AffineExpression > x_starts, std::vector< AffineExpression > x_ends, std::vector< AffineExpression > x_sizes, std::vector< LiteralIndex > x_reason_for_presence, std::vector< AffineExpression > y_starts, std::vector< AffineExpression > y_ends, std::vector< AffineExpression > y_sizes, std::vector< LiteralIndex > y_reason_for_presence, Model *model) | |
void | RegisterWith (GenericLiteralWatcher *watcher) |
bool | SynchronizeAndSetDirection (bool x_is_forward_after_swap=true, bool y_is_forward_after_swap=true, bool swap_x_and_y=false) |
bool | IsOptional (int index) const |
bool | IsPresent (int index) const |
bool | IsAbsent (int index) const |
Rectangle | GetBoundingRectangle (int index) const |
Rectangle | GetLevelZeroBoundingRectangle (int index) const |
bool | IsFixed (int index) const |
std::pair< IntegerValue, IntegerValue > | GetBoxSizesMax (int index) const |
std::pair< IntegerValue, IntegerValue > | GetLevelZeroBoxSizesMin (int index) const |
void | ClearReason () |
void | WatchAllBoxes (int id) |
bool | PropagateRelativePosition (int first, int second, PairwiseRestriction::PairwiseRestrictionType type) |
RectangleInRange | GetItemRangeForSizeMin (int index) const |
ItemWithVariableSize | GetItemWithVariableSize (int index) const |
bool | ReportConflictFromTwoBoxes (int box1, int box2) |
bool | ReportConflictFromInfeasibleBoxRanges (absl::Span< const RectangleInRange > ranges) |
void | AddXSizeMinReason (int index) |
void | AddYSizeMinReason (int index) |
void | AddSizeMinReason (int index) |
void | AddLeftMinReason (int index, IntegerValue lower_bound) |
void | AddLeftMaxReason (int index, IntegerValue upper_bound) |
void | AddBottomMinReason (int index, IntegerValue lower_bound) |
void | AddBottomMaxReason (int index, IntegerValue upper_bound) |
void | AddPresenceReason (int index) |
bool | IncreaseLeftMin (int index, IntegerValue new_lower_bound) |
bool | ReportConflict () |
int | NumBoxes () const |
bool | Propagate () override |
SchedulingConstraintHelper & | x_helper () const |
SchedulingConstraintHelper & | y_helper () const |
SchedulingDemandHelper & | x_demands_helper () |
SchedulingDemandHelper & | y_demands_helper () |
const CompactVectorVector< int > & | connected_components () const |
int64_t | InProcessingCount () const |
int64_t | LastLevelZeroChangeIdx () const |
![]() | |
PropagatorInterface ()=default | |
virtual | ~PropagatorInterface ()=default |
virtual bool | IncrementalPropagate (const std::vector< int > &) |
Helper class shared by the propagators that handle no_overlap_2d constraints.
Having a helper class like this one makes much easier to do in-processing and to share pre-computed data between the two propagators.
Definition at line 38 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 40 of file no_overlap_2d_helper.h.
|
inline |
Push the explanation that the bottom edge of this box is to the bottom of the vertical line y=upper_bound.
Definition at line 196 of file no_overlap_2d_helper.h.
|
inline |
Push the explanation that the bottom edge of this box is to the top of the horizontal line y=lower_bound.
Definition at line 190 of file no_overlap_2d_helper.h.
|
inline |
Push the explanation that the left edge of this box is to the left of the vertical line x=upper_bound.
| <= | \/ <= | +------—|—+ | <= | | | <= | | +------—|—| |
Definition at line 184 of file no_overlap_2d_helper.h.
|
inline |
Push the explanation that the left edge of this box is to the right of the vertical line x=lower_bound.
| => | | => \/ | => +—+ | => | | | => +—+ |
Definition at line 170 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 200 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 156 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 154 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 155 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 113 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 227 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 84 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 103 of file no_overlap_2d_helper.h.
RectangleInRange operations_research::sat::NoOverlap2DConstraintHelper::GetItemRangeForSizeMin | ( | int | index | ) | const |
Returns a "fixed size projection" of the item of the item index
. More precisely, returns item of index index
with its sizes fixed to their minimum value alongside a bounding box that contains the item.
Definition at line 67 of file no_overlap_2d_helper.cc.
ItemWithVariableSize operations_research::sat::NoOverlap2DConstraintHelper::GetItemWithVariableSize | ( | int | index | ) | const |
Returns a {start_min, start_max, end_min, end_max} view of the item of the index index
.
Definition at line 81 of file no_overlap_2d_helper.cc.
|
inline |
Definition at line 91 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 107 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 205 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 231 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 80 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 98 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 72 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 76 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 232 of file no_overlap_2d_helper.h.
|
inline |
Definition at line 215 of file no_overlap_2d_helper.h.
|
overridevirtual |
This will be called after one or more literals that are watched by this propagator changed. It will also always be called on the first propagation cycle after registration.
Subtle: it is tempting to run this logic once for every connected component. However, this would be buggy, since the PresolveFixed2dRectangles() might grow a fixed box making it overlap with something on another component.
Implements operations_research::sat::PropagatorInterface.
Definition at line 318 of file no_overlap_2d_helper.cc.
bool operations_research::sat::NoOverlap2DConstraintHelper::PropagateRelativePosition | ( | int | first, |
int | second, | ||
PairwiseRestriction::PairwiseRestrictionType | type ) |
Propagate a relationship between two boxes (ie., first must be to the left of the second, etc).
Definition at line 194 of file no_overlap_2d_helper.cc.
void operations_research::sat::NoOverlap2DConstraintHelper::RegisterWith | ( | GenericLiteralWatcher * | watcher | ) |
Definition at line 376 of file no_overlap_2d_helper.cc.
|
inline |
Definition at line 210 of file no_overlap_2d_helper.h.
bool operations_research::sat::NoOverlap2DConstraintHelper::ReportConflictFromInfeasibleBoxRanges | ( | absl::Span< const RectangleInRange > | ranges | ) |
Reports a conflict due to a (potentially relaxed) infeasible subproblem of the no_overlap_2d constraint. More concretely, this function takes a list of fixed-size rectangles and their placement domains in ranges
that satisfy:
ranges
are smaller or equal than the corresponding current minimum sizes of the boxes;ranges
, range.box_index.bounding_box is fully contained inside GetItemRangeForSizeMin(range.box_index).bounding_box. In other terms, each element is infeasible in a domain at least as large as the current one. Definition at line 122 of file no_overlap_2d_helper.cc.
bool operations_research::sat::NoOverlap2DConstraintHelper::ReportConflictFromTwoBoxes | ( | int | box1, |
int | box2 ) |
If there is no possible placement for the two mandatory boxes (they will necessarily overlap), call this function to report this as a conflict. Returns true.
Definition at line 105 of file no_overlap_2d_helper.cc.
bool operations_research::sat::NoOverlap2DConstraintHelper::SynchronizeAndSetDirection | ( | bool | x_is_forward_after_swap = true, |
bool | y_is_forward_after_swap = true, | ||
bool | swap_x_and_y = false ) |
Definition at line 36 of file no_overlap_2d_helper.cc.
|
inline |
Definition at line 118 of file no_overlap_2d_helper.h.
SchedulingDemandHelper & operations_research::sat::NoOverlap2DConstraintHelper::x_demands_helper | ( | ) |
Definition at line 51 of file no_overlap_2d_helper.cc.
|
inline |
Definition at line 221 of file no_overlap_2d_helper.h.
SchedulingDemandHelper & operations_research::sat::NoOverlap2DConstraintHelper::y_demands_helper | ( | ) |
Definition at line 59 of file no_overlap_2d_helper.cc.
|
inline |
Definition at line 222 of file no_overlap_2d_helper.h.