examples.jmarkov

## Class BBPhBuf

- java.lang.Object
- - jmarkov.MarkovProcess<examples.jmarkov.BBPhBufSt,examples.jmarkov.BBPhBufEv>
  - - examples.jmarkov.BBPhBuf

- All Implemented Interfaces:
    JMarkovElement
  Direct Known Subclasses:
    BBPhBufExp

      public class BBPhBuf
      extends MarkovProcess<examples.jmarkov.BBPhBufSt,examples.jmarkov.BBPhBufEv>

  This class is a java implementation of Bucket Brigades System using Phase Distribution and buffers among the stations. This model is based in the source provided by Juan Pablo Alvarado and Germán Riaño.
  Author:
    Julio Goez. Universidad de los Andes. (C) 2006

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class jmarkov.MarkovProcess

      `MarkovProcess.Status`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BBPhBuf()` Used by GUI.
    `BBPhBuf(int numWorkers, int numMachines, ContPhaseVar[] processTimes, double[][] vels, int[] capBuffer)` Builds a Bucket brigades system.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `active(examples.jmarkov.BBPhBufSt x, examples.jmarkov.BBPhBufEv e)` This Boolean function returns true if one events e is active when the system is in state i, and false otherwise
    `Transitions<examples.jmarkov.BBPhBufSt>` | `activeTransitions(examples.jmarkov.BBPhBufSt x, examples.jmarkov.BBPhBufEv e)` The user MUST implement this Function in order to describe the dynamics of the model.
    `java.lang.String` | `description()` This method should be implemented by the subclass to give word description of the model.
    `double` | `getAbsorptionRate(int j, int f)` The absortion rate from phase f when machine j is working.
    `int[]` | `getReachablePhases(int j, int k)` Returns the reachable phases when the machine j is processing on phase k.
    `double` | `getResetRate()` Returns the steady-state rate of occurrance of a Reset (i.e., throughput);
    `int[]` | `getStartingPhases(int j)` Returns a list of starting phases for machine j
    `double` | `getStartingProb(int j, int k)` Gets the starting probability at machine j for this phase.
    `double` | `getTransitionRate(int j, int k1, int k2)` Gets the transition rate for machine j, from phases f1 to f2.
    `static void` | `main(java.lang.String[] a)` Test Program.
    `int` | `printMOPs(java.io.PrintWriter out, int width, int decimals)` Prints a String description of all MOPs in steady state (it reports mean and standard deviation).
    `double` | `rate(examples.jmarkov.BBPhBufSt x, examples.jmarkov.BBPhBufSt y, examples.jmarkov.BBPhBufEv e)` This method calculates the rate of transition from i to j when occurs the event ev.
    `Transitions<examples.jmarkov.BBPhBufSt>` | `revive(Transition<examples.jmarkov.BBPhBufSt> tr, int i)` If worker i can start working this returns all posiible new states.

    - ### Methods inherited from class jmarkov.MarkovProcess

      `addMOP, allToString, canGo, clearMOPs, debug, debug, debug, denseMatrixToString, denseMatrixToString, eventRatesToString, eventsRatesToString, generate, getDebugLevel, getDebugReporter, getEventClass, getEventNames, getEventRate, getEvents, getEventsRates, getFinalRate, getGenerator, getMaxStates, getMOPIndex, getMOPNames, getMOPNames, getMOPsAvg, getMOPsAvg, getMOPsAvg, getMOPsMoment, getMOPsMoment, getMOPsMoment, getMtjGenerator, getMtjRates, getNumStates, getProgress, getRate, getRates, getRates, getStateClass, getStates, getStates, getStatus, getStatusMsg, getSteadyState, getSteadyStateSolver, getTransientSolver, go, goStep, hideGUI, isGenerated, killGUI, label, loadGUI, MOPsToString, MOPsToString, numMOPs, pause, printAll, printAll, printDenseMatrix, printDenseMatrix, printEventsRates, printEventsRates, printMOPs, printMOPs, printStates, printStates, reset, resetResults, setDebugLevel, setDebugReporter, setMaxStates, setMOPs, setSteadyStateSolver, setTransientSolver, showGUI, statesLableMaxWidth, statesToString, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface jmarkov.basic.JMarkovElement

      `equals`

- - ### Constructor Detail

    - #### BBPhBuf

          public BBPhBuf(int numWorkers,
                 int numMachines,
                 ContPhaseVar[] processTimes,
                 double[][] vels,
                 int[] capBuffer)

      Builds a Bucket brigades system.
      Parameters:
        `numWorkers` - Number of workers
        `numMachines` - Number of machines
        `processTimes` - M- dimensional vector of distributions.
        `vels` - array of velocities (N x M)
        `capBuffer` - Buffer capacity. (size M-1)

    - #### BBPhBuf

          public BBPhBuf()

      Used by GUI.

  - ### Method Detail

    - #### getStartingPhases

          public int[] getStartingPhases(int j)

      Returns a list of starting phases for machine j
      Parameters:
        `j` - machine number.
      Returns:
        A list of possible phases.

    - #### getReachablePhases

          public int[] getReachablePhases(int j,
                                 int k)

      Returns the reachable phases when the machine j is processing on phase k.
      Parameters:
        `j` - Machine number
        `k` - Current Phase
      Returns:
        List of reachble phases for machine j when in phase k.

    - #### getStartingProb

          public double getStartingProb(int j,
                               int k)

      Gets the starting probability at machine j for this phase.
      Parameters:
        `j` - Machine
        `k` - Phase
      Returns:
        starting probability: alpha_j(k)

    - #### getTransitionRate

          public double getTransitionRate(int j,
                                 int k1,
                                 int k2)

      Gets the transition rate for machine j, from phases f1 to f2.
      Parameters:
        `j` - Machine.
        `k1` - origin phase
        `k2` - destination phase
      Returns:
        Rate. A_j(k1,k2).

    - #### getAbsorptionRate

          public double getAbsorptionRate(int j,
                                 int f)

      The absortion rate from phase f when machine j is working.
      Parameters:
        `j` - machine
        `f` - Phase
      Returns:
        Rate a_j(f), where a_j = -A1.

    - #### active

          public boolean active(examples.jmarkov.BBPhBufSt x,
                       examples.jmarkov.BBPhBufEv e)

      This Boolean function returns true if one events e is active when the system is in state i, and false otherwise
      Parameters:
        `x` - Current state
        `e` - Current Event
      Returns:
        True if the event can occur.

    - #### activeTransitions

          public Transitions<examples.jmarkov.BBPhBufSt> activeTransitions(examples.jmarkov.BBPhBufSt x,
                                                                  examples.jmarkov.BBPhBufEv e)

      Description copied from class: `MarkovProcess`
      The user MUST implement this Function in order to describe the dynamics of the model. For the current state i, and on action e, the user has to describe the transtions that can occur. This implies finding all destination states and the rate at which the transtions occur. There is no guarantee that the event is active, so the user should check for this. If the event is not active an empty Transition element should be returned. A typical code for a queuing system should look like this: `public abstract Transitions activeTransitions(MyState i, MyEvent e){ TransitionsSet trans = new TransitionsSet(); case (ARRIVAL) if (i.size() < capacity) trans.add(i.doArrival(), arrRate); break; case(DEPARTURE) if (i.size() >=1) trans.add(i.doDeparture, serviceRate); break; } return trans; }`
      Specified by:
        `activeTransitions` in class `MarkovProcess<examples.jmarkov.BBPhBufSt,examples.jmarkov.BBPhBufEv>`
      Parameters:
        `x` - The current State.
        `e` - The ocurring event.
      Returns:
        The transitions that occur at this state when (and if) this events occurs.
      See Also:
        `MarkovProcess.activeTransitions(State, Event)`

    - #### rate

          public double rate(examples.jmarkov.BBPhBufSt x,
                    examples.jmarkov.BBPhBufSt y,
                    examples.jmarkov.BBPhBufEv e)

      This method calculates the rate of transition from i to j when occurs the event ev.
      Parameters:
        `x` - initial state.
        `y` - final state.
        `e` - event.
      Returns:
        the rate of a transition from i to j when ocurr

    - #### revive

          public Transitions<examples.jmarkov.BBPhBufSt> revive(Transition<examples.jmarkov.BBPhBufSt> tr,
                                                       int i)

      If worker i can start working this returns all posiible new states.
      Parameters:
        `tr` - Transition.
        `i` - worker
      Returns:
        Al possible states generated when worker i starts working

    - #### getResetRate

          public double getResetRate()
                              throws NotUnichainException

      Returns the steady-state rate of occurrance of a Reset (i.e., throughput);
      Returns:
        The rate.
      Throws:
        `NotUnichainException`

    - #### description

          public java.lang.String description()

      Description copied from class: `MarkovProcess`
      This method should be implemented by the subclass to give word description of the model. For example it should say: Queueing system with 2 servers and exponential arrivals with rate 50 per hour.
      Specified by:
        `description` in interface `JMarkovElement`
      Specified by:
        `description` in class `MarkovProcess<examples.jmarkov.BBPhBufSt,examples.jmarkov.BBPhBufEv>`
      Returns:
        A description of the Model
      See Also:
        `JMarkovElement.label()`

    - #### printMOPs

          public int printMOPs(java.io.PrintWriter out,
                      int width,
                      int decimals)

      Description copied from class: `MarkovProcess`
      Prints a String description of all MOPs in steady state (it reports mean and standard deviation). You can override this method to print your own MOPs. You can call it in the first line like this `public void printMOPs(PrintWriter out, int width, int decimals) { int namesWidth = super.printMOPs(out,width, decimals); // your oun code here: out.println(pad("Another MOP", namesWidth, false) + pad(Value, width, decimals); }`
      Overrides:
        `printMOPs` in class `MarkovProcess<examples.jmarkov.BBPhBufSt,examples.jmarkov.BBPhBufEv>`
      Parameters:
        `out` - The printer where the MOPS will be printed.
        `width` - the columns width
        `decimals` - the number of decimals to use.
      Returns:
        The max width among the declared MOPs. You can use this to align nicely your own MOPs.
      See Also:
        `MarkovProcess.printMOPs(PrintWriter)`, `MarkovProcess.printMOPs(PrintWriter, int, int)`

    - #### main

          public static void main(java.lang.String[] a)

      Test Program.
      Parameters:
        `a` -