Package jline.io

Class Ret.SampleResult

java.lang.Object
jline.io.Ret.SampleResult
Enclosing class:
Ret

public static class Ret.SampleResult extends Object
Unified result type for sampling and simulation in queueing network solvers.

This class provides a standardized interface for returning sampled trajectories from various sampling methods including:

  • Discrete-event simulation
  • Perfect sampling
  • Time-averaged sampling
  • Single-node or system-wide sampling

The state trajectory can be either a single matrix (for node-specific sampling) or a list of matrices (for system-wide sampling), allowing flexible representation of different sampling scenarios.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Event sequence corresponding to the state trajectory.
    Handle or identifier for the sampling method used.
    boolean
    Indicates whether the result uses aggregated states.
    The node index for single-node sampling (null for system-wide sampling).
    int
    Number of samples generated.
    State trajectory.
    Time points for the sampled trajectory.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    SampleResult(String handle, Matrix t, List<Matrix> systemState, Matrix event, boolean isAggregate, int numEvents)
    Constructor for system-wide sampling results.
    SampleResult(String handle, Matrix t, Matrix state, Matrix event, boolean isAggregate, Integer nodeIndex, int numEvents)
    Constructor for single-node sampling results.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    The code the event matrix stores for this event type.
    boolean[]
    filterEvents(int nodeIndex, EventType type)
    Returns a boolean mask selecting the events of the given type that occur at the given node.
    getEvent(int i)
    Returns the i-th sampled event (0-based) as an Event.
    double[]
    getFilteredEventTimes(boolean[] mask)
    Returns the timestamps of the events selected by the given mask.
    int
    Number of columns in the event matrix (>1 when event data is available).
    int
    Number of sampled events (rows in the event matrix).
    Gets the state trajectory as a matrix (for single-node sampling).
    Gets the system state trajectories as a list of matrices (for system-wide sampling).
    boolean
    Checks if this result contains valid sample data.
    boolean
    Checks if this is a system-wide sampling result.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • handle

      public String handle
      Handle or identifier for the sampling method used.
    • t

      public Matrix t
      Time points for the sampled trajectory.
    • state

      public Object state
      State trajectory. For single node sampling, this is a matrix. For system sampling, this is a list of matrices (one per node).
    • event

      public Matrix event
      Event sequence corresponding to the state trajectory.
    • isAggregate

      public boolean isAggregate
      Indicates whether the result uses aggregated states.
    • nodeIndex

      public Integer nodeIndex
      The node index for single-node sampling (null for system-wide sampling).
    • numEvents

      public int numEvents
      Number of samples generated.
  • Constructor Details

    • SampleResult

      public SampleResult()
      Default constructor.
    • SampleResult

      public SampleResult(String handle, Matrix t, Matrix state, Matrix event, boolean isAggregate, Integer nodeIndex, int numEvents)
      Constructor for single-node sampling results.
      Parameters:
      handle - the sampling method handle
      t - time points
      state - state trajectory matrix
      event - event sequence
      isAggregate - whether states are aggregated
      nodeIndex - the node index
      numEvents - number of samples
    • SampleResult

      public SampleResult(String handle, Matrix t, List<Matrix> systemState, Matrix event, boolean isAggregate, int numEvents)
      Constructor for system-wide sampling results.
      Parameters:
      handle - the sampling method handle
      t - time points
      systemState - list of state trajectories (one per node)
      event - event sequence
      isAggregate - whether states are aggregated
      numEvents - number of samples
  • Method Details

    • getNumRows

      public int getNumRows()
      Number of sampled events (rows in the event matrix).
    • getNumCols

      public int getNumCols()
      Number of columns in the event matrix (>1 when event data is available).
    • codeOf

      public static int codeOf(EventType type)
      The code the event matrix stores for this event type.
      Parameters:
      type - the event type to encode
      Returns:
      its code, for the third column of the event matrix
      Throws:
      IllegalArgumentException - when the type has no code, which is a missing entry in EVENT_CODES and not a property of the run
    • getEvent

      public Event getEvent(int i)
      Returns the i-th sampled event (0-based) as an Event.

      The event matrix stores one row per event with columns [time, node, eventType], and a fourth jobclass column where the producer knows it. A three-column matrix reports class 0, which is what every reader saw before the column existed.

    • filterEvents

      public boolean[] filterEvents(int nodeIndex, EventType type)
      Returns a boolean mask selecting the events of the given type that occur at the given node.
    • getFilteredEventTimes

      public double[] getFilteredEventTimes(boolean[] mask)
      Returns the timestamps of the events selected by the given mask.
    • getStateMatrix

      public Matrix getStateMatrix()
      Gets the state trajectory as a matrix (for single-node sampling).
      Returns:
      the state trajectory matrix
      Throws:
      IllegalStateException - if this is a system-wide sampling result
    • getSystemStateList

      public List<Matrix> getSystemStateList()
      Gets the system state trajectories as a list of matrices (for system-wide sampling).
      Returns:
      the list of state trajectory matrices
      Throws:
      IllegalStateException - if this is a single-node sampling result
    • isSystemWide

      public boolean isSystemWide()
      Checks if this is a system-wide sampling result.
      Returns:
      true if this is a system-wide sampling result
    • hasValidSamples

      public boolean hasValidSamples()
      Checks if this result contains valid sample data.
      Returns:
      true if the result contains valid samples