refine_plan.models.policy

Class for deterministic memoryless policies.

Author: Charlie Street Owner: Charlie Street

Classes

Policy

Data class for deterministic memoryless policies.

Module Contents

class refine_plan.models.policy.Policy(state_action_dict, value_dict=None, policy_file=None)

Bases: object

Data class for deterministic memoryless policies.

_state_action_dict

A dictionary from states to actions

_value_dict

A dictionary from states to values under that policy

get_action(state)

Return the policy action for a given state.

Parameters:

state – The state we want an action for

Returns:

The policy action

get_value(state)

Return the value at a given state.

Parameters:

state – The state we want to retrieve the value for

Returns:

The value at state

Raises:

no_value_dict_exception – Raised if there is no value dictionary

write_policy(out_file)

Write a policy with all state factor information to a YAML file.

Parameters:

out_file – The yaml file to write to

to_scxml(output_file, model_name, initial_state, name='policy')

Write the policy out to SCXML for verification.

Parameters:
  • output_file – The file to write out to

  • model_name – The name of the model actions are executed on

  • initial_state – The initial state

  • name – The name for the policy in SCXML