examples.jmdp

## Class StochasticDemand

- java.lang.Object
- - jmarkov.jmdp.MDP<S,A>
  - - jmarkov.jmdp.FiniteMDP<InvLevel,Order>
    - - examples.jmdp.StochasticDemand

-     public class StochasticDemand
      extends FiniteMDP<InvLevel,Order>

  This class belongs to the examples supplied in the package jmdp. The objective of this file is to show as clear as possible a simple way to use the jmdp package as a tool for solving real life problems. The complete details of the present problems are explained in the documentation.
  Author:
    Andres Sarmiento, Germán Riaño - Universidad de Los Andes

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StochasticDemand(States<InvLevel> initSet, int lastStage, int maxInventory, int maxBackorders, int truckSize, double K, double b, double price, double cost, double h, double theta)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Actions<Order>` | `feasibleActions(InvLevel i, int t)` Returns the actions available at this state i and at this stage t .
    `double` | `finalCost(InvLevel i)` This method returns the cost incurred if the last stage ends with the system at state i.
    `double` | `immediateCost(InvLevel i, Order a, int t)` This function must return the Immediate cost incurred when taking action a from state i
    `static void` | `main(java.lang.String[] a)`
    `double` | `prob(InvLevel i, InvLevel j, Order a, int t)` This is the probability of going from state i to state j by taking the action a at stage t.
    `States<InvLevel>` | `reachable(InvLevel i, Order a, int t)` Set of States that can be reached from this state i, at this stage t, after taking the acton a.

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

      `defaultFinalCost, getHorizon, getStates`

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

      `debug, debug, debug, getDebugLevel, getOptimalPolicy, getOptimalValueFunction, getReporter, getSolver, 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

    - #### StochasticDemand

          public StochasticDemand(States<InvLevel> initSet,
                          int lastStage,
                          int maxInventory,
                          int maxBackorders,
                          int truckSize,
                          double K,
                          double b,
                          double price,
                          double cost,
                          double h,
                          double theta)

      Parameters:
        `initSet` - Initial level of inventory of the system
        `lastStage` - the last stage of the problem
        `maxInventory` - maximum physical capacity in inventory, warehouse size.
        `maxBackorders` - maximum backorders allowed
        `truckSize` - maximum items in each fixed cost order. Orders can be greater than this value, but will be charged more than one fixed cost.
        `K` - fixed cost per order
        `b` - unit cost per backordered item per stage
        `price` - unit price for all stages
        `cost` - unit costo for all stages
        `h` - inventory percentual holding cost as a fraction of cost
        `theta` - demand mean

  - ### Method Detail

    - #### finalCost

          public double finalCost(InvLevel i)

      Description copied from class: `FiniteMDP`
      This method returns the cost incurred if the last stage ends with the system at state i. The user must extend this method.
      Specified by:
        `finalCost` in class `FiniteMDP<InvLevel,Order>`
      Parameters:
        `i` - Ending state
      Returns:
        Cost.

    - #### prob

          public double prob(InvLevel i,
                    InvLevel j,
                    Order a,
                    int t)

      Description copied from class: `FiniteMDP`
      This is the probability of going from state i to state j by taking the action a at stage t.
      Specified by:
        `prob` in class `FiniteMDP<InvLevel,Order>`
      Parameters:
        `i` - Current state
        `j` - Destination state
        `a` - Action taken
        `t` - Current time stage
      Returns:
        Probability

    - #### immediateCost

          public double immediateCost(InvLevel i,
                             Order a,
                             int t)

      Description copied from class: `FiniteMDP`
      This function must return the Immediate cost incurred when taking action a from state i
      Specified by:
        `immediateCost` in class `FiniteMDP<InvLevel,Order>`
      Parameters:
        `i` - Current state
        `a` - Action
        `t` - Current time stage
      Returns:
        Cost value

    - #### feasibleActions

          public Actions<Order> feasibleActions(InvLevel i,
                                       int t)

      Description copied from class: `FiniteMDP`
      Returns the actions available at this state i and at this stage t . The user must implement this method.
      Specified by:
        `feasibleActions` in class `FiniteMDP<InvLevel,Order>`
      Parameters:
        `i` - Current State
        `t` - Time stage
      Returns:
        Set of feasible actions.

    - #### reachable

          public States<InvLevel> reachable(InvLevel i,
                                   Order a,
                                   int t)

      Description copied from class: `FiniteMDP`
      Set of States that can be reached from this state i, at this stage t, after taking the acton a. The user must implement this method.
      Specified by:
        `reachable` in class `FiniteMDP<InvLevel,Order>`
      Parameters:
        `i` - Current state
        `a` - Action taken
        `t` - Time stage
      Returns:
        Set of reachable states.

    - #### main

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

      Parameters:
        `a` - Not used
      Throws:
        `java.lang.Exception`