examples.jmdp

## Class TheSpiderAndTheFly

- java.lang.Object
- - jmarkov.jmdp.MDP<S,A>
  - - jmarkov.jmdp.InfiniteMDP<S,A>
    - - jmarkov.jmdp.DTMDP<S,A>
      - - jmarkov.jmdp.StochasticShortestPath<examples.jmdp.Distance,examples.jmdp.SpiderAction>
        - - examples.jmdp.TheSpiderAndTheFly

-     public class TheSpiderAndTheFly
      extends StochasticShortestPath<examples.jmdp.Distance,examples.jmdp.SpiderAction>

  Author:
    Juan F. Redondo , German Riaņo- Universidad de los Andes

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TheSpiderAndTheFly(int between, double moveCost, double stayCost, double p)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Actions<examples.jmdp.SpiderAction>` | `feasibleActions(examples.jmdp.Distance i)` This method return all possible action which could be taken from a StateC i, it is preferred that you create an action which makes the terminal state becomes an absorbing state.
    `double` | `immediateCost(examples.jmdp.Distance i, examples.jmdp.SpiderAction a)` This method is easy to design, the immediate reward is directly associated with the incurred action, in that way, you have to associate a reward with the action taken.
    `static void` | `main(java.lang.String[] args)` In this method you have to generate the problem then insert it into the solver and finally solve the problem.
    `double` | `prob(examples.jmdp.Distance i, examples.jmdp.Distance j, examples.jmdp.SpiderAction a)` This method return the associate transition probability between two states by taking an action.
    `States<examples.jmdp.Distance>` | `reachable(examples.jmdp.Distance i, examples.jmdp.SpiderAction a)` Set of states that can be reached from this state i, after taking the action a.

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

      `modifiedProb`

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

      `getSteadyStateProbabilities, setProbabilitySolver, solve`

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

      `getAllStates, 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

    - #### TheSpiderAndTheFly

          public TheSpiderAndTheFly(int between,
                            double moveCost,
                            double stayCost,
                            double p)

      Parameters:
        `between` -
        `moveCost` -
        `p` -
        `stayCost` -

  - ### Method Detail

    - #### immediateCost

          public double immediateCost(examples.jmdp.Distance i,
                             examples.jmdp.SpiderAction a)

      This method is easy to design, the immediate reward is directly associated with the incurred action, in that way, you have to associate a reward with the action taken. However, you can discriminate by states, It is very IMPORTANT: Associate a zero immediate reward to terminal state f.
      Specified by:
        `immediateCost` in class `DTMDP<examples.jmdp.Distance,examples.jmdp.SpiderAction>`
      Parameters:
        `i` - Current State
        `a` - Current Action
      Returns:
        The immediate reward o cost associate with an action and a state.
      See Also:
        `DTMDP.immediateCost(State, Action)`

    - #### prob

          public double prob(examples.jmdp.Distance i,
                    examples.jmdp.Distance j,
                    examples.jmdp.SpiderAction a)

      This method return the associate transition probability between two states by taking an action.
      Specified by:
        `prob` in class `DTMDP<examples.jmdp.Distance,examples.jmdp.SpiderAction>`
      Parameters:
        `i` - Current state.
        `j` - Destination State
        `a` - Action
      Returns:
        A transition probability between two states associate to an action
      See Also:
        `DTMDP.prob(State, State, Action)`

    - #### reachable

          public States<examples.jmdp.Distance> reachable(examples.jmdp.Distance i,
                                                 examples.jmdp.SpiderAction a)

      Description copied from class: `DTMDP`
      Set of states that can be reached from this state i, after taking the action a.
      Specified by:
        `reachable` in class `DTMDP<examples.jmdp.Distance,examples.jmdp.SpiderAction>`
      Parameters:
        `i` - Current State
        `a` - Action taken
      Returns:
        The reachable states.

    - #### feasibleActions

          public Actions<examples.jmdp.SpiderAction> feasibleActions(examples.jmdp.Distance i)

      This method return all possible action which could be taken from a StateC i, it is preferred that you create an action which makes the terminal state becomes an absorbing state. This action return a self-transition probability = 1.
      Specified by:
        `feasibleActions` in class `InfiniteMDP<examples.jmdp.Distance,examples.jmdp.SpiderAction>`
      Parameters:
        `i` - Current State
      Returns:
        set of Actions that can be taken at this state.
      See Also:
        `InfiniteMDP.feasibleActions(State)`

    - #### main

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

      In this method you have to generate the problem then insert it into the solver and finally solve the problem.
      Parameters:
        `args` -