Skip to main content

Implementation of value iteration for Markov Decision Processes

Project description

A Value Iteration Algorithm for Solving Markov decision Processes

In this package, we provide an implementation of a value iteration solving algorithm for Markov Decision Processes (MDP). Whilst this package works well for any MDP, it has been particularly optimised for 'Gridworld' problems, in which an agent navigates a discretised world, seeking rewards and avoiding penalty cells.

Installation

installing from PyPI

pip install value-iteration

installing from github with pip

python -m pip install git+https://github.com/Harry-Ell/601-assessment-2.git#subdirectory=package

Example 1: Solving problem 9.27 from Artificial Intelligence: Foundations and Computational Agents 2nd edition

from value_iteration import Value_Iteration
Value_Iteration()

This will then open an interactive Command Line Interface (CLI). This is far more usable when ran in a .py file than in a notebook environment. An example CLI for this problem is given below

CLI

Where we can see the optimal policy is returned. In the case of there being more than 2 states, there will be no automatic defaults for other probabilities, they must all be specified and then their sum to 1 will be checked

Example 2: Gridworld Type Problems

from value_iteration import Value_Iteration
Value_Iteration()

CLI_grid

Following a successful solving, it returns a plot of the policy obtained.

CLI_grid_pol

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

value_iteration-1.0.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

value_iteration-1.0.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file value_iteration-1.0.1.tar.gz.

File metadata

  • Download URL: value_iteration-1.0.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for value_iteration-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c30a19a40be26acafcede2e62de00d1b976b5fcb4f2d578160d906813a1a9a8d
MD5 6757b5e89ee1a794193d9674ef8c2876
BLAKE2b-256 ad8519674e5861f1a402c22a5dbdc3104a9891b4ad2dd5324af500afd740b5d6

See more details on using hashes here.

File details

Details for the file value_iteration-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for value_iteration-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 92a30516f8f2781ce642dd4a264aa84413d555917a7e5d12b73bfd2414be6960
MD5 218298d1d9f1c11cf42324b8bef3f912
BLAKE2b-256 ee0ce133696cfd89cf6a17525ad7f34f217b4ba93f749fc7441c97a41ff47108

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page