Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class CapacityProfile
Note: This documentation is automatically generated.
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.
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 that it adds a sentinel (kMinIntegerValue, 0) at the start. It is
useful when we reverse the direction on the x axis.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["The `CapacityProfile` class in C++ is used to manage the envelope of a set of rectangles, outlining a precise polyline rather than a convex hull."],["It provides methods to add rectangles, define mandatory consumption areas, and calculate the residual capacity profile."],["The residual capacity profile represents the difference between the maximum and minimum y-values of overlapping rectangles, considering mandatory consumption."],["Users can obtain the bounding area of the entire shape and clear the stored data as needed."]]],["The `CapacityProfile` class, used within the `no_overlap_2d` constraint, manages the envelope of rectangles. Key actions include `AddRectangle` to define a rectangle's bounds, and `AddMandatoryConsumption` to specify mandatory usage subtracted from the profile. `BuildResidualCapacityProfile` calculates the capacity profile, and `GetBoundingArea` computes the bounding polyline's area. The `Clear` method resets the profile, and the `Rectangle` method is used to manage rectangle with a given start and height.\n"]]