All Projects → Shunichi09 → Pythonlinearnonlinearcontrol

Shunichi09 / Pythonlinearnonlinearcontrol

Licence: mit
PythonLinearNonLinearControl is a library implementing the linear and nonlinear control theories in python.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pythonlinearnonlinearcontrol

Dreamerv2
Mastering Atari with Discrete World Models
Stars: ✭ 287 (-9.75%)
Mutual labels:  reinforcement-learning
Seq2seq Summarizer
Pointer-generator reinforced seq2seq summarization in PyTorch
Stars: ✭ 306 (-3.77%)
Mutual labels:  reinforcement-learning
Elf
ELF: a platform for game research with AlphaGoZero/AlphaZero reimplementation
Stars: ✭ 3,240 (+918.87%)
Mutual labels:  reinforcement-learning
Agentnet
Deep Reinforcement Learning library for humans
Stars: ✭ 298 (-6.29%)
Mutual labels:  reinforcement-learning
Tetris mcts
MCTS project for Tetris
Stars: ✭ 303 (-4.72%)
Mutual labels:  reinforcement-learning
Gdrl
Grokking Deep Reinforcement Learning
Stars: ✭ 304 (-4.4%)
Mutual labels:  reinforcement-learning
Deep Learning Nlp Rl Papers
Recent Deep Learning papers in NLU and RL
Stars: ✭ 288 (-9.43%)
Mutual labels:  reinforcement-learning
Reinforcement Learning
Learn Deep Reinforcement Learning in 60 days! Lectures & Code in Python. Reinforcement Learning + Deep Learning
Stars: ✭ 3,329 (+946.86%)
Mutual labels:  reinforcement-learning
Pytorch Trpo
PyTorch implementation of Trust Region Policy Optimization
Stars: ✭ 303 (-4.72%)
Mutual labels:  reinforcement-learning
A3c trading
Trading with recurrent actor-critic reinforcement learning
Stars: ✭ 305 (-4.09%)
Mutual labels:  reinforcement-learning
Neuron poker
Texas holdem OpenAi gym poker environment with reinforcement learning based on keras-rl. Includes virtual rendering and montecarlo for equity calculation.
Stars: ✭ 299 (-5.97%)
Mutual labels:  reinforcement-learning
Pytorch Soft Actor Critic
PyTorch implementation of soft actor critic
Stars: ✭ 300 (-5.66%)
Mutual labels:  reinforcement-learning
Neural Symbolic Machines
Neural Symbolic Machines is a framework to integrate neural networks and symbolic representations using reinforcement learning, with applications in program synthesis and semantic parsing.
Stars: ✭ 305 (-4.09%)
Mutual labels:  reinforcement-learning
Tensorwatch
Debugging, monitoring and visualization for Python Machine Learning and Data Science
Stars: ✭ 3,191 (+903.46%)
Mutual labels:  reinforcement-learning
Reward Learning Rl
[RSS 2019] End-to-End Robotic Reinforcement Learning without Reward Engineering
Stars: ✭ 310 (-2.52%)
Mutual labels:  reinforcement-learning
Deep rl
PyTorch implementations of Deep Reinforcement Learning algorithms (DQN, DDQN, A2C, VPG, TRPO, PPO, DDPG, TD3, SAC, SAC-AEA)
Stars: ✭ 291 (-8.49%)
Mutual labels:  reinforcement-learning
Baby Steps Of Rl Ja
Pythonで学ぶ強化学習 -入門から実践まで- サンプルコード
Stars: ✭ 302 (-5.03%)
Mutual labels:  reinforcement-learning
Deeprl Tensorflow2
🐋 Simple implementations of various popular Deep Reinforcement Learning algorithms using TensorFlow2
Stars: ✭ 319 (+0.31%)
Mutual labels:  reinforcement-learning
Openai lab
An experimentation framework for Reinforcement Learning using OpenAI Gym, Tensorflow, and Keras.
Stars: ✭ 313 (-1.57%)
Mutual labels:  reinforcement-learning
Self Driving Truck
Self-Driving Truck in Euro Truck Simulator 2, trained via Reinforcement Learning
Stars: ✭ 307 (-3.46%)
Mutual labels:  reinforcement-learning

Coverage Status GitHub issues open Build Status

PythonLinearNonlinearControl

PythonLinearNonlinearControl is a library implementing the linear and nonlinear control theories in python. Due to use only basic libralies (scipy, numpy), this library is easy to extend for your own situations.

Algorithms

Algorithm Use Linear Model Use Nonlinear Model Need Gradient (Hamiltonian) Need Gradient (Model) Need Hessian (Model)
Linear Model Predictive Control (MPC) x x x x
Cross Entropy Method (CEM) x x x
Model Preidictive Path Integral Control of Nagabandi, A. (MPPI) x x x
Model Preidictive Path Integral Control of Williams, G. (MPPIWilliams) x x x
Random Shooting Method (Random) x x x
Iterative LQR (iLQR) x x x
Differential Dynamic Programming (DDP) x x
Unconstrained Nonlinear Model Predictive Control (NMPC) x x x
Constrained Nonlinear Model Predictive Control CGMRES (NMPC-CGMRES) x x x
Constrained Nonlinear Model Predictive Control Newton (NMPC-Newton) x x x x

"Need Gradient" means that you have to implement the gradient of the model or the gradient of hamiltonian.

Following algorithms are implemented in PythonLinearNonlinearControl

Environments

There are 4 example environments, "FirstOrderLag", "TwoWheeledConst", "TwoWheeledTrack" and "Cartpole".

Name Linear Nonlinear State Size Input size
First Order Lag System x 4 2
Two wheeled System (Constant Goal) x 3 2
Two wheeled System (Moving Goal) x 3 2
Cartpole (Swing up) x 4 1
Nonlinear Sample System Env x 2 1

All states and inputs of environments are continuous. It should be noted that the algorithms for linear model could be applied to nonlinear enviroments if you have linealized the model of nonlinear environments.

You could know abount our environmets more in Environments.md

Installation

To install this package

python setup.py install

or

pip install .

When developing the package

python setup.py develop

or

pip install -e .

Basic concepts

When we design control systems, we should have Model, Planner, Controller and Runner as shown in the figure. It should be noted that Model and Environment are different. As mentioned before, we the algorithms for linear model could be applied to nonlinear enviroments if you have linealized model of nonlinear environments. In addition, you can use Neural Network or any non-linear functions to the model, although this library can not deal with it now.

Model

System model. For an instance, in the case that a model is linear, this model should have a form, "x[k+1] = Ax[k] + Bu[k]".

If you use gradient based control method, you are preferred to implement the gradients of the model, other wise the controllers use numeric gradients.

Planner

Planner make the goal states.

Controller

Controller calculate the optimal inputs by using the model by using the algorithms.

Runner

Runner runs the simulation.

Please, see more detail in each scripts.

Getting started

QuickStart Guide

This is a quickstart guide for users who just want to try PythonLinearNonlinearControl. If you have not installed PythonLinearNonLinearControl, please see the section of "how to setup" in README.md

When we design control systems, we should have Environment, Model, Planner, Controller and Runner. Therefore your script contains those Modules.

First, import each Modules from PythonLinearNonlinearControl.

from PythonLinearNonlinearControl import configs 
from PythonLinearNonlinearControl import envs
from PythonLinearNonlinearControl import models
from PythonLinearNonlinearControl import planners
from PythonLinearNonlinearControl import controllers
from PythonLinearNonlinearControl import runners

Configs contains each modules configurations such as cost functions, prediction length, ...etc.

Then you can make each module. (This is example about CEM and CartPole env)

config = configs.CartPoleConfigModule()
env = envs.CartPoleEnv()
model = models.CartPoleModel(config)
controller = controllers.CEM(config, model)
planner = planners.ConstantPlanner(config)
runner = runners.ExpRunner()

The preparation for experiment has done! Please run the runner.

history_x, history_u, history_g = runner.run(env, controller, planner) 

You can get the results of history of state, history of input and history of goal. Use that histories to visualize the Animation or Figures. (Note FirstOrderEnv does not support animation)

# plot results
plot_results(history_x, history_u, history_g=history_g)
save_plot_data(history_x, history_u, history_g=history_g)

# create animation
animator = Animator(env)
animator.draw(history_x, history_g)

It should be noted that the controller parameters like Q, R and Sf strongly affect the performence of the controller. Please, check these parameters before you run the simulation.

Run Example Script

You can run the example script as follows:

python scripts/simple_run.py --env CartPole --controller CEM --save_anim 1

figures and animations are saved in the ./result folder.

Old version

If you are interested in the old version of this library, that was not a library just examples, please see v1.0

Documents

Coming soon !!

Requirements

  • numpy
  • scipy
  • matplotlib (for figures and animations)
  • ffmpeg (for animations)

License

PythonLinearNonlinearControl is licensed under the MIT License. However, some scripts are available under different license terms. See below.

The following parts are licensed under GPL3+:

See the licenses folder for the full text of the licenses.

Citation

@Misc{PythonLinearNonLinearControl,
author = {Shunichi Sekiguchi},
title = {PythonLinearNonlinearControl},
note = "\url{https://github.com/Shunichi09/PythonLinearNonlinearControl}",
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].