Class SolverSSA

Direct Known Subclasses:
SSA

public class SolverSSA extends NetworkSolver
  • Field Details

    • threadPool

      public ExecutorService threadPool
    • numThreads

      public int numThreads
    • eventCache

      public EventCache eventCache
  • Constructor Details

  • Method Details

    • getFeatureSet

      public static FeatureSet getFeatureSet()
      Returns the feature set supported by the SSA solver
      Returns:
      - the feature set supported by the SSA solver
    • getEventCache

      public EventCache getEventCache()
    • setEventCache

      public void setEventCache(EventCache eventCache)
    • getNumThreads

      public int getNumThreads()
    • setNumThreads

      public void setNumThreads(int numThreads)
    • getStruct

      public NetworkStruct getStruct()
    • getThreadPool

      public ExecutorService getThreadPool()
    • setThreadPool

      public void setThreadPool(ExecutorService threadPool)
    • listValidMethods

      public List<String> listValidMethods()
    • listValidMethods

      public List<String> listValidMethods(Network model)
    • runAnalyzer

      Description copied from class: Solver
      Executes the solver algorithm to analyze the model. This abstract method must be implemented by concrete solver classes.
      Specified by:
      runAnalyzer in class Solver
      Throws:
      IllegalAccessException - if access to required resources is denied
      ParserConfigurationException - if XML parsing configuration fails
      IOException - if I/O operations fail
    • setParallelism

      public void setParallelism(int numThreads)
    • supports

      public boolean supports(Network model)
      Description copied from class: Solver
      Checks if this solver supports the given network model. Default implementation returns true; subclasses should override to provide specific feature validation.
      Overrides:
      supports in class Solver
      Parameters:
      model - the network model to check
      Returns:
      true if the model is supported, false otherwise
    • sample

      public SampleNodeState sample(Node node, Integer numEvents, boolean markActivePassive) throws Exception
      Sample node state evolution using SSA simulation
      Parameters:
      node - The node to sample from
      numEvents - Number of samples to generate (overrides solver options if provided)
      markActivePassive - Whether to mark events as active/passive
      Returns:
      SampleNodeState containing the sampling results
      Throws:
      Exception - if sampling fails
    • sample

      public SampleNodeState sample(Node node, int numEvents) throws Exception
      Sample node state evolution using SSA simulation
      Parameters:
      node - The node to sample from
      numEvents - Number of samples to generate
      Returns:
      SampleNodeState containing the sampling results
      Throws:
      Exception - if sampling fails
    • sample

      public SampleNodeState sample(Node node) throws Exception
      Sample node state evolution using SSA simulation using default sample count
      Parameters:
      node - The node to sample from
      Returns:
      SampleNodeState containing the sampling results
      Throws:
      Exception - if sampling fails
    • sampleAggr

      public SampleNodeState sampleAggr(Node node, Integer numEvents, boolean markActivePassive) throws Exception
      Sample aggregated node state evolution using SSA simulation
      Parameters:
      node - The node to sample from
      numEvents - Number of samples to generate (overrides solver options if provided)
      markActivePassive - Whether to mark events as active/passive
      Returns:
      SampleNodeState containing the aggregated sampling results
      Throws:
      Exception - if sampling fails
    • sampleAggr

      public SampleNodeState sampleAggr(Node node, int numEvents) throws Exception
      Sample aggregated node state evolution using SSA simulation
      Parameters:
      node - The node to sample from
      numEvents - Number of samples to generate
      Returns:
      SampleNodeState containing the aggregated sampling results
      Throws:
      Exception - if sampling fails
    • sampleAggr

      public SampleNodeState sampleAggr(Node node) throws Exception
      Sample aggregated node state evolution using SSA simulation using default sample count
      Parameters:
      node - The node to sample from
      Returns:
      SampleNodeState containing the aggregated sampling results
      Throws:
      Exception - if sampling fails
    • stream

      public SampleNodeState stream(Node node, StreamingOptions streamingOptions) throws Exception
      Sample node state with real-time streaming to OTLP receiver. Streams phase-detailed state information during simulation.
      Parameters:
      node - The node to sample from
      streamingOptions - Configuration for streaming (endpoint, mode, frequency)
      Returns:
      SampleNodeState containing the sampling results
      Throws:
      Exception - if sampling fails
    • stream

      public SampleNodeState stream(Node node, Integer numEvents, StreamingOptions streamingOptions) throws Exception
      Sample node state with real-time streaming to OTLP receiver. Streams phase-detailed state information during simulation.
      Parameters:
      node - The node to sample from
      numEvents - Number of samples to generate
      streamingOptions - Configuration for streaming (endpoint, mode, frequency)
      Returns:
      SampleNodeState containing the sampling results
      Throws:
      Exception - if sampling fails
    • streamAggr

      public SampleNodeState streamAggr(Node node, StreamingOptions streamingOptions) throws Exception
      Sample aggregated node state with real-time streaming to OTLP receiver. Streams state information aggregated by job class during simulation.
      Parameters:
      node - The node to sample from
      streamingOptions - Configuration for streaming (endpoint, mode, frequency)
      Returns:
      SampleNodeState containing the aggregated sampling results
      Throws:
      Exception - if sampling fails
    • streamAggr

      public SampleNodeState streamAggr(Node node, Integer numEvents, StreamingOptions streamingOptions) throws Exception
      Sample aggregated node state with real-time streaming to OTLP receiver. Streams state information aggregated by job class during simulation.
      Parameters:
      node - The node to sample from
      numEvents - Number of samples to generate
      streamingOptions - Configuration for streaming (endpoint, mode, frequency)
      Returns:
      SampleNodeState containing the aggregated sampling results
      Throws:
      Exception - if sampling fails
    • getStreamingCollector

      public Collector getStreamingCollector()
      Get the active streaming collector (for use by Solver_ssa.kt). Returns null if streaming is not active.
      Returns:
      The active Collector, or null
    • sampleSys

      public Ret.SampleResult sampleSys(int numEvents)
      Sample system-wide state evolution using SSA simulation
      Overrides:
      sampleSys in class NetworkSolver
      Parameters:
      numEvents - Number of samples to generate
      Returns:
      SampleSysState containing the system-wide sampling results
      Throws:
      Exception - if sampling fails
    • sampleSys

      public SampleSysState sampleSys() throws Exception
      Sample system-wide state evolution using SSA simulation using default sample count
      Returns:
      SampleSysState containing the system-wide sampling results
      Throws:
      Exception - if sampling fails
    • sampleSysAggr

      public Ret.SampleResult sampleSysAggr(int numEvents)
      Sample aggregated system-wide state evolution using SSA simulation
      Overrides:
      sampleSysAggr in class NetworkSolver
      Parameters:
      numEvents - Number of samples to generate
      Returns:
      SampleSysState containing the aggregated system-wide sampling results
      Throws:
      Exception - if sampling fails
    • sampleSysAggr

      public SampleSysState sampleSysAggr() throws Exception
      Sample aggregated system-wide state evolution using SSA simulation using default sample count
      Returns:
      SampleSysState containing the aggregated system-wide sampling results
      Throws:
      Exception - if sampling fails
    • getProb

      public double getProb(Node node, Matrix state) throws Exception
      Get probability for a specific node state
      Parameters:
      node - The node to get probability for
      state - The state vector (optional - uses node's default state if null)
      Returns:
      Probability of being in the specified state
      Throws:
      Exception - if probability calculation fails
    • getProb

      public double getProb(Node node) throws Exception
      Get probability for a specific node state using the node's default state
      Parameters:
      node - The node to get probability for
      Returns:
      Probability of being in the node's default state
      Throws:
      Exception - if probability calculation fails
    • getProb

      public Ret.ProbabilityResult getProb(int node, Matrix state)
      Get marginal probability for a specific node state (by node index). This overrides the base NetworkSolver method to use SSA sampling.
      Overrides:
      getProb in class NetworkSolver
      Parameters:
      node - The node index to get probability for
      state - The state vector (optional - uses node's default state if null)
      Returns:
      Probability result for being in the specified state
    • getProbAggr

      public double getProbAggr(Node node, Matrix state) throws Exception
      Get aggregated probability for a specific node state
      Parameters:
      node - The node to get probability for
      state - The state vector (optional - uses node's default state if null)
      Returns:
      Aggregated probability of being in the specified state
      Throws:
      Exception - if probability calculation fails
    • getProbAggr

      public double getProbAggr(Node node) throws Exception
      Get aggregated probability for a specific node state using the node's default state
      Parameters:
      node - The node to get probability for
      Returns:
      Aggregated probability of being in the node's default state
      Throws:
      Exception - if probability calculation fails
    • getProbSys

      public Ret.ProbabilityResult getProbSys()
      Get system-wide probability for the current system state
      Overrides:
      getProbSys in class NetworkSolver
      Returns:
      Probability of being in the system state
      Throws:
      Exception - if probability calculation fails
    • getProbSysAggr

      public Ret.ProbabilityResult getProbSysAggr()
      Get aggregated system-wide probability for the current system state
      Overrides:
      getProbSysAggr in class NetworkSolver
      Returns:
      Aggregated probability of being in the system state
      Throws:
      Exception - if probability calculation fails
    • defaultOptions

      public static SolverOptions defaultOptions()
      Returns the default solver options for the SSA solver.
      Returns:
      Default solver options with SolverType.SSA