{"id":19382853,"url":"https://github.com/locuslab/robust-nn-control","last_synced_at":"2025-08-06T11:24:15.132Z","repository":{"id":69236035,"uuid":"313254422","full_name":"locuslab/robust-nn-control","owner":"locuslab","description":"Enforcing robust control guarantees within neural network policies","archived":false,"fork":false,"pushed_at":"2021-04-24T23:57:45.000Z","size":68,"stargazers_count":54,"open_issues_count":0,"forks_count":10,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-02T20:11:24.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/locuslab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-16T09:42:33.000Z","updated_at":"2024-11-21T23:38:11.000Z","dependencies_parsed_at":"2023-02-27T23:46:00.897Z","dependency_job_id":null,"html_url":"https://github.com/locuslab/robust-nn-control","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Frobust-nn-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Frobust-nn-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Frobust-nn-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Frobust-nn-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locuslab","download_url":"https://codeload.github.com/locuslab/robust-nn-control/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250509866,"owners_count":21442514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T09:23:36.078Z","updated_at":"2025-04-23T20:32:30.389Z","avatar_url":"https://github.com/locuslab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enforcing robust control guarantees within neural network policies\n\nThis repository is by \n[Priya L. Donti](https://www.priyadonti.com),\n[Melrose Roderick](https://melroderick.github.io/),\n[Mahyar Fazlyab](https://scholar.google.com/citations?user=Y3bmjJwAAAAJ\u0026hl=en),\nand [J. Zico Kolter](http://zicokolter.com),\nand contains the [PyTorch](https://pytorch.org) source code to\nreproduce the experiments in our paper\n\"[Enforcing robust control guarantees within neural network policies](https://arxiv.org/abs/2011.08105).\"\n\nIf you find this repository helpful in your publications,\nplease consider citing our paper.\n\n```\n@inproceedings{donti2021enforcing,\n  title={Enforcing robust control guarantees within neural network policies},\n  author={Donti, Priya and Roderick, Melrose and Fazlyab, Mahyar and Kolter, J Zico},\n  booktitle={International Conference on Learning Representations},\n  year={2021}\n}\n```\n\n\n## Introduction\n\nWhen designing controllers for safety-critical systems, practitioners often face a challenging tradeoff between robustness and performance. While robust control methods provide rigorous guarantees on system stability under certain worst-case disturbances, they often result in simple controllers that perform poorly in the average (non-worst) case. In contrast, nonlinear control methods trained using deep learning have achieved state-of-the-art performance on many control tasks, but \noften lack robustness guarantees. We propose a technique that combines the strengths of these two approaches: a generic nonlinear control policy class, parameterized by neural networks, that nonetheless enforces the same provable robustness criteria as robust control. Specifically, we show that by integrating custom convex-optimization-based projection layers into a nonlinear policy, we can construct a provably robust neural network policy class that outperforms robust control methods in the average (non-adversarial) setting. We demonstrate the power of this approach on several domains, improving in performance over existing robust control methods and in stability over (non-robust) RL methods.\n\n## Dependencies\n\n+ Python 3.x/numpy/scipy/[cvxpy](http://www.cvxpy.org/en/latest/)\n+ [PyTorch](https://pytorch.org) 1.5\n+ OpenAI [Gym](https://gym.openai.com/) 0.15: *A toolkit for reinforcement learning*\n+ [qpth](https://github.com/locuslab/qpth):\n  *A fast differentiable QP solver for PyTorch*\n+ [block](https://github.com/bamos/block):\n  *A block matrix library for numpy and PyTorch*\n+ [argparse](https://docs.python.org/3/library/argparse.html): *Input argument parsing*\n+ [setproctitle](https://pypi.org/project/setproctitle/): *Library to set process titles*\n+ [tqdm](https://tqdm.github.io/): *A library for smart progress bars*\n\n\n## Instructions\n\n### Running experiments\n\nExperiments can be run the following commands for each environment (with the additional optional flag `--gpu [gpunum]` to enable GPU support). To reproduce the results in our paper, append the flag `--envRandomSeed 10` to the commands below.\n\nSynthetic NLDI (D=0):\n\n```\npython main.py --env random_nldi-d0 \n```\n    \nSynthetic NLDI (D ≠ 0):\n\n```\npython main.py --env random_nldi-dnonzero\n```\n    \nCart-pole:\n\n```\npython main.py --env cartpole --T 10 --dt 0.05\n```\n    \nPlanar quadrotor:\n\n```\npython main.py --env quadrotor --T 4 --dt 0.02\n```\n\nMicrogrid:\n\n```\npython main.py --env microgrid\n```\n\nSynthetic PLDI:\n\n```\npython main.py --env random_pldi_env\n```\n\nSynthetic H\u003csub\u003e∞\u003c/sub\u003e:\n\n```\npython main.py --env random_hinf_env\n```\n\n### Generating plots\n\nAfter running the experiments above, plots and tables can then be generated by running:\n\n```\npython plots.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Frobust-nn-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocuslab%2Frobust-nn-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Frobust-nn-control/lists"}