FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::CapacityDayPrice Class Reference

The day price of one budget: the value at which the rest of the day's demand fits what is left. More...

#include <fastmm/core/capacity_price.hpp>

Public Member Functions

void note (double rel) noexcept
 
void note_sent () noexcept
 
double price () const noexcept
 
std::int64_t used () const noexcept
 
void tick (std::int64_t now_ns, std::int64_t budget, double floor, int kind) noexcept
 Once a minute: fold the minute's demand in, roll the day, and fit the price.
 

Static Public Member Functions

static double edge (int b) noexcept
 The lower edge of bucket b as a multiple of L.
 
static int bucket (double rel) noexcept
 The bucket of a value v given as a multiple of L (v / L); infinite: the top bucket.
 

Static Public Attributes

static constexpr int kBuckets = 64
 
static constexpr int kZero = 16
 bucket of value L: [L, L * 2^(1/4))
 

Detailed Description

The day price of one budget: the value at which the rest of the day's demand fits what is left.

Demand is every action priced, by value as a multiple of L in quarter octaves.

Member Function Documentation

◆ edge()

static double fastmm::CapacityDayPrice::edge ( int  b)
inlinestaticnoexcept

The lower edge of bucket b as a multiple of L.

◆ bucket()

static int fastmm::CapacityDayPrice::bucket ( double  rel)
inlinestaticnoexcept

The bucket of a value v given as a multiple of L (v / L); infinite: the top bucket.

< rel = m * 2^e, m in [0.5, 1)

quarter octave within [0.5, 1): thresholds 2^(-1), 2^(-3/4), 2^(-1/2), 2^(-1/4)

◆ note()

void fastmm::CapacityDayPrice::note ( double  rel)
inlinenoexcept

◆ note_sent()

void fastmm::CapacityDayPrice::note_sent ( )
inlinenoexcept

◆ price()

double fastmm::CapacityDayPrice::price ( ) const
inlinenoexcept

◆ used()

std::int64_t fastmm::CapacityDayPrice::used ( ) const
inlinenoexcept

◆ tick()

void fastmm::CapacityDayPrice::tick ( std::int64_t  now_ns,
std::int64_t  budget,
double  floor,
int  kind 
)
inlinenoexcept

Once a minute: fold the minute's demand in, roll the day, and fit the price.

budget <= 0: no price. kind 0 for a weekday, 1 for a weekend (their hours differ).

The demand of an hour: its profile, else the recent rate (decisions per hour).

The fraction of the demand that fits; the most valuable part of the recent demand gets it.

Member Data Documentation

◆ kBuckets

constexpr int fastmm::CapacityDayPrice::kBuckets = 64
staticconstexpr

◆ kZero

constexpr int fastmm::CapacityDayPrice::kZero = 16
staticconstexpr

bucket of value L: [L, L * 2^(1/4))