LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
mmap_compress.h File Reference

Compression of a marked MAP into a smaller representation, and the two M3A primitives it is built from: the class-conditional backward moments and the probabilistic mixture of MAPs. More...

#include <cstddef>
#include <vector>
#include "line/api/mam/aph2_fit.h"
#include "line/api/mam/map_moment.h"
#include "line/api/mam/map_transform.h"
#include "line/api/mam/mmap_lambda.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/linalg.h"
#include "line/util/matrix.h"
Include dependency graph for mmap_compress.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::mam

Enumerations

enum class  line::mam::MmapCompressMethod {
  line::mam::MixtureOrder1 , line::mam::MixtureOrder2 , line::mam::Mamap2 , line::mam::Mamap2Fb ,
  line::mam::M3ppApproxCov , line::mam::M3ppApproxAg , line::mam::M3ppExactDelta , line::mam::M3ppApproxDelta
}
 The compression methods of mmap_compress.m. More...

Functions

template<class T>
std::vector< std::vector< T > > line::mam::mmap_backward_moment (const Mmap< T > &m, const std::vector< unsigned > &orders, bool normalized)
 Class-conditional backward moments of an MMAP (mmap_backward_moment.m).
template<class T>
std::vector< std::vector< T > > line::mam::mmap_backward_moment (const Mmap< T > &m, const std::vector< unsigned > &orders)
 mmap_backward_moment with the MATLAB default, normalized.
template<class T>
Mmap< T > line::mam::mmap_mixture (const std::vector< T > &alpha, const std::vector< Map< T > > &maps)
 Probabilistic mixture of MAPs (mmap_mixture.m).
template<class T>
Mmap< T > line::mam::mmap_compress (const Mmap< T > &in, MmapCompressMethod method)
 Compress an MMAP (mmap_compress.m).
template<class T>
Mmap< T > line::mam::mmap_compress (const Mmap< T > &in)
 mmap_compress with the default method, the order-1 mixture.

Detailed Description

Compression of a marked MAP into a smaller representation, and the two M3A primitives it is built from: the class-conditional backward moments and the probabilistic mixture of MAPs.

Templated port of matlab/src/api/mam/mmap_compress.m (the 'default' / 'mixture' / 'mixture.order1' method), matlab/lib/m3a/m3a/mmap/ mmap_backward_moment.m and mmap_mixture.m.

ORDER-1 MIXTURE. One component per class, recombined by mmap_mixture with the class probabilities p_c as mixing weights. Component c must carry the law of the inter-arrival time CONDITIONED ON THE ARRIVAL THAT ENDS IT BEING OF CLASS c, because mmap_mixture marks the arrival LEAVING component c with class c, so the class of an arrival and the interval preceding it are both governed by the component active during that interval. That conditional law is the class-c BACKWARD moment set B(c, 1:3),

B(c,k) = k! pie (-D0)^-(k+1) D1^(c) e / p_c,

i.e. E[T^k | class of the ending arrival = c]. It is NOT the forward moment and it is NOT the class-c marginal MAP of mmap_maps, whose mean is 1/lambda_c, the time between successive class-c arrivals; mixing those with weights lambda_c/Lambda inflates the mean to K/Lambda.

PRESERVED exactly: the aggregate moments 1..3, through the mixture law M_k = sum_c B(k,c) p_c (M1 always, since aph2_adjust never alters M1; M2 and M3 whenever the triple is APH(2)-feasible); the class probabilities p_c and hence the per-class rates lambda_c = p_c / M1; the marking consistency D1 = sum_c D1^(c); and MAP feasibility, since mmap_normalize closes the result.

LOST by construction: every autocorrelation. mmap_mixture re-enters each component at its map_pie on every arrival, so the intervals are i.i.d. and the result is a RENEWAL process: acf -> 0, IDC -> the SCV-determined renewal value, and the class sequence becomes i.i.d. Retaining the class-transition matrix sigma is what the order-2 method buys with its K^2 components.

ARITHMETIC. mmap_backward_moment and mmap_mixture are finite rational expressions in the descriptor entries and instantiate at Rational, which is what makes the preservation claims above CHECKABLE rather than merely plausible: at exact arithmetic the class probabilities of the compressed MMAP equal those of the original digit for digit, so any drift the tests see is a real modelling loss and not rounding. mmap_compress itself is gated on num_traits<T>::has_transcendental because aph2_fit is.

NOT PORTED. The other five methods of mmap_compress.m are dispatch to separate fitting families that are outside this change: 'mixture.order2' (mmap_mixture_fit_mmap), 'mamap2' and 'mamap2.fb' (mamap2m_fit_mmap, mamap2m_fit_gamma_fb_mmap) and the four 'm3pp.*' variants (m3pp2m_fitc_theoretical, which needs the derivest numerical differentiation package). MmapCompressMethod names them so a caller gets UnsupportedError identifying the missing family rather than silently receiving the order-1 mixture.

Definition in file mmap_compress.h.