Class Node

All Implemented Interfaces:
Serializable, Copyable
Direct Known Subclasses:
ClassSwitch, Fork, Logger, Sink, StatefulNode

public class Node extends NetworkElement implements Serializable
Superclass for a node element within a Network model
See Also:
  • Field Details

    • model

      public Network model
    • input

      protected InputSection input
    • output

      protected OutputSection output
    • server

      protected ServiceSection server
    • dropStrategy

      protected DropStrategy dropStrategy
    • statefulIdx

      protected int statefulIdx
    • nodeIndex

      protected int nodeIndex
    • stationIdx

      public int stationIdx
    • state

      protected Matrix state
  • Constructor Details

    • Node

      public Node(String nodeName)
      Creates a new node with the specified name. Initializes default routing and service configurations.
      Parameters:
      nodeName - the name for this node
  • Method Details

    • getAttribute

      public NodeAttribute getAttribute()
      Gets the attribute object containing additional metadata for this node.
      Returns:
      the node attribute object
    • getCap

      public double getCap()
      Returns the total capacity limit for this node. Default implementation returns infinite capacity.
      Returns:
      the total capacity limit
    • getClassCap

      public double getClassCap(JobClass jobClass)
      Returns the capacity limit for a specific job class at this node. Default implementation returns infinite capacity.
      Parameters:
      jobClass - the job class to query
      Returns:
      the capacity limit for the job class
    • getDropStrategy

      public DropStrategy getDropStrategy()
      Gets the drop strategy used by this node when capacity limits are exceeded.
      Returns:
      the drop strategy
    • getInput

      public InputSection getInput()
      Gets the input section that handles incoming jobs to this node.
      Returns:
      the input section
    • getModel

      public Network getModel()
      Returns the network model containing this node.
      Returns:
      the parent network model
    • setModel

      public void setModel(Network model)
      Sets the network model containing this node.
      Parameters:
      model - the parent network model
    • getNodeIndex

      public int getNodeIndex()
      Gets the index of this node in the network's node collection. The index is lazily computed if not already set.
      Returns:
      the node index
    • setNodeIdx

      public void setNodeIdx(int index)
      Sets the index of this node in the network's node collection.
      Parameters:
      index - the node index to set
    • getOutput

      public OutputSection getOutput()
      Gets the output section that handles job routing from this node.
      Returns:
      the output section
    • getOutputStrategies

      public List<OutputStrategy> getOutputStrategies()
      Returns the list of output strategies configured for this node.
      Returns:
      list of output routing strategies
    • getRoutingStrategy

      public RoutingStrategy getRoutingStrategy(JobClass jobClass)
      Returns the routing strategy configured for a specific job class.
      Parameters:
      jobClass - the job class to query
      Returns:
      the routing strategy, or RAND if none specified
    • getSections

      public List<Section> getSections()
      Gets all sections (input, server, output) that compose this node.
      Returns:
      list containing all node sections
    • getServer

      public ServiceSection getServer()
      Gets the service section that handles job processing at this node.
      Returns:
      the service section
    • getStatefulIdx

      public int getStatefulIdx()
      Gets the index of this node in the network's stateful node collection. Returns -1 if this node is not stateful.
      Returns:
      the stateful node index, or -1 if not stateful
    • getStationIdx

      public int getStationIdx()
      Gets the index of this node in the network's station collection. The index is lazily computed if not already set.
      Returns:
      the station index
    • setStationIdx

      public void setStationIdx(int index)
      Sets the index of this node in the network's station collection.
      Parameters:
      index - the station index to set
    • isReferenceStation

      public boolean isReferenceStation()
      Checks if this node is a reference station. Default implementation returns false; override in subclasses as needed.
      Returns:
      true if this is a reference station, false otherwise
    • isStateful

      public boolean isStateful()
      Checks if this node maintains state between job visits.
      Returns:
      true if this node is stateful, false otherwise
    • setState

      public void setState(Matrix state)
      Sets the state of this node.
      Parameters:
      state - the state matrix to set
    • getState

      public Matrix getState()
      Gets the current state of this node.
      Returns:
      the current state matrix
    • printSummary

      public void printSummary()
      Prints a summary of this node's configuration to the console.
    • reset

      public void reset()
      Resets the internal state of this node. Called when the network model is reset. Default implementation is no-op; override in subclasses as needed.
    • resetRouting

      public void resetRouting()
      Resets all routing configurations for this node.
    • setProbRouting

      public void setProbRouting(JobClass jobClass, Node destination, double probability)
      Sets probabilistic routing for a job class to a specific destination.
      Parameters:
      jobClass - the job class to configure routing for
      destination - the destination node
      probability - the routing probability (0.0 to 1.0)
    • setRouting

      public void setRouting(JobClass jobClass, RoutingStrategy routingStrategy)
      Sets the routing strategy for a specific job class.
      Parameters:
      jobClass - the job class to configure routing for
      routingStrategy - the routing strategy to use
    • setKChoicesRouting

      public void setKChoicesRouting(JobClass jobClass, int k, boolean withMemory)
      Configures power-of-K-choices routing for a job class.
      Parameters:
      jobClass - the job class
      k - number of randomly chosen destinations (must be >= 1)
      withMemory - whether the strategy keeps memory of past selections
    • setRLRouting

      public void setRLRouting(JobClass jobClass, Matrix valueFunction, int[] vfShape, int[] nodesNeedAction, int stateSize)
      Configures reinforcement-learning routing for a job class. Mirrors the MATLAB output strategy fields used by sub_rl.
      Parameters:
      jobClass - the job class
      valueFunction - flat value function (tabular when stateSize=0, coefficient row vector when stateSize>0)
      vfShape - shape of the tabular value function (per-axis sizes); ignored when stateSize>0
      nodesNeedAction - node indices that consult the value function
      stateSize - 0 = tabular, >0 = linear approximation, <0 = JSQ fallback
    • setRouting

      public void setRouting(JobClass jobClass, RoutingStrategy routingStrategy, Node destination, double probability)
      Sets the routing strategy with destination and probability for a job class.
      Parameters:
      jobClass - the job class to configure routing for
      routingStrategy - the routing strategy to use
      destination - the destination node
      probability - the routing probability to this destination