An implementation of model-predictive control algorithms using TensorFlow 2
Project description
tf-mpc

Quickstart
tfmpc is a Python3.6+ package available in PyPI.
$ pip3 install -U tfmpc
Usage
$ tfmpc ilqr --help
Usage: tfmpc ilqr [OPTIONS] ENV
Run iLQR for a given environment and horizon.
Args:
ENV: Path to the environment's config JSON file.
Options:
--online Online mode flag. [default: False]
--ignore-final-cost Ignore state-dependent final cost.
[default: False]
-hr, --horizon INTEGER RANGE The number of timesteps. [default: 10]
--atol FLOAT RANGE Absolute tolerance for convergence.
[default: 0.005]
-miter, --max-iterations INTEGER RANGE
Maximum number of iterations. [default:
100]
--logdir PATH Directory used for logging results.
[default: /tmp/ilqr/]
-ns, --num-samples INTEGER RANGE
Number of runs. [default: 1]
-nw, --num-workers INTEGER RANGE
Number of worker processes (min=1, max=12).
[default: 1]
-v, --verbose Verbosity level flag.
--help Show this message and exit.
Examples
LQR
$ python examples/lqr.py
Trajectory(init=[-0.9436722 -5.9413767 -9.7090645], final=[-6.831274 3.5397437 0.79844564], total=-34.2876)
Steps | States | Actions | Costs
===== | ============================== | ============================== | ========
0 | [-29.6400, 12.4868, -6.1247] | [ 12.0202, 6.2650, 2.7019] | 9.9491
1 | [ 1.1229, -1.0781, -0.9041] | [ 24.8006, 16.6294, -10.9740] | 49.6677
2 | [ -8.8750, 2.3962, -4.4266] | [ 3.7858, 3.3769, -1.8138] | -1.6455
3 | [ -9.3617, 3.2755, -3.5806] | [ 11.8333, 7.8142, -3.6503] | -11.4392
4 | [ -6.6389, 2.0026, -3.2240] | [ 11.3348, 7.6663, -4.2552] | -11.8703
5 | [ -7.7849, 2.3658, -3.6332] | [ 9.6319, 6.4642, -3.2991] | -12.2632
6 | [ -7.5215, 2.4822, -3.0080] | [ 10.1523, 6.7136, -3.4948] | -12.7255
7 | [ -6.2336, 1.5849, -2.9592] | [ 9.6488, 6.2573, -3.1976] | -12.8830
8 | [ -8.7144, 2.0473, -4.4850] | [ 10.1518, 6.4578, -2.9710] | -11.6011
9 | [ -6.8313, 3.5397, 0.7984] | [ 8.3644, 5.6785, -3.5642] | -12.9032
Linear Navigation
$ python examples/navigation_lqr.py
Goal = [[-17.498825073242188], [-55.275390625]]
Trajectory(init=[0. 0.], final=[-17.498783 -55.275257], total=-32385.3555)
Steps | States | Actions | Costs
===== | ==================== | ==================== | ==========
0 | [-12.8100, -40.4644] | [-12.8100, -40.4644] | 900.7320
1 | [-16.2425, -51.3068] | [ -3.4324, -10.8424] | -3055.5571
2 | [-17.1622, -54.2120] | [ -0.9197, -2.9052] | -3339.6064
3 | [-17.4086, -54.9905] | [ -0.2464, -0.7784] | -3360.0002
4 | [-17.4747, -55.1990] | [ -0.0660, -0.2086] | -3361.4644
5 | [-17.4924, -55.2549] | [ -0.0177, -0.0559] | -3361.5696
6 | [-17.4971, -55.2699] | [ -0.0047, -0.0150] | -3361.5774
7 | [-17.4984, -55.2739] | [ -0.0013, -0.0040] | -3361.5776
8 | [-17.4987, -55.2750] | [ -0.0003, -0.0011] | -3361.5774
9 | [-17.4988, -55.2753] | [ -0.0001, -0.0003] | -3361.5776
Documentation
Please refer to https://tfmpc.readthedocs.io/ for the code documentation.
License
Copyright (c) 2020- Thiago P. Bueno All Rights Reserved.
tfmpc is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
tfmpc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with tfmpc. If not, see http://www.gnu.org/licenses/.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tfmpc-0.8.0.tar.gz.
File metadata
- Download URL: tfmpc-0.8.0.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ff6f85682d9164fee5ecff6be990f0d78483127ad21d858dcfaf4c129bef934
|
|
| MD5 |
c27883121944de58be97320d35039635
|
|
| BLAKE2b-256 |
0669368b3d5d809224329eccf4770ab7d244d2c580cf50413a5cde5efe5c6e5f
|
File details
Details for the file tfmpc-0.8.0-py3-none-any.whl.
File metadata
- Download URL: tfmpc-0.8.0-py3-none-any.whl
- Upload date:
- Size: 56.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a0f1d6eb0dc8cb222ee5acf49310d4362e3a771a0b04d764db60ac64069ad12
|
|
| MD5 |
54348b9f6d476e1847ed830e369c9977
|
|
| BLAKE2b-256 |
1d0f8c3adf9045cb2c166069410be5c7d4269af4be9e36f024549cb80c44e631
|