Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A simple implementation of backwards induction for solving finite-horizon, finite-state stochastic dynamic programs.

Project description

A simple implementation of backwards induction for solving finite-horizon, finite-space stochastic dynamic programs.

Installation

stochasticdp is available on PyPI:

pip install stochasticdp

Usage

To initialize a stochastic dynamic program:

dp = StochasticDP(number_of_stages, states, decisions, minimize)

where

  • number_of_stages is an integer
  • states is a list
  • decisions is a list
  • minimize is a boolean

This results in a stochastic dynamic program with stages numbered 0, ..., number_of_stages - 1, and initializes the following dictionaries:

  • dp.transition, where dp.transition[m, n, t, x] is the probability of moving from state n to state m in stage t under decision x
  • dp.contribution, where dp.contribution[m, n, t, x] is the immediate contribution of resulting from moving from state n to state m in stage t under decision x
  • dp.boundary, where dp.boundary[n] is the boundary condition for the value-to-go function at state n

To solve the stochastic dynamic program:

value, policy = dp.solve()

where

  • value is a dictionary: value[t, n] is the value-to-go function at stage t and state n
  • policy is a dictionary: policy[t, n] is the optimizer of value[t, n]

Project details


Release history Release notifications

History Node

0.4

History Node

0.3.1

History Node

0.3

History Node

0.2.1

This version
History Node

0.2

History Node

0.1.1

History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
stochasticdp-0.2.tar.gz (3.4 kB) Copy SHA256 hash SHA256 Source None Apr 12, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page