Class Fork

All Implemented Interfaces:
Serializable, Cloneable, Copyable

public class Fork extends Node implements Serializable
A node that forks an incoming job into a set of sibling tasks.

Fork nodes split incoming jobs into parallel sibling tasks that are sent to multiple output destinations. The number of tasks per output link can be configured using setTasksPerLink(int).

Solver compatibility for tasksPerLink > 1:

  • SolverLDES: Fully supported - correctly simulates multiple tasks per link
  • SolverJMT: Fully supported - simulation handles multiple tasks correctly
  • SolverMVA (H-T method): Not supported - throws error when tasksPerLink > 1
  • SolverMVA (MMT method): Supported - analytical approximation
See Also:
  • Constructor Details

    • Fork

      public Fork(Network model)
      Creates a new fork node with default name "Fork".
      Parameters:
      model - the network model to add this fork node to
    • Fork

      public Fork(Network model, String name)
      Creates a new fork node with the specified name. Initializes the fork with buffer input, service tunnel server, and forker output sections.
      Parameters:
      model - the network model to add this fork node to
      name - the name for this fork node
  • Method Details

    • getModel

      public Network getModel()
      Description copied from class: Node
      Returns the network model containing this node.
      Overrides:
      getModel in class Node
      Returns:
      the parent network model
    • setTasksPerLink

      public void setTasksPerLink(int nTasks)
      Sets the number of tasks sent out on each outgoing link.

      By default, a Fork node sends exactly one task per outgoing link. This method allows configuring the Fork to send multiple identical tasks on each link. The total number of tasks created will be: (number of outgoing links) × tasksPerLink.

      Important: Values greater than 1 are only fully supported by simulation-based solvers (SolverLDES, SolverJMT). Analytical solvers may produce errors or inaccurate results.

      Parameters:
      nTasks - the number of tasks to send on each outgoing link (default: 1)
      See Also:
    • setTasksPerLink

      public void setTasksPerLink(JobClass jobClass, double nTasks)
      Sets the tasks per link for one class only, leaving every other class on the node-wide value.
      Parameters:
      jobClass - the class the count applies to
      nTasks - the number of tasks emitted on each outgoing link
    • setTasksPerLinkDistribution

      public void setTasksPerLinkDistribution(JobClass jobClass, DiscreteSampler dist)
      Makes the number of tasks emitted on each outgoing link RANDOM.

      The degree is redrawn independently for every link and every forked job, which is the variable forking level of JMT's JobsPerLinkDis. Exact under SolverJMT and SolverLDES, which draw it at the fork epoch; the analytical solvers see E[dist].

      Parameters:
      jobClass - the class the distribution applies to
      dist - a DiscreteSampler over the tasks-per-link support
    • setTasksPerLinkDistribution

      public void setTasksPerLinkDistribution(JobClass jobClass, DiscreteSampler dist, Node destNode)
      Makes the number of tasks emitted on ONE outgoing link random.
      Parameters:
      jobClass - the class the distribution applies to
      dist - a DiscreteSampler over the tasks-per-link support
      destNode - the destination node of the link, or null for every link
    • setBranchProbability

      public void setBranchProbability(JobClass jobClass, Node destNode, double prob)
      Activates an outgoing branch only with probability prob.

      Branches are activated independently, so the number of siblings a job produces is random even when the tasks per link are deterministic. The matched Join must be told what to wait for: under a standard join a job that skipped a branch would block forever, so any probability below one requires JoinStrategy.PARTIAL or a quorum.

      Parameters:
      jobClass - the class the probability applies to
      destNode - the destination node of the branch
      prob - the activation probability, in [0,1]