Skip to content

Implementation of a differetiable discrete-time algebraic Riccati equation (DARE) solver in PyTorch.

License

Notifications You must be signed in to change notification settings

sebastian-east/dare-torch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dare-torch

Implementation of a differetiable discrete-time algebraic Riccati equation (DARE) solver in PyTorch.

Solves DARE equations of the form

equation

for the matrix P, and computes the derivatives of P with respect to input matrices A, B, Q, and R.

Details on the method for differentiating the DARE are available in this paper: Infinite-Horizon Differentiable Model Predictive Control

License

This code is available under the unlicense: do whatever you want with it. If you find it useful in your research, I would appreciate it if you could include the following citation in any resulting publications:

@article{East2020,
  title={Infinite-Horizon Differentiable Model Predictive Control},
  author={Sebastian East and Marco Gallieri and Jonathan Masci and Jan Koutn{\'i}k and Mark Cannon},
  journal={ArXiv},
  year={2020},
  volume={abs/2001.02244}
}

Numerical tests for validity of derivative

Numerical Tests <- this failure is caused by a version conflict in the required packages that has arisen since I wrote the code; the derivative is still working correctly when run locally. I'll fix the github action when I've got some time available.

Usage

from riccati import dare

Forwards solution (currently uses the scipy DARE solver and is not PyTorch native).

DARE = dare()
P = DARE(A, B, C, D)

Derivative (implemented in native PyTorch code).

P = P.sum()
P.backward()

Requires PyTorch, numpy, and scipy.

About

Implementation of a differetiable discrete-time algebraic Riccati equation (DARE) solver in PyTorch.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages