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

EXACT inverses of the class-marking map: solve for the split directly instead of optimizing it. More...

#include <cmath>
#include <cstddef>
#include <vector>
#include "line/api/mam/amap2_fit_gamma.h"
#include "line/api/mam/mamap2m_fit.h"
#include "line/api/mam/map_moment.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/lu.h"
#include "line/util/matrix.h"
Include dependency graph for mmap_k_fit.h:

Go to the source code of this file.

Classes

struct  line::mam::MmapKFitResult< T >
 A marked MAP and whether the marking system was solved exactly. More...

Namespaces

namespace  line
namespace  line::mam

Functions

template<class T>
MmapKFitResult< T > line::mam::mmap2k_fit (const T &M1, const T &M2, const T &M3, const T &GAMMA, const std::vector< T > &P, const std::vector< T > &F, const std::vector< T > &B)
 Exact marking of an AMAP(2) against per-class (p, F, B).
template<class T>
MmapKFitResult< T > line::mam::mmap3k_fit (const Matrix< T > &D0, const Matrix< T > &D1, const std::vector< T > &P, const std::vector< T > &F, const std::vector< T > &B, const std::vector< T > &B2=std::vector< T >())
 Exact marking of an arbitrary MAP by solving the marking system directly.

Detailed Description

EXACT inverses of the class-marking map: solve for the split directly instead of optimizing it.

Templated port of matlab/lib/m3a/m3a/mamap2m/mmap2k_fit.m and mmap3k_fit.m.

mamap2m_fit_fb_multiclass treats the split as a quadratic program because the per-class targets are generally unreachable. When the number of free marking parameters EQUALS the number of characteristics being matched, the system is square and can simply be solved; these two functions do that, and report whether the solution landed inside the unit box.

  • mmap2k_fit inverts an AMAP(2)'s three flows against (p, F, B) per class in closed form, one class at a time, and falls back to mamap2m_fit_gamma_fb when no AMAP(2) form gives a feasible split.
  • mmap3k_fit does it for a MAP of any order by building the marking system M q = y explicitly: row (a,b) of M is pie (-D0)^-a Dc (-D0)^-b e, which is the characteristic that row matches, and the target vector y carries p, p F, p B and p B2 for the orders (1,0), (1,1), (2,0) and (3,0).

EXACT IS REPORTED, NOT ASSUMED. Both return a flag saying whether the solved split was feasible; when it was not, the entries are clamped into [0,1] and the flag is false, so a caller can tell an exact fit from a projected one. Silently clamping and calling the result exact is the failure mode these functions exist to avoid.

THE DEGENERATE LOCUS IS REFUSED, not worked around. mmap2k_fit skips an AMAP form whose denominators vanish; mmap3k_fit refuses outright when the marking matrix is singular, because there the characteristics do not determine the split and any answer would be arbitrary.

ARITHMETIC: transcendental, through amap2_fit_gamma and the linear solves.

Definition in file mmap_k_fit.h.