Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::sat::CapacityProfile Class Reference

Detailed Description

This class is used by the no_overlap_2d constraint to maintain the envelope of a set of rectangles. This envelope is not the convex hull, but the exact polyline (aligned with the x and y axis) that contains all the rectangles passed with the AddRectangle() call.

Definition at line 333 of file diffn_util.h.

#include <diffn_util.h>

Classes

struct  Rectangle

Public Member Functions

void Clear ()
void AddRectangle (IntegerValue x_min, IntegerValue x_max, IntegerValue y_min, IntegerValue y_max)
 Adds a rectangle to the current shape.
void AddMandatoryConsumption (IntegerValue x_min, IntegerValue x_max, IntegerValue y_height)
void BuildResidualCapacityProfile (std::vector< Rectangle > *result)
IntegerValue GetBoundingArea ()

Member Function Documentation

◆ AddMandatoryConsumption()

void operations_research::sat::CapacityProfile::AddMandatoryConsumption ( IntegerValue x_min,
IntegerValue x_max,
IntegerValue y_height )

Adds a mandatory profile consumption. All mandatory usages will be subtracted from the y_max-y_min profile to build the residual capacity.

Definition at line 688 of file diffn_util.cc.

◆ AddRectangle()

void operations_research::sat::CapacityProfile::AddRectangle ( IntegerValue x_min,
IntegerValue x_max,
IntegerValue y_min,
IntegerValue y_max )

Adds a rectangle to the current shape.

Definition at line 677 of file diffn_util.cc.

◆ BuildResidualCapacityProfile()

void operations_research::sat::CapacityProfile::BuildResidualCapacityProfile ( std::vector< Rectangle > * result)

Returns the profile of the function: capacity(x) = max(y_max of rectangles overlapping x) - min(y_min of rectangle overlapping x) - sum(y_height of mandatory rectangles overlapping x) where a rectangle overlaps x if x_min <= x < x_max.

Note the profile can contain negative heights in case the mandatory part exceeds the range on the y axis.

Note
it adds a sentinel (kMinIntegerValue, 0) at the start. It is useful when we reverse the direction on the x axis.

Definition at line 698 of file diffn_util.cc.

◆ Clear()

void operations_research::sat::CapacityProfile::Clear ( )

Definition at line 672 of file diffn_util.cc.

◆ GetBoundingArea()

IntegerValue operations_research::sat::CapacityProfile::GetBoundingArea ( )

Returns the exact area of the bounding polyline of all rectangles added.

Note
this will redo the computation each time.

Definition at line 744 of file diffn_util.cc.


The documentation for this class was generated from the following files: