You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

4 years ago
  1. from . import pomdp
  2. from .pomdp import *
  3. def make_canonic(model):
  4. """
  5. Make the POMDP canonic
  6. :param model:
  7. :return:
  8. """
  9. if model.supports_parameters:
  10. return pomdp._make_canonic_Rf(model)
  11. else:
  12. return pomdp._make_canonic_Double(model)
  13. def make_simple(model, keep_state_valuations=False):
  14. """
  15. Make the POMDP simple (aka alternating), i.e., each state has at most two actions, and if there is nondeterminism, then there is no probabilistic branching,
  16. :param model:
  17. :return:
  18. """
  19. if model.supports_parameters:
  20. return pomdp._make_simple_Rf(model, keep_state_valuations)
  21. else:
  22. return pomdp._make_simple_Double(model, keep_state_valuations)
  23. def unfold_memory(model, memory, add_memory_labels=False, keep_state_valuations=False):
  24. """
  25. Unfold the memory for an FSC into the POMDP
  26. :param model: A pomdp
  27. :param memory: A memory structure
  28. :return: A pomdp that contains states from the product of the original POMDP and the FSC Memory
  29. """
  30. if model.supports_parameters:
  31. return pomdp._unfold_memory_Rf(model, memory, add_memory_labels, keep_state_valuations)
  32. else:
  33. return pomdp._unfold_memory_Double(model, memory, add_memory_labels, keep_state_valuations)
  34. def apply_unknown_fsc(model, mode):
  35. if model.supports_parameters:
  36. return pomdp._apply_unknown_fsc_Rf(model, mode)
  37. else:
  38. return pomdp._apply_unknown_fsc_Double(model, mode)