Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A small package for solving finite-horizon, finite-space stochastic dynamic programs.

Project Description

This package solves finite-horizon, finite-space stochastic dynamic programs.


stochasticdp is available on PyPI:

pip install stochasticdp


To initialize a stochastic dynamic program:

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


  • 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()


  • 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]

Release History

History Node


History Node


History Node


This version
History Node


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
(3.2 kB) Copy SHA256 Hash SHA256
Source None Apr 4, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate