Class Mapqn_qrf_noblo_mmi

java.lang.Object
jline.api.mapqn.Mapqn_qrf_noblo_mmi

public final class Mapqn_qrf_noblo_mmi extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    betheGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR)
    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 of qrf.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 int
    computeNumVars(int M, int N, int Kmax, int MR)
     
    static int
    eIndex(int i, int k, int M, int N, int Kmax, int MR)
     
    extractResults(double[] xOpt, int M, int N, int[] K, int Kmax, int[] F, int MR)
     
    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.
    static void
    memGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR)
    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 as maximize H.
    static void
    mmiGradient(double[] x, double[] grad, int M, int N, int[] K, int Kmax, int[] F, int MR)
    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.
    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)
     
    solve(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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.mmi and qrf.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 of mmiObjective(double[], int, int, int[], int, int[], int), accumulated into grad.

      For a term t = pij (log pij - log pii - log pjj) the three partials are dt/dpij = log pij - log pii - log pjj + pij/pij', dt/dpii = -pij/pii' and dt/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 as maximize 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)
    • 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 of qrf.bethe.

      With lambda = 1/M this is lambda*sum_{i!=j} I(n_i;n_j) - sum_i H(n_i), the NEGATIVE of a tree-reweighted entropy with uniform edge weight rho_ij = 2*lambda on the complete station graph. H_rho is 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 is rho_ij = 2/M. So lambda = 1/M is 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 weight lambda = 1/2 is outside that polytope for every M > 2.

      Two differences from mmiObjective(double[], int, int, int[], int, int[], int), both deliberate. The population loops start at n = 0, the range the AMPL source states (ni, nj in 0..F) and the one mmiObjective does not use, so the idle/idle cell is inside the sum; and the entropy term is memObjective(double[], int, int, int[], int, int[], int)'s body over the same restored range, which already carries the sign a minimiser needs. Neither repair touches qrf.mmi or qrf.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 of betheObjective(double[], int, int, int[], int, int[], int), accumulated into grad.

      df/dp_ij = lambda*(log p_ij' + p_ij/p_ij' - log p_ii' - log p_jj') for i != j, and df/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

      public static Double[][][][][][][] unflattenP2(double[] x, int M, int N, int Kmax, int MR)
    • 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'.