Package jline.api.lqn

Class Lqn_export_nlp

java.lang.Object
jline.api.lqn.Lqn_export_nlp

public final class Lqn_export_nlp extends Object
A layered queueing network as ONE nonlinear program: linear constraints over the flows, the service-time composition and the closures, plus a sum-of-squares objective over the QD-AMVA congestion and Little laws, zero at the fixed point.

Twin of python's line_solver.api.lqn.lqn_export_nlp. Python EMITS the program as a standalone script; that part is python-only by design, and this class builds the SAME PROGRAM in memory instead: the same variable layout (Xe, Xa, Xc, W, S, R, Q, Qt, BC, BR, GH, GT, SA, in that order), the same rows of AEQ and AUB in the same order, the same residuals in the same order, and the same refusals, so the solution vector is comparable component by component. The laws, the counting argument and the AND-fork closure are documented in the python module docstring and in _kb/03-api-layer.md.

The rate functions are differentiated by COMPLEX STEP over LqnNlpComplex, as python differentiates them, and a declared queue-dependent multiplier is an expression in n of the shared grammar of LqnLld.

ONE DOCUMENTED DIVERGENCE: when the Newton ladder finds no root, python falls back to scipy's trust-constr; this port, like the MATLAB and C++ ones, falls back to a projected Levenberg-Marquardt descent on the same merit (Lqn_export_nlp.Program.lmFallback(double[], int)), then polishes. No model the ladder solves reaches either.

  • Field Details

    • FORK_MODES

      public static final String[] FORK_MODES
      What fork accepts.
  • Method Details

    • build

      public static Lqn_export_nlp.Program build(LayeredNetworkStruct lqn)
      The program of a model with no declared rate multiplier, alpha 20, forks refused.
    • build

      public static Lqn_export_nlp.Program build(LayeredNetwork model)
      The program of a model with no declared rate multiplier, alpha 20, forks refused.
    • build

      public static Lqn_export_nlp.Program build(LayeredNetwork model, Map<String,?> lld, double alpha, String fork)
    • build

      public static Lqn_export_nlp.Program build(LayeredNetworkStruct lqn, Map<String,?> lld, double alpha, String fork)
      Build the nonlinear program of a layered model.
      Parameters:
      lqn - the layered struct
      lld - queue-dependent rate multipliers, {station name: expression in n}, or null
      alpha - sharpness of the softmin standing in for min(n, m)
      fork - "refuse" or "exp", how to treat an AND-fork/join block
      Returns:
      the program
      Throws:
      LqnNlpExportException - when the model uses a feature the form cannot express
    • softmin

      public static LqnNlpComplex softmin(LqnNlpComplex a, LqnNlpComplex b, double alpha)
      Python's softmin, over complex so the rate functions differentiate by complex step.
    • pyTypeName

      public static String pyTypeName(Object o)
      Python's type(x).__name__ for the values a config can carry.
    • drate

      public static double drate(Lqn_export_nlp.Rate f, double n)
      Derivative of a rate function by complex step, python's drate.
    • fjMaxExp

      public static double fjMaxExp(double[] m)
      E[max] of K independent EXPONENTIAL branch completion times of means m, python's fj_max_exp: the inclusion-exclusion sum with the reciprocals cleared.
    • mgrad

      public static double[] mgrad(double[] u)
      Gradient of fjMaxExp(double[]) by complex step per coordinate, python's mgrad.