Class Mapqn_qrf_noblo_mmi
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbetheGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR) Gradient ofbetheObjective(double[], int, int, int[], int, int[], int), accumulated intograd.static doublebetheObjective(double[] x, int M, int N, int[] K, int Kmax, int[] F, int MR) Tree-reweighted (Bethe) free entropy at the uniform spanning-tree weight, the objective ofqrf.bethe.buildConstraints(double[][][][] q, int M, int MR, double[][] BB, int[] F, int N, int[] K, int Kmax, int numVars) Population-free form, matching the q of qrboundsbas_skel.mod.buildConstraintsLd(double[][][][][] q, int M, int MR, double[][] BB, int[] F, int N, int[] K, int Kmax, int numVars) Load-dependent form, matching the five-index q of qrboundsrsrd_skel.mod:11 whose last index is the population of the EMITTING station.static intcomputeNumVars(int M, int N, int Kmax, int MR) static inteIndex(int i, int k, int M, int N, int Kmax, int MR) static Mapqn_solutionextractResults(double[] xOpt, int M, int N, int[] K, int Kmax, int[] F, int MR) static Mapqn_solutionextractResults(double[] xOpt, int M, int N, int[] K, int Kmax, int[] F, int MR, double[][] alpha) The diagonal marginals of the optimal tensor, plus the ALPHA-WEIGHTED mean BN_i when a load-dependent scaling is given.static voidmemGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR) Gradient ofmemObjective(double[], int, int, int[], int, int[], int), accumulated intograd.static doublememObjective(double[] x, int M, int N, int[] K, int Kmax, int[] F, int MR) Maximum-entropy objective, returned as the NEGATIVE entropy of the per-station marginals because the solver MINIMIZES and the AMPL model states it asmaximize H.static voidmmiGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR) Gradient ofmmiObjective(double[], int, int, int[], int, int[], int), accumulated intograd.static doublemmiObjective(double[] x, int M, int N, int[] K, int Kmax, int[] F, int MR) Mutual-information objective, read straight off the flat variable vector.static intp2Index(int j, int nj, int k, int i, int ni, int h, int m, int M, int N, int Kmax, int MR) static Mapqn_solutionsolve(int M, int MR_input, int[] K, int N, double[][][] mu, double[][][] v, double[][] rt) static Double[][][][][][][]unflattenP2(double[] x, int M, int N, int Kmax, int MR)
-
Method Details
-
solve
public static Mapqn_solution solve(int M, int MR_input, int[] K, int N, double[][][] mu, double[][][] v, double[][] rt) -
mmiObjective
public static double mmiObjective(double[] x, int M, int N, int[] K, int Kmax, int[] F, int MR) Mutual-information objective, read straight off the flat variable vector.Shared by
qrf.mmiandqrf.mmi.ld: the two differ in their constraint matrices (load dependence enters q), not in the objective. Working on the flat array avoids rebuilding the seven-level boxed array on every evaluation, which the line search performs tens of times per iteration. -
mmiGradient
public static void mmiGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR) Gradient ofmmiObjective(double[], int, int, int[], int, int[], int), accumulated intograd.For a term
t = pij (log pij - log pii - log pjj)the three partials aredt/dpij = log pij - log pii - log pjj + pij/pij',dt/dpii = -pij/pii'anddt/dpjj = -pij/pjj', with a primed denominator standing for the LOGTOL-shifted value. The joint variable pij is distinct from both marginals because i != j, so no term aliases its own partials. -
memObjective
public static double memObjective(double[] x, int M, int N, int[] K, int Kmax, int[] F, int MR) Maximum-entropy objective, returned as the NEGATIVE entropy of the per-station marginals because the solver MINIMIZES and the AMPL model states it asmaximize H. Returning+H(as every port did until 2026-08-29) selects the minimum-entropy face of the polytope instead, under a method documented as maximum-entropy. -
memGradient
public static void memGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR) Gradient ofmemObjective(double[], int, int, int[], int, int[], int), accumulated intograd. -
betheObjective
public static double betheObjective(double[] x, int M, int N, int[] K, int Kmax, int[] F, int MR) Tree-reweighted (Bethe) free entropy at the uniform spanning-tree weight, the objective ofqrf.bethe.With
lambda = 1/Mthis islambda*sum_{i!=j} I(n_i;n_j) - sum_i H(n_i), the NEGATIVE of a tree-reweighted entropy with uniform edge weightrho_ij = 2*lambdaon the complete station graph.H_rhois a convex combination of tree entropies -- hence concave on the local marginal polytope -- exactly when rho lies in the spanning tree polytope of K_M, whose uniform point isrho_ij = 2/M. Solambda = 1/Mis the largest uniform weight for which minimising this is a CONVEX program: every local optimum is global and the answer stops depending on the start point. The Bethe weightlambda = 1/2is outside that polytope for every M > 2.Two differences from
mmiObjective(double[], int, int, int[], int, int[], int), both deliberate. The population loops start atn = 0, the range the AMPL source states (ni, nj in 0..F) and the onemmiObjectivedoes not use, so the idle/idle cell is inside the sum; and the entropy term ismemObjective(double[], int, int, int[], int, int[], int)'s body over the same restored range, which already carries the sign a minimiser needs. Neither repair touchesqrf.mmiorqrf.mem, whose values are pinned by tests. -
betheGradient
public static void betheGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR) Gradient ofbetheObjective(double[], int, int, int[], int, int[], int), accumulated intograd.df/dp_ij = lambda*(log p_ij' + p_ij/p_ij' - log p_ii' - log p_jj')fori != j, anddf/dp_ii = log p_ii' + p_ii/p_ii' - (lambda/p_ii')*sum_{j!=i,kj,nj}(p_ij + p_ji), a primed denominator standing for the LOGTOL-shifted value. The second sum is accumulated by the scatter below, which visits both orderings of every pair. -
computeNumVars
public static int computeNumVars(int M, int N, int Kmax, int MR) -
p2Index
public static int p2Index(int j, int nj, int k, int i, int ni, int h, int m, int M, int N, int Kmax, int MR) -
eIndex
public static int eIndex(int i, int k, int M, int N, int Kmax, int MR) -
unflattenP2
-
extractResults
public static Mapqn_solution extractResults(double[] xOpt, int M, int N, int[] K, int Kmax, int[] F, int MR) -
extractResults
public static Mapqn_solution extractResults(double[] xOpt, int M, int N, int[] K, int Kmax, int[] F, int MR, double[][] alpha) The diagonal marginals of the optimal tensor, plus the ALPHA-WEIGHTED mean BN_i when a load-dependent scaling is given.BN is the mean number of jobs actually in service: E[min(n,c)] at a c-server station, E[n] at a delay and P(n >= 1) where alpha is 1. It is what the departure rate is proportional to, since alpha(i,n) scales the completion rate, so a station's throughput is BN/stime exactly at the relaxed point. With a null alpha it equals UN, which is why the alpha-free arms need no separate readout.
- Parameters:
alpha- (M x N) load-dependent scaling, or null for load independent
-
buildConstraints
public static Mapqn_qrf_noblo_mmi.ConstraintSet buildConstraints(double[][][][] q, int M, int MR, double[][] BB, int[] F, int N, int[] K, int Kmax, int numVars) Population-free form, matching the q of qrboundsbas_skel.mod. Used by the qrf_noblo_mmi / qrf_noblo_mem variants, which have no load dependence. -
buildConstraintsLd
public static Mapqn_qrf_noblo_mmi.ConstraintSet buildConstraintsLd(double[][][][][] q, int M, int MR, double[][] BB, int[] F, int N, int[] K, int Kmax, int numVars) Load-dependent form, matching the five-index q of qrboundsrsrd_skel.mod:11 whose last index is the population of the EMITTING station. A 4D q cannot represent load dependence: the balance families would be unable to tell the rate at which station i empties at population n from the rate at n'.
-