:warning: | This repository is no longer maintained. Please use bayesian-learning-control instead! |
---|
I used this repository to translate the LAC code of Minghoa into tf2 and Pytorch code. It currently contains the following translations:
All these solutions will give the same results but will differ in training time. The LAC_TF2 version is currently the fastest solution.
Below you will find the general instructions on how to use this package. Additionally, every translation also contains its own README.md.
From the general python package sanity perspective, it is a good idea to use Conda environments to make sure packages from different projects do not interfere with each other.
To create a Conda env with python3, one runs:
conda create -n <ENV_NAME> python=<PYTHON_VERSION>
To activate the env:
conda activate <ENV_NAME>
After you created and activated the Conda environment, you have to install the python dependencies. This can be done using the following command:
pip install -r requirements.txt
You can change the training parameters in the variant.py file. The essential variables are explained below:
use_lyapunov=True
) or SAC (use_lyapunov=False
) algorithm.After you set the right hyperparameter in the variant.py file, you can train an algorithm in a specific folder using the following command:
python <LAC_VERSION_NAME>/train.py
You can change the inference parameters in the variant.py file. The essential variables are explained below:
num_of_policies
parameter).After you trained an agent, you can evaluate the performance of the algorithm by running the following command:
python <LAC_VERSION_NAME>/inference_eval.py --model-name=<MODEL_NAME> --env-name=Ex3_EKF_gyro
Alternatively, you can set the eval_list
and ENV_NAME
parameters in the variant.py file and
run the inference with the shorter command:
python <LAC_VERSION_NAME>/inference_eval.py
New environments should be added to the ENVS_PARAMS
variable of the
variant.py file. While doing so please make sure you supply a valid
module and class name:
"oscillator": {
"module_name": "envs.oscillator",
"class_name": "oscillator",
"max_ep_steps": 800,
"max_global_steps": TRAIN_PARAMS["episodes"],
"max_episodes": int(1e6),
"eval_render": False,
},
After that, the new environment can be used by setting the ENV_NAME
variable of the
of the variant.py file.