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

Nearest AMAP(2)-feasible (M2, M3, GAMMA) (matlab/lib/m3a/m3a/amap2/amap2_adjust_gamma.m). More...

#include <cstddef>
#include <vector>
#include "line/api/mam/amap2_fitall_gamma.h"
#include "line/api/mam/aph2_adjust.h"
#include "line/api/mam/map_fit_detail.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for amap2_adjust_gamma.h:

Go to the source code of this file.

Classes

struct  line::mam::Amap2AdjustGammaResult< T >
 Result of amap2_adjust_gamma. More...

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::mam

Functions

template<class T>
bool line::mam::amap2_gamma_feasible (const T &M1, const T &M2, const T &M3, const T &GAMMA, const T &slack)
 Is (M1, M2, M3, GAMMA) AMAP(2)-feasible?
template<class T>
Amap2AdjustGammaResult< T > line::mam::amap2_adjust_gamma (const T &M1, const T &M2, const T &M3, const T &GAMMA, const std::vector< T > &weights, int method, int constraints, const T &tol)
 Nearest AMAP(2)-feasible characteristics.
template<class T>
Amap2AdjustGammaResult< T > line::mam::amap2_adjust_gamma (const T &M1, const T &M2, const T &M3, const T &GAMMA)
 amap2_adjust_gamma with the reference defaults: weights (10,1,10), method 3, constraints 2.
template<class T>
Amap2AdjustGammaResult< T > line::mam::amap2_adjust_gamma (const T &M1, const T &M2, const T &M3, const T &GAMMA, int method)
 amap2_adjust_gamma with a chosen method and the remaining reference defaults.

Detailed Description

Nearest AMAP(2)-feasible (M2, M3, GAMMA) (matlab/lib/m3a/m3a/amap2/amap2_adjust_gamma.m).

M1 is always feasible on its own, so only the second and third moments and the autocorrelation decay rate GAMMA are adjusted. The reference offers four methods, which trade fidelity between the three characteristics:

1 joint search over (M2, M3, GAMMA) minimizing the weighted relative deviation, subject to the theoretical AMAP(2) feasibility region; 2 M2 forced feasible in closed form, then a search over (M3, GAMMA); 3 (the reference default) strict priority M2 > M3 > GAMMA: apply the closed-form APH(2) adjustment of aph2_adjust to (M2, M3), then clamp GAMMA into the interval that pair admits. No optimizer at all; 4 strict priority M2 > GAMMA > M3: M2 is forced feasible, then M3 is chosen inside its feasible interval to minimize a weighted objective in which GAMMA is always clamped to the interval implied by M3.

The feasibility region and the GAMMA interval are those of Casale, Zhang and Smirni's AMAP(2) characterization, transcribed from the reference's compute_gamma_bounds and nonlcon_theoretical.

ONE SEARCH IN FOUR CODEBASES. Methods 1, 2 and 4 used to run patternsearch and PSwarm in MATLAB and a different optimizer in each port. They now run one hand-written deterministic search, transcribed expression by expression in MATLAB, the JAR, Python and here, so the four agree up to floating-point rounding (fitdetail::amap2_golden1d and its callers below):

  • for fixed (M2, M3) the feasible GAMMA set is an interval and the objective is separable, so the optimal GAMMA is the target clamped into it; GAMMA is eliminated exactly;
  • method 2 and 4 then search M3 in one dimension; method 1 searches M2 and, for every M2, M3 (nested);
  • every 1-D search evaluates 101 equispaced points (strict < keeps the earliest on ties), then runs 60 golden-section steps in the bracket of the best grid point's neighbours and keeps the golden point only if it is strictly better;
  • unbounded or wide intervals are cut with the objective F of a closed-form feasible incumbent: no point whose own term exceeds F can be optimal (1% margin). Incumbents: the method-3 point (method 1), the reference start FM3 (method 2), M3_lb + tol (method 4). An already-feasible triple is returned unchanged (its incumbent objective is zero, so the intervals collapse onto the targets). An infeasible point is an ok=false value, never a sentinel number, since T may be multiprecision.

ON THE constraints ARGUMENT. constraints = 2 (default) is the theoretical region above. constraints = 1, for methods 1 and 2, additionally rejects a point at which amap2_fitall_gamma returns no AMAP(2). The reference used to call amap2_fit_decay there, which exists in no codebase, so the option was unusable in MATLAB; all four codebases now apply the same filter on top of the theoretical region. Methods 3 and 4 never read it.

Gated on transcendental arithmetic: square roots in the bounds and tolerance-driven optimization.

Definition in file amap2_adjust_gamma.h.