examples.jmdp

## Class WagnerWhitin

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

-     public class WagnerWhitin
      extends FiniteDP<InvLevel,Order>

  This example solves a deterministic, dynamic lot-sizing problem, also known as a Wagner Whitin problem.
  Author:
    Andres Sarmiento, Germán Riaño - Universidad de Los Andes

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WagnerWhitin(int initialInventory, int lastStage, int maxInventory, int maxBackorders, int truckSize, double K, double b, double price, double cost, double h, int[] demand)` Crates a dynamic economic lot sizing problem to be solved by Wagner Whitin algorithm.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `InvLevel` | `destination(InvLevel i, Order a, int t)` State where the system will end up if action a is taken from state i at time t.
    `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` | `getOptimalCost(int inventory)` Returns the optimal cost for this level of starting inventory.
    `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)` Test Program.

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

      `prob, reachable`

    - ### 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

    - #### WagnerWhitin

          public WagnerWhitin(int initialInventory,
                      int lastStage,
                      int maxInventory,
                      int maxBackorders,
                      int truckSize,
                      double K,
                      double b,
                      double price,
                      double cost,
                      double h,
                      int[] demand)

      Crates a dynamic economic lot sizing problem to be solved by Wagner Whitin algorithm.
      Parameters:
        `initialInventory` - Inventory at time t=0.
        `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
        `demand` - demand of items in each stage

  - ### Method Detail

    - #### getOptimalCost

          public double getOptimalCost(int inventory)
                                throws SolverException

      Returns the optimal cost for this level of starting inventory.
      Parameters:
        `inventory` -
      Returns:
        The optimal cost for this level of starting inventory.
      Throws:
        `SolverException`

    - #### 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

    - #### 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.

    - #### 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.

    - #### destination

          public InvLevel destination(InvLevel i,
                             Order a,
                             int t)

      Description copied from class: `FiniteDP`
      State where the system will end up if action a is taken from state i at time t. The user must implement this method.
      Specified by:
        `destination` in class `FiniteDP<InvLevel,Order>`
      Parameters:
        `i` - Current state
        `a` - Current action
        `t` - Time stage.
      Returns:
        Destination states

    - #### main

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

      Test Program.
      Parameters:
        `a` -
      Throws:
        `java.lang.Exception`