LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::mam::mamap22detail Namespace Reference

Classes

struct  Mamap22RepairCoef
 The bilinear program's data: (q_a, q_b) = alpha + beta x + gamma q_free, and q_free (d1 x + d0) = n2 x^2 + n1 x + n0 + c s. More...
struct  Mamap22RepairSide
 The optimum of one side of the repair. More...
struct  Mamap22RepairChoice
 What the hybrid selector chose: the trivial marking q1 = q2 = q3 = p, or the closed-form inverse evaluated at (x, s). More...

Functions

std::vector< double > real_roots (const std::vector< double > &cin)
 Real roots of c[0] + c[1] x + c[2] x^2 + c[3] x^3 (degree <= 3; shorter inputs are zero padded).
std::vector< double > polymul (const std::vector< double > &a, const std::vector< double > &b)
 Product of two coefficient vectors (lowest degree first).
std::vector< double > polysub (const std::vector< double > &a, const std::vector< double > &b)
 Difference of two coefficient vectors (lowest degree first).
bool repair_evaluate (const Mamap22RepairCoef &k, double X, double St, double wx, double ws, double xlo, double xhi, double xin, double *obj, double *xout, double *sout)
 Inner problem of the repair at a fixed x; false when x is infeasible.
Mamap22RepairSide bilinear_repair (const Mamap22RepairCoef &k, double X, double St, double wx, double ws, double xlo, double xhi)
 Global optimum of the hybrid-space repair on xlo <= x <= xhi (xhi may be +infinity).
Mamap22RepairChoice hybrid_repair (const Mamap22RepairCoef &k, double X, double St, double wx, double ws, double M1, double p0)
 The reference's solve_nonlinear('hybrid'): trivial vs left vs right.

Function Documentation

◆ bilinear_repair()

◆ hybrid_repair()

Mamap22RepairChoice line::mam::mamap22detail::hybrid_repair ( const Mamap22RepairCoef & k,
double X,
double St,
double wx,
double ws,
double M1,
double p0 )
inline

The reference's solve_nonlinear('hybrid'): trivial vs left vs right.

The left side keeps the moment in [0, M1 - tol], the right side in [M1 + tol, +inf), and the trivial marking (all p0: moment M1, sigma p0^2) wins ties. An infeasible side scores +infinity, so a feasible side is never preferred over a better trivial marking merely because the other side is infeasible.

Definition at line 298 of file mamap22_repair.h.

References bilinear_repair(), line::mam::mamap22detail::Mamap22RepairSide::feasible, hybrid_repair(), line::mam::mamap22detail::Mamap22RepairSide::obj, line::mam::mamap22detail::Mamap22RepairChoice::s, line::mam::mamap22detail::Mamap22RepairSide::s, line::mam::mamap22detail::Mamap22RepairChoice::trivial, line::mam::mamap22detail::Mamap22RepairChoice::x, and line::mam::mamap22detail::Mamap22RepairSide::x.

Referenced by hybrid_repair(), line::mam::mamap22_fit_bs_multiclass(), and line::mam::mamap22_fit_fs_multiclass().

◆ polymul()

std::vector< double > line::mam::mamap22detail::polymul ( const std::vector< double > & a,
const std::vector< double > & b )
inline

Product of two coefficient vectors (lowest degree first).

Definition at line 141 of file mamap22_repair.h.

References polymul().

Referenced by bilinear_repair(), and polymul().

◆ polysub()

std::vector< double > line::mam::mamap22detail::polysub ( const std::vector< double > & a,
const std::vector< double > & b )
inline

Difference of two coefficient vectors (lowest degree first).

Definition at line 149 of file mamap22_repair.h.

References polysub().

Referenced by bilinear_repair(), and polysub().

◆ real_roots()

std::vector< double > line::mam::mamap22detail::real_roots ( const std::vector< double > & cin)
inline

Real roots of c[0] + c[1] x + c[2] x^2 + c[3] x^3 (degree <= 3; shorter inputs are zero padded).

Leading coefficients negligible against the largest one are dropped; the cubic is solved by Cardano/Viete and every root polished by two Newton steps. Empty for the zero (or constant) polynomial.

Definition at line 85 of file mamap22_repair.h.

References real_roots().

Referenced by bilinear_repair(), and real_roots().

◆ repair_evaluate()

bool line::mam::mamap22detail::repair_evaluate ( const Mamap22RepairCoef & k,
double X,
double St,
double wx,
double ws,
double xlo,
double xhi,
double xin,
double * obj,
double * xout,
double * sout )
inline