https://github.com/cvxgrp/lfd_lqr

Code for "Fitting a Linear Control Policy to Demonstrations with a Kalman Constraint"

https://github.com/cvxgrp/lfd_lqr

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Code for "Fitting a Linear Control Policy to Demonstrations with a Kalman Constraint"

Basic Info
  • Host: GitHub
  • Owner: cvxgrp
  • License: apache-2.0
  • Language: Jupyter Notebook
  • Default Branch: master
  • Size: 286 KB
Statistics
  • Stars: 5
  • Watchers: 12
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Created over 6 years ago · Last pushed over 6 years ago
Metadata Files
Readme License

README.md

lfd_lqr

This repository hosts the code for running the experiments described in our paper Fitting a Linear Control Policy to Demonstrations with a Kalman Constraint.

Running the experiments

Create either a conda or virtualenv Python 3 environment. Then run pip install -r requirements.txt

Each experiment is in a self-contained Jupyter notebook. Start a Jupyter notebook server with jupyter notebook and then run each of the individual notebooks: small random.ipynb, flip.ipynb, and aircraft control.ipynb.

Methods

The methods used to carry out our algorithm is in the file algorithms.py. The signature of the function is: ``` def policyfittingwithakalmanconstraint(L, r, xs, us_observed, A, B, P, Q, R, niter=50, rho=1): """ Policy fitting with a Kalman constraint.

Args:
    - L: function that takes in a cvxpy Variable
        and returns a cvxpy expression representing the objective.
    - r: function that takes in a cvxpy Variable
        and returns a cvxpy expression and a list of constraints
        representing the regularization function.
    - xs: N x n matrix of states.
    - us_observed: N x m matrix of inputs.
    - A: n x n dynamics matrix.
    - B: n x m dynamics matrix.
    - P: n x n PSD matrix, the initial PSD cost-to-go coefficient.
    - Q: n x n PSD matrix, the initial state cost coefficient.
    - R: n x n PD matrix, the initial input cost coefficient.
    - niter: int (optional). Number of iterations (default=50).
    - rho: double (optional). Penalty parameter (default=1).

Returns:
    - K: m x n gain matrix found by policy fitting with a Kalman constraint. 
"""

```

One can call the above function multiple times with both zero and random restarts and pick the control policy with the lowest loss by calling: ```

def policyfittingwithakalmanconstraint(L, r, xs, usobserved, A, B, nrandom=5, niter=50, rho=1): """ Wrapper around _policyfittingwithakalmanconstraint. """ ```

License

This repository carries an Apache 2.0 license.

Citing

If you use our code for research, please cite our accompanying paper: @article{palan2020fitting, author={Palan, M. and Barratt, S. and McCauley, A. and Sadigh, D. and Sindhwani, V. and Boyd, S.}, title={Fitting a Linear Control Policy to Demonstrations with a Kalman Constraint}, year={2020}, journal={arXiv preprint arXiv:2001.07572} }

Owner

  • Name: Stanford University Convex Optimization Group
  • Login: cvxgrp
  • Kind: organization
  • Location: Stanford, CA

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • cvxpy *
  • jupyter *
  • matplotlib *
  • numpy *
  • scipy *