refine_plan.models.semi_mdp

Class for semi-MDP based on options.

Author: Charlie Street Owner: Charlie Street

Module Contents

Classes

SemiMDP

Class for semi-MDPs where actions=options.

class refine_plan.models.semi_mdp.SemiMDP(sf_list, option_list, labels, initial_state=None)

Bases: object

Class for semi-MDPs where actions=options.

_state_factors

A dictionary from state factor name to state factor

_options

A dictionary from option name to options

_labels

A list of Labels

_initial_state

A deterministic initial state (if there is one)

get_state_factors()

Return the state factor dictionary.

Returns:

A dictionary from state factor name to state factor

get_det_initial_state()

Return the deterministic initial state, if there is one.

Returns:

The initial state if there is one, None otherwise

get_labels()

Return the list of labels.

Returns:

The list of labels

get_transition_prob(state, option, next_state)

Get the transition probability for executing an option in a state.

Parameters:
  • state – The current state

  • option – The name of the option (action) being executed

  • next_state – The successor state

Returns:

The semi-MDP transition probability

Raises:

invalid_opt_exception – Raised if an invalid option is passed in

get_reward(state, option)

Get the reward for executing an option in a state.

Parameters:
  • state – The current state

  • option – The name of the option (action) being executed

Returns:

The reward for that option in the semi-MDP

Raises:

invalid_opt_exception – Raised if an invalid option is passed in

to_prism_string(output_file=None)

Convert the semi-MDP into a PRISM model.

Because of the objectives we are handling this is written as an MDP.

Parameters:

output_file – Optional. A file path to write the PRISM string to.

Returns:

The PRISM string