examples.jmdp

## Class BankWithEvents

- java.lang.Object
- - jmarkov.jmdp.MDP<S,A>
  - - jmarkov.jmdp.InfiniteMDP<S,A>
    - - jmarkov.jmdp.CTMDP<StateEvent<S,E>,A>
      - - jmarkov.jmdp.CTMDPEvA<examples.jmdp.BankQueues2,examples.jmdp.BankServers2,examples.jmdp.BankEvent>
        - - examples.jmdp.BankWithEvents

-     public class BankWithEvents
      extends CTMDPEvA<examples.jmdp.BankQueues2,examples.jmdp.BankServers2,examples.jmdp.BankEvent>

  The present example describes a Bank office with "maxServers" tellers. There is a queue for clients for whom the bank wants to give the best service, and another queue for users who have no commercial relation with the bank and are not the service priority. At every transition, the bank can add or remove a teller serving one of the queues and remove him or add him to the other queue.
  Author:
    sarmiea

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BankWithEvents(States<examples.jmdp.BankQueues2> initial, double clientMinuteCost, double userMinuteCost, double clientProbability, double lambda, double mu, int maxCapacity, int maxServers)` Builds a BankWithEvents

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Events<examples.jmdp.BankEvent>` | `activeEvents(examples.jmdp.BankQueues2 i)` Set of events that are active from state i given that action a is taken.
    `double` | `continuousCost(examples.jmdp.BankQueues2 i, examples.jmdp.BankServers2 a, examples.jmdp.BankEvent e)` Reward obtained continuously in time during the sojourn time in state i until an action a is taken and a transition is triggered.
    `Actions<examples.jmdp.BankServers2>` | `feasibleAct(examples.jmdp.BankQueues2 i)` Returns the set of actions available at this state.
    `double` | `lumpCost(examples.jmdp.BankQueues2 i, examples.jmdp.BankServers2 a, examples.jmdp.BankEvent e)` Reward instantaneously gained in the moment when action a is taken from state i.
    `static void` | `main(java.lang.String[] args)` This method just tests the class.
    `double` | `rate(examples.jmdp.BankQueues2 i, examples.jmdp.BankQueues2 j, examples.jmdp.BankServers2 a, examples.jmdp.BankEvent e)` Rate.
    `States<examples.jmdp.BankQueues2>` | `reached(examples.jmdp.BankQueues2 i, examples.jmdp.BankServers2 a, examples.jmdp.BankEvent e)` Set of reachable states from state i given that action a is taken and event e occurs.

    - ### Methods inherited from class jmarkov.jmdp.CTMDPEvA

      `continuousCost, feasibleActions, lumpCost, rate, reachable`

    - ### Methods inherited from class jmarkov.jmdp.CTMDP

      `getAllStates, getMaxRate, getSteadyStateProbabilities, setConverter, solve`

    - ### Methods inherited from class jmarkov.jmdp.InfiniteMDP

      `getNumStates, getSolver`

    - ### Methods inherited from class jmarkov.jmdp.MDP

      `debug, debug, debug, getDebugLevel, getOptimalPolicy, getOptimalValueFunction, getReporter, isFinite, isSolved, operation, printSolution, printSolution, setDebugLevel, setReporter, setSolver, solve`

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

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

- - ### Constructor Detail

    - #### BankWithEvents

          public BankWithEvents(States<examples.jmdp.BankQueues2> initial,
                        double clientMinuteCost,
                        double userMinuteCost,
                        double clientProbability,
                        double lambda,
                        double mu,
                        int maxCapacity,
                        int maxServers)

      Builds a BankWithEvents
      Parameters:
        `initial` - Initial state in the system
        `clientMinuteCost` - The cost that is charged to clients with commercial relation with the bank per minute they stay in queue
        `userMinuteCost` - The cost that is charged to users with no commercial relation with the bank per minute they stay in queue
        `clientProbability` - Probability that the next client has a commercial relation with the bank
        `lambda` - Arrival rate to the bank
        `mu` - Service rate of tellers
        `maxCapacity` - Queues capacity
        `maxServers` - Maximum number of tellers available in the bank

  - ### Method Detail

    - #### activeEvents

          public Events<examples.jmdp.BankEvent> activeEvents(examples.jmdp.BankQueues2 i)

      Description copied from class: `CTMDPEvA`
      Set of events that are active from state i given that action a is taken.
      Specified by:
        `activeEvents` in class `CTMDPEvA<examples.jmdp.BankQueues2,examples.jmdp.BankServers2,examples.jmdp.BankEvent>`
      Parameters:
        `i` - current state
      Returns:
        set of events that can occur

    - #### lumpCost

          public double lumpCost(examples.jmdp.BankQueues2 i,
                        examples.jmdp.BankServers2 a,
                        examples.jmdp.BankEvent e)

      Description copied from class: `CTMDPEvA`
      Reward instantaneously gained in the moment when action a is taken from state i.
      Specified by:
        `lumpCost` in class `CTMDPEvA<examples.jmdp.BankQueues2,examples.jmdp.BankServers2,examples.jmdp.BankEvent>`
      Parameters:
        `i` - current state
        `a` - action taken
        `e` - event that occurs
      Returns:
        instanteneous reward.

    - #### continuousCost

          public double continuousCost(examples.jmdp.BankQueues2 i,
                              examples.jmdp.BankServers2 a,
                              examples.jmdp.BankEvent e)

      Description copied from class: `CTMDPEvA`
      Reward obtained continuously in time during the sojourn time in state i until an action a is taken and a transition is triggered.
      Specified by:
        `continuousCost` in class `CTMDPEvA<examples.jmdp.BankQueues2,examples.jmdp.BankServers2,examples.jmdp.BankEvent>`
      Parameters:
        `i` - current state
        `a` - action taken
        `e` - event that occurs
      Returns:
        instanteneous reward.

    - #### reached

          public States<examples.jmdp.BankQueues2> reached(examples.jmdp.BankQueues2 i,
                                                  examples.jmdp.BankServers2 a,
                                                  examples.jmdp.BankEvent e)

      Description copied from class: `CTMDPEvA`
      Set of reachable states from state i given that action a is taken and event e occurs.
      Specified by:
        `reached` in class `CTMDPEvA<examples.jmdp.BankQueues2,examples.jmdp.BankServers2,examples.jmdp.BankEvent>`
      Parameters:
        `i` - current state
        `a` - action taken
        `e` - event that occurs
      Returns:
        set of reachable states.

    - #### rate

          public double rate(examples.jmdp.BankQueues2 i,
                    examples.jmdp.BankQueues2 j,
                    examples.jmdp.BankServers2 a,
                    examples.jmdp.BankEvent e)

      Description copied from class: `CTMDPEvA`
      Rate. Rate of going of reaching state j given that the current state is i, the action taken is a and the event that occurs is e.
      Specified by:
        `rate` in class `CTMDPEvA<examples.jmdp.BankQueues2,examples.jmdp.BankServers2,examples.jmdp.BankEvent>`
      Parameters:
        `i` - current state
        `j` - state to reach
        `a` - action taken (given)
        `e` - event that occurs (given)
      Returns:
        Rate

    - #### feasibleAct

          public Actions<examples.jmdp.BankServers2> feasibleAct(examples.jmdp.BankQueues2 i)

      Description copied from class: `CTMDPEvA`
      Returns the set of actions available at this state. The user must implement this method.
      Specified by:
        `feasibleAct` in class `CTMDPEvA<examples.jmdp.BankQueues2,examples.jmdp.BankServers2,examples.jmdp.BankEvent>`
      Parameters:
        `i` - current state
      Returns:
        set of feasible actions

    - #### main

          public static void main(java.lang.String[] args)
                           throws SolverException

      This method just tests the class.
      Parameters:
        `args` - Not used
      Throws:
        `SolverException`