Coder Social home page Coder Social logo

intervalmdp.jl's Introduction

IntervalMDP.jl - Interval Markov Decision Processes

Documentation Build Status Codecov

IntervalMDP.jl is a Julia package for modeling and certifying Interval Markov Decision Processes (IMDPs) via Value Iteration.

IMDPs are a generalization of Markov Decision Processes (MDPs) where the transition probabilities are represented by intervals instead of point values, to model uncertainty. IMDPs are also frequently chosen as the model for abstracting the dynamics of a stochastic system, as one may compute upper and lower bounds on transitioning from one region to another.

The aim of this package is to provide a user-friendly interface to solve value iteration for IMDPs with great efficiency. Furthermore, it provides methods for accelerating the computation of the certificate using CUDA hardware.

Features

  • O-maximization and value iteration
  • Dense and sparse matrix support
  • Parametric probability types for customizable precision
  • Multithreaded CPU and CUDA-accelerated value iteration
  • Data loading and writing in formats by various tools (PRISM, bmdp-tool, IMDP.jl)

Installation

This package requires Julia v1.9 or later. Refer to the official documentation on how to install it for your system.

To install IntervalMDP.jl, use the following command inside Julia's REPL:

julia> import Pkg; Pkg.add("IntervalMDP")

If you want to use the CUDA extension, you also need to install CUDA.jl:

julia> import Pkg; Pkg.add("CUDA")

Usage

Here is an example of how to use the package to solve a finite horizon reachability problem for an Interval Markov Chain (IMC) with 3 states and 1 initial state. The goal is to compute the maximum pessimistic probability of reaching state 3 within 10 time steps.

using IntervalMDP

# IMC
prob = IntervalProbabilities(;
    lower = [
        0.0 0.5 0.0
        0.1 0.3 0.0
        0.2 0.1 1.0
    ],
    upper = [
        0.5 0.7 0.0
        0.6 0.5 0.0
        0.7 0.3 1.0
    ],
)

initial_states = [1]  # Initial states are optional
imc = IntervalMarkovChain(prob, initial_states)

target_set = [3]
prop = FiniteTimeReachability(target_set, 10)  # Time steps
spec = Specification(prop, Pessimistic, Maximize)
problem = Problem(imc, spec)

# Solve
V, k, residual = value_iteration(problem)

See Usage for more information about different specifications, using sparse matrices, and CUDA.

Copyright notice

Technische Universiteit Delft hereby disclaims all copyright interest in the program “IntervalMDP.jl” (GPU-accelerated value iteration for Interval Markov Decision Processes) written by the Frederik Baymler Mathiesen. Fred van Keulen, Dean of Mechanical Engineering.

© 2024, Frederik Baymler Mathiesen, HERALD Lab, TU Delft

intervalmdp.jl's People

Contributors

zinoex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

intervalmdp.jl's Issues

CUDA parallel sorting

Instead of the "populate subsets" approach, try to see if the following yields more performance:

  1. For each state
    1. Select subsets of the value function corresponding the non-zero
    2. Sort local permutation according subset
    3. Assign probabilities

Each of these can possibly be a different kernel.

Improve device error messages

The CUDA error messages when only the system or the spec is on a the GPU are barely understandable. Add an short circuit check that gives the user a more meaningful message. This can be done at problem construction similar to other spec checks.

IMDP

Extend IVI to IMDPs.

  • Verification
  • Control synthesis

Incremental contruction of IMDP/IMC

When constructing an IMDP for anything but simple models, you want to avoid dense matrices and sparsify them after. Instead, you would want to construct it sparsely directly. However, this can be very inefficient, depending on sparse formats and the order in which indices are added. For this reason, make a specialized, fast procedure to construct a sparse IMDP incrementally.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Test asserts

The library contains many asserts, but they remain largely untested. Add unit tests triggering asserts to ensure they assert the correct conditions. Additionally, some of the asserts should possibly be DomainErrors instead.

O-maximization for dense CUDA matrices

Implementation of:

  • CuDenseOrdering
  • sort_states
  • probability_assignment
  • interval_value_iteration

Testing:

  • O-maximization
  • Partial O-maximization
  • O-minimization
  • interval_value_iteration
  • Large matrices

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.