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

#include <piecewise_linear_function.h>

Public Member Functions

 FloatSlopePiecewiseLinearFunction ()=default
 
 FloatSlopePiecewiseLinearFunction (absl::InlinedVector< int64_t, 8 > x_anchors, absl::InlinedVector< int64_t, 8 > y_anchors)
 
 FloatSlopePiecewiseLinearFunction (FloatSlopePiecewiseLinearFunction &&other) noexcept
 
FloatSlopePiecewiseLinearFunctionoperator= (FloatSlopePiecewiseLinearFunction &&other) noexcept
 
std::string DebugString (absl::string_view line_prefix={}) const
 
const absl::InlinedVector< int64_t, 8 > & x_anchors () const
 
const absl::InlinedVector< int64_t, 8 > & y_anchors () const
 
int64_t ComputeInBoundsValue (int64_t x) const
 
int64_t ComputeConvexValue (int64_t x) const
 

Static Public Attributes

static const int kNoValue = -1
 FloatSlopePiecewiseLinearFunction.
 

Detailed Description

The following class defines a piecewise linear formulation with potential double values for the slope of each linear function. This formulation is meant to be used with a small number of segments (see InlinedVector sizes below). These segments are determined by int64_t values for the "anchor" x and y values, such that (x_anchors_[i], y_anchors_[i]) and (x_anchors_[i+1], y_anchors_[i+1]) are respectively the start and end point of the i-th segment.

Todo
(user): Adjust the inlined vector sizes based on experiments.

Definition at line 287 of file piecewise_linear_function.h.

Constructor & Destructor Documentation

◆ FloatSlopePiecewiseLinearFunction() [1/3]

operations_research::FloatSlopePiecewiseLinearFunction::FloatSlopePiecewiseLinearFunction ( )
default

◆ FloatSlopePiecewiseLinearFunction() [2/3]

operations_research::FloatSlopePiecewiseLinearFunction::FloatSlopePiecewiseLinearFunction ( absl::InlinedVector< int64_t, 8 > x_anchors,
absl::InlinedVector< int64_t, 8 > y_anchors )

Definition at line 815 of file piecewise_linear_function.cc.

◆ FloatSlopePiecewiseLinearFunction() [3/3]

operations_research::FloatSlopePiecewiseLinearFunction::FloatSlopePiecewiseLinearFunction ( FloatSlopePiecewiseLinearFunction && other)
inlinenoexcept

Definition at line 294 of file piecewise_linear_function.h.

Member Function Documentation

◆ ComputeConvexValue()

int64_t operations_research::FloatSlopePiecewiseLinearFunction::ComputeConvexValue ( int64_t x) const

Computes the y value associated to 'x'. Unlike ComputeInBoundsValue(), if 'x' is outside the bounds of the function, the function will still be defined by its outer segments.

Definition at line 841 of file piecewise_linear_function.cc.

◆ ComputeInBoundsValue()

int64_t operations_research::FloatSlopePiecewiseLinearFunction::ComputeInBoundsValue ( int64_t x) const

Computes the y value associated to 'x'. Returns kNoValue if 'x' is out of bounds, i.e. lower than the first x_anchor and largest than the last.

Definition at line 834 of file piecewise_linear_function.cc.

◆ DebugString()

std::string operations_research::FloatSlopePiecewiseLinearFunction::DebugString ( absl::string_view line_prefix = {}) const

Definition at line 824 of file piecewise_linear_function.cc.

◆ operator=()

FloatSlopePiecewiseLinearFunction & operations_research::FloatSlopePiecewiseLinearFunction::operator= ( FloatSlopePiecewiseLinearFunction && other)
inlinenoexcept

Definition at line 299 of file piecewise_linear_function.h.

◆ x_anchors()

const absl::InlinedVector< int64_t, 8 > & operations_research::FloatSlopePiecewiseLinearFunction::x_anchors ( ) const
inline

Definition at line 308 of file piecewise_linear_function.h.

◆ y_anchors()

const absl::InlinedVector< int64_t, 8 > & operations_research::FloatSlopePiecewiseLinearFunction::y_anchors ( ) const
inline

Definition at line 311 of file piecewise_linear_function.h.

Member Data Documentation

◆ kNoValue

const int operations_research::FloatSlopePiecewiseLinearFunction::kNoValue = -1
static

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