Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <piecewise_linear_function.h>
Public Member Functions | |
PiecewiseSegment (int64_t point_x, int64_t point_y, int64_t slope, int64_t other_point_x) | |
int64_t | Value (int64_t x) const |
Returns the value of the segment at point x. | |
int64_t | start_x () const |
Returns the start of the segment's domain. | |
int64_t | end_x () const |
Returns the end of the segment's domain. | |
int64_t | start_y () const |
Returns the value at the start of the segment's domain. | |
int64_t | end_y () const |
Returns the value at the end of the segment's domain. | |
int64_t | slope () const |
Returns the segment's slope. | |
int64_t | intersection_y () const |
Returns the intersection of the segment's extension with the y axis. | |
void | ExpandEnd (int64_t end_x) |
void | AddConstantToX (int64_t constant) |
Adds 'constant' to the 'x' the segments. | |
void | AddConstantToY (int64_t constant) |
Adds 'constant' to the 'y' the segments. | |
std::string | DebugString () const |
Static Public Member Functions | |
static bool | SortComparator (const PiecewiseSegment &segment1, const PiecewiseSegment &segment2) |
Comparison method useful for sorting a sequence of segments. | |
static bool | FindComparator (int64_t point, const PiecewiseSegment &segment) |
Comparison method useful for finding in which segment a point belongs. | |
This structure stores one straight line. It contains the start point, the end point and the slope. It is defined for x values between start_x and end_x.
Definition at line 33 of file piecewise_linear_function.h.
operations_research::PiecewiseSegment::PiecewiseSegment | ( | int64_t | point_x, |
int64_t | point_y, | ||
int64_t | slope, | ||
int64_t | other_point_x ) |
Definition at line 81 of file piecewise_linear_function.cc.
void operations_research::PiecewiseSegment::AddConstantToX | ( | int64_t | constant | ) |
Adds 'constant' to the 'x' the segments.
Definition at line 245 of file piecewise_linear_function.cc.
void operations_research::PiecewiseSegment::AddConstantToY | ( | int64_t | constant | ) |
Adds 'constant' to the 'y' the segments.
Definition at line 255 of file piecewise_linear_function.cc.
std::string operations_research::PiecewiseSegment::DebugString | ( | ) | const |
Definition at line 263 of file piecewise_linear_function.cc.
|
inline |
Returns the end of the segment's domain.
Definition at line 43 of file piecewise_linear_function.h.
|
inline |
Returns the value at the end of the segment's domain.
Definition at line 47 of file piecewise_linear_function.h.
void operations_research::PiecewiseSegment::ExpandEnd | ( | int64_t | end_x | ) |
Expands segment to the specified endpoint, if it is further than the current endpoint. The reference point of the segment doesn't change for overflow reasons.
Definition at line 241 of file piecewise_linear_function.cc.
|
static |
Comparison method useful for finding in which segment a point belongs.
Definition at line 236 of file piecewise_linear_function.cc.
|
inline |
Returns the intersection of the segment's extension with the y axis.
Definition at line 51 of file piecewise_linear_function.h.
|
inline |
Returns the segment's slope.
Definition at line 49 of file piecewise_linear_function.h.
|
static |
Comparison method useful for sorting a sequence of segments.
Definition at line 231 of file piecewise_linear_function.cc.
|
inline |
Returns the start of the segment's domain.
Definition at line 41 of file piecewise_linear_function.h.
|
inline |
Returns the value at the start of the segment's domain.
Definition at line 45 of file piecewise_linear_function.h.
int64_t operations_research::PiecewiseSegment::Value | ( | int64_t | x | ) | const |
Returns the value of the segment at point x.
Definition at line 90 of file piecewise_linear_function.cc.