Package jline.opt

Class LqnAdapter

java.lang.Object
jline.opt.LqnAdapter

public final class LqnAdapter extends Object
LayeredNetwork (LQN) support for line-opt. Mirrors native-Python line_solver.opt.layered.

line-opt's core (OptimizationProblem/LineEvaluator/ decision variables/LineOptSolver) was written for the flat Network: it copies the model, solves it with SolverAUTO, and reads a per-(station, class) average table. A LayeredNetwork cannot go through that path -- it is an ensemble of per-layer submodels, solved by SolverLN into a per-LQN-node average table (Node, NodeType, QLen, Util, RespT, ResidT, ArvR, Tput). This class is the adapter that lets the same optimizer drive an LQN: element resolution by name in a per-evaluation model copy, a quiet SolverLN factory, and a reshape of SolverLN's per-layer service-rate sensitivity table.

IMPORTANT (see LayeredNetworkSensitivityTable): the per-layer table holds WITHIN-LAYER PARTIAL derivatives, taken with the fixed-point layer parameters held constant. It omits the cross-layer coupling term, so it is a biased estimate of the total derivative of the solved layered model. The optimizer's lqn_gradient='fd' mode finite-differences the whole LayeredNetwork instead (correct total derivative); partial_sens uses this table directly (cheap, biased); partial_plus_fd corrects it with a periodic full-model finite difference.

  • Method Details

    • isLayered

      public static boolean isLayered(Object model)
      True if the model is a LayeredNetwork (LQN), false for a flat Network.
    • resolveActivity

      public static Activity resolveActivity(LayeredNetwork model, String name)
      Resolve an Activity by name inside a (possibly copied) LQN model.
    • resolveTask

      public static Task resolveTask(LayeredNetwork model, String name)
      Resolve a Task by name inside a (possibly copied) LQN model.
    • resolveProcessor

      public static Host resolveProcessor(LayeredNetwork model, String name)
      Resolve a Processor by name inside a (possibly copied) LQN model. The LQN has no getProcessors(); processors are the Processor entries among the hosts, so this matches by name over getHosts().
    • activityProcessorName

      public static String activityProcessorName(LayeredNetwork model, String activityName)
      Name of the processor an activity ultimately runs on (Activity -> parent Task -> deployed Processor), or null if the chain is incomplete. Used both to tag a HostDemand variable with the host layer it perturbs and to key its row in the per-layer sensitivity table, whose host-layer rows are (Layer=processor, Station=processor, JobClass=activity).
    • taskProcessorName

      public static String taskProcessorName(LayeredNetwork model, String taskName)
      Name of the processor a task is deployed on (null if undeployed).
    • makeLqnSolver

      public static SolverLN makeLqnSolver(LayeredNetwork model)
      Construct a quiet SolverLN for a per-evaluation LQN model copy. Silences the layer/avg-table printing so an optimization run of thousands of solves does not flood stdout.
    • computeLqnSensitivities

      public static Map<String,Map<String,Double>> computeLqnSensitivities(SolverLN solver)
      Reshape SolverLN's per-layer service-rate sensitivity table into {station||jobclass: {Tput,RespT,QLen,Util}}, each value the derivative of that layer row's mean measure with respect to that station-class service RATE. Returns null if the table is unavailable. See the class docstring for the partial-vs-total caveat.