Class HostDemand


public class HostDemand extends LqnDecisionVariable
Optimize the mean host demand of an LQN Activity (continuous). The host demand D is the mean service requirement the activity places on its processor; the processor-layer service rate is mu = 1/D. This is the primary LQN tuning knob (analogous to ServiceRate for a flat station). It exposes the hooks the partial-sensitivity gradient path needs (sensKeys(jline.lang.layered.LayeredNetwork), sensMetricTargets(jline.lang.layered.LayeredNetwork), rateJacobian(double), decodeJacobian(double[])). Mirrors native-Python HostDemand.
  • Constructor Details

    • HostDemand

      public HostDemand(Activity activity, double minDemand, double maxDemand)
    • HostDemand

      public HostDemand(Activity activity, double minDemand, double maxDemand, String name)
    • HostDemand

      public HostDemand(String activityName, double minDemand, double maxDemand)
    • HostDemand

      public HostDemand(String activityName, double minDemand, double maxDemand, String name)
  • Method Details

    • getActivity

      public String getActivity()
    • getBounds

      public double[][] getBounds()
      Description copied from class: DecisionVariable
      Bounds per encoded dimension, each {low, high}. Standard is {0,1}.
      Specified by:
      getBounds in class DecisionVariable
    • decode

      public Object decode(double[] x)
      Description copied from class: DecisionVariable
      Decode the encoded slice (length DecisionVariable.getDimension()) to a value.
      Specified by:
      decode in class DecisionVariable
    • applyLqn

      public void applyLqn(LayeredNetwork model, Object value)
      Description copied from class: LqnDecisionVariable
      Apply a decoded value to a (copied) LayeredNetwork model.
      Specified by:
      applyLqn in class LqnDecisionVariable
    • getVariableType

      public String getVariableType()
      Description copied from class: DecisionVariable
      Type identifier used by decomposition and the gradient dispatcher.
      Specified by:
      getVariableType in class DecisionVariable
    • getLayer

      public List<String> getLayer(Object model)
      Description copied from class: DecisionVariable
      LQN layer name(s) this variable perturbs, or null for flat-network variables. Used by layer freezing (both explicit frozen_layers and adaptive auto_freeze): a variable whose layer set intersects the frozen set is held fixed. The model argument is the LayeredNetwork the variable is applied to. LQN variable subclasses override this.
      Overrides:
      getLayer in class DecisionVariable
    • currentValue

      public Object currentValue(Object model)
      Description copied from class: DecisionVariable
      The variable's current (decoded) value in the given model, or null. Used by layer freezing to hold a variable at the model's existing parameter value. Flat and non-introspectable variables return null. LQN variable subclasses override this.
      Overrides:
      currentValue in class DecisionVariable
    • sensKey

      public String sensKey(LayeredNetwork model)
      Row key station||jobclass in the per-layer sensitivity table, in the 'srvn.cs' spelling (sensKeys(jline.lang.layered.LayeredNetwork) is what the caller reads). The host-layer rows are (Layer=processor, Station=processor, JobClass=activity); the sensitivity value is d(metric)/d(service rate). Returns null if the activity is not deployed on a processor.
    • sensKeys

      public List<String> sensKeys(LayeredNetwork model)
      Candidate row keys of this variable, most specific first. The LN method decides how a host layer names its classes: 'srvn.cs' after the ACTIVITY, 'srvn.ph' (what the 'srvn' default resolves to on every model that admits it) collapses each caller into ONE phase-type class named after the TASK. Both spellings are returned so the gradient reads the table the solver actually produced. The task row is coarser (one row for every activity of the task), a further bias that 'fd'/'partial_plus_fd' correct. Mirrors native-Python HostDemand.sensKeys and C++ sensitivity_keys. Empty if the activity is not deployed on a processor.
    • sensMetricTargets

      public Map<String,String> sensMetricTargets(LayeredNetwork model)
      Map each layer-row metric to the EvaluationResult key it approximates. The host-layer row's utilization tracks the processor node's utilization; its throughput/queue-length/response-time track the activity node's. Util is keyed by node name, the others by node||node.
    • rateJacobian

      public double rateJacobian(double value)
      d(service rate)/d(demand) = d(1/D)/dD = -1/D^2 at demand D=value.
    • decodeJacobian

      public double decodeJacobian(double[] x)
      d(decoded demand)/d(encoded x): constant slope of the linear map.