{"id":30957272,"url":"https://github.com/ossamaahmed/blackbox_mpc","last_synced_at":"2025-09-11T13:45:13.039Z","repository":{"id":57415494,"uuid":"304010055","full_name":"ossamaAhmed/blackbox_mpc","owner":"ossamaAhmed","description":"Sampling based Model Predictive Control package for Model-Based RL research","archived":false,"fork":false,"pushed_at":"2020-10-20T11:58:31.000Z","size":45170,"stargazers_count":55,"open_issues_count":4,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-30T02:01:37.514Z","etag":null,"topics":["derivative-free-optimization","model-based-rl","model-predictive-control","reinforcement-learning","sampling-based-planning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ossamaAhmed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-14T12:36:29.000Z","updated_at":"2025-07-26T07:13:16.000Z","dependencies_parsed_at":"2022-08-27T18:10:31.347Z","dependency_job_id":null,"html_url":"https://github.com/ossamaAhmed/blackbox_mpc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ossamaAhmed/blackbox_mpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossamaAhmed%2Fblackbox_mpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossamaAhmed%2Fblackbox_mpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossamaAhmed%2Fblackbox_mpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossamaAhmed%2Fblackbox_mpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ossamaAhmed","download_url":"https://codeload.github.com/ossamaAhmed/blackbox_mpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossamaAhmed%2Fblackbox_mpc/sbom","scorecard":{"id":713837,"data":{"date":"2025-08-11","repo":{"name":"github.com/ossamaAhmed/blackbox_mpc","commit":"68c9e634104a1c0df4e37b0ef0f403d8776341f5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 0.3 not signed: https://api.github.com/repos/ossamaAhmed/blackbox_mpc/releases/32781514","Warn: release artifact 0.3 does not have provenance: https://api.github.com/repos/ossamaAhmed/blackbox_mpc/releases/32781514"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}}]},"last_synced_at":"2025-08-22T08:55:07.737Z","repository_id":57415494,"created_at":"2025-08-22T08:55:07.737Z","updated_at":"2025-08-22T08:55:07.737Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274648319,"owners_count":25324299,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["derivative-free-optimization","model-based-rl","model-predictive-control","reinforcement-learning","sampling-based-planning"],"created_at":"2025-09-11T13:45:09.093Z","updated_at":"2025-09-11T13:45:13.026Z","avatar_url":"https://github.com/ossamaAhmed.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BlackBox MPC (Model Predictive Control)\n\n[![license](https://img.shields.io/github/license/DAVFoundation/captain-n3m0.svg?style=flat-square)](https://github.com/DAVFoundation/captain-n3m0/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/ossamaAhmed/blackbox_mpc/all.svg)](https://github.com/ossamaAhmed/blackbox_mpc/releases)\n[![Documentation Status](https://readthedocs.org/projects/blackbox-mpc/badge/?version=latest)](https://blackbox-mpc.readthedocs.io/en/latest/index.html)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/ossamaAhmed/blackbox_mpc/graphs/commit-activity)\n[![PR](https://camo.githubusercontent.com/f96261621753dacf526590825b84f87ccb1db0e6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/ossamaAhmed/blackbox_mpc/pulls)\n[![Open Source Love png2](https://camo.githubusercontent.com/60dcf2177b53824e7912a6adfb3ff5e318d14ae4/68747470733a2f2f6261646765732e66726170736f66742e636f6d2f6f732f76312f6f70656e2d736f757263652e706e673f763d313033)](https://github.com/ossamaAhmed/blackbox_mpc)\n\n## Description\n\nThis package provides a framework of different derivative-free optimizers (powered by [Tensorflow 2.0.0](https://www.tensorflow.org/)) which can be used in\nconjuction with an MPC (model predictive controller) and an analytical/ learned dynamics model \nto control an agent in a gym environment.\n\n\u003cp align=center\u003e\n\u003cimg src=\"docs/media/cem.gif\" width=250\u003e\u003cimg src=\"docs/media/cma-es.gif\" width=250\u003e\u003cimg src=\"docs/media/pi2.gif\" width=250\u003e\n\u003c/p\u003e\n\u003cp align=center\u003e\n\u003cimg src=\"docs/media/pso.gif\" width=250\u003e\u003cimg src=\"docs/media/rs.gif\" width=250\u003e\u003cimg src=\"docs/media/spsa.gif\" width=250\u003e\n\u003c/p\u003e\n\n| **Derivative-Free Optimizer**                | **BlackBox MPC**              |\n| --------------------------- | --------------------------------- |\n| Cross-Entropy Method (CEM)            | :heavy_check_mark:                |\n| Covariance Matrix Adaptation Evolutionary-Strategy (CMA-ES) | :heavy_check_mark:                |\n| Path Intergral Method (PI2)         | :heavy_check_mark:                |\n| Particle Swarm Optimizer (PSO)        | :heavy_check_mark:                | \n| Random Search (RandomSearch) | :heavy_check_mark:                |\n| Simultaneous Perturbation Stochastic Approximation   (SPSA)   | :heavy_check_mark:                |\n\n\nThe package features other functionalities to aid in model-based reinforcement learning (RL) research such as:\n\n- Parallel implementation of the different optimizers using Tensorflow 2.0\n- Loading/ saving system dynamics model.\n- Monitoring progress using tensorboard.\n- Learning dynamics functions.\n- Recording videos.\n- A modular and flexible interface design to enable research on different trajectory evaluation methods, optimizers, cost functions, system dynamics network architectures or even training algorithms. \n \n\u003cp align=center\u003e\n\u003cimg src=\"docs/media/mpc.png\" width=400\u003e\n\u003c/p\u003e\n\nOptimizers references:\n- [CEM](http://web.mit.edu/6.454/www/www_fall_2003/gew/CEtutorial.pdf)\n- [CMA-ES](https://arxiv.org/pdf/1604.00772.pdf)\n- [PI2](https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=\u0026arnumber=7989202)\n- [PSO](https://www.cs.tufts.edu/comp/150GA/homeworks/hw3/_reading6%201995%20particle%20swarming.pdf)\n- [SPSA](https://www.jhuapl.edu/SPSA/PDF-SPSA/Spall_Stochastic_Optimization.PDF)\n\n## Iterative MPC\n\n\u003cp align=center\u003e\n\u003cimg src=\"docs/media/cheetah_0.gif\" width=300\u003e \u003cimg src=\"docs/media/cheetah.gif\" width=300\u003e\n\u003c/p\u003e\n\n## Installation\n\n### Install as a pip package from latest release\n\n```bash\npip install blackbox_mpc\n```\n\n### Install from source\n\n```bash\ngit clone https://github.com/ossamaAhmed/blackbox_mpc.git\ncd blackbox_mpc\npip install -e .\n```\n\n### To use GPU (recommended for faster inference)\n\n```bash\npip install tensorflow_gpu==2.0.0\n```\n\n\n## Usage\n\nThe easiest way to get familiar with the framework is to run through the [tutorials](https://github.com/ossamaAhmed/blackbox_mpc/tree/master/tutorials) provided. An example is shown below:\n```python\nfrom blackbox_mpc.policies.mpc_policy import \\\n    MPCPolicy\nfrom blackbox_mpc.utils.pendulum import PendulumTrueModel, \\\n    pendulum_reward_function\nimport gym\n\nenv = gym.make(\"Pendulum-v0\")\nmpc_policy = MPCPolicy(reward_function=pendulum_reward_function,\n                       env_action_space=env.action_space,\n                       env_observation_space=env.observation_space,\n                       true_model=True,\n                       dynamics_function=PendulumTrueModel(),\n                       optimizer_name='RandomSearch',\n                       num_agents=1)\n\ncurrent_obs = env.reset()\nfor t in range(200):\n    action_to_execute, expected_obs, expected_reward = mpc_policy.act(\n        current_obs, t)\n    current_obs, reward, _, info = env.step(action_to_execute)\n    env.render()\n```\n\n\n## Documentation\n\nAn API specification and explanation of the code components can be found [here](https://blackbox-mpc.readthedocs.io/en/latest/).\n\n## Visualize Training\n\n\u003cp align=center\u003e\n\u003cimg src=\"docs/media/uncertainity.png\" width=1000\u003e\n\u003c/p\u003e\n\n## Authors\n\nblackbox_mpc is work done by [Ossama Ahmed (ETH Zürich)](https://ossamaahmed.github.io/), [Jonas Rothfuss (ETH Zürich)](https://las.inf.ethz.ch/people/jonas-rothfuss) and [Prof. Andreas Krause (ETH Zurich)](https://las.inf.ethz.ch/krausea).\n\nThis package was developed at the [Learning and Adaptive Systems Lab](https://causal-world.readthedocs.io/en/latest/index.html) @ETH Zurich.\n\n## If you use the package, please cite blackbox_mpc\n\n```\n@misc{blackbox_mpc,\n   author = {Ahmed, Ossama and Rothfuss, Jonas and Krause, Andreas},\n   year = {2020},\n   publisher = {GitHub},\n   journal = {GitHub repository},\n   howpublished = {\\url{https://github.com/ossamaAhmed/blackbox_mpc}},\n}\n```\n\n## License\n\nThe code is licenced under the MIT license and free to use by anyone without any restrictions.\n\n## TODO\n\n- Add bayesian neural networks (BNN) and graph neural networks (GNN) support.\n- Add different trajectory evaluators to propagate uncertainities support.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossamaahmed%2Fblackbox_mpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fossamaahmed%2Fblackbox_mpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossamaahmed%2Fblackbox_mpc/lists"}