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

#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 ()
 

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 270 of file diffn_util.h.

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 660 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 649 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 670 of file diffn_util.cc.

◆ Clear()

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

Definition at line 644 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 716 of file diffn_util.cc.


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