This repository presents an approach to generating fault-tolerant reliable broadcast algorithms using Reinforcement Learning. The default behavior is to generate non-fault-tolerant algorithms. However, this can be configured to generate fault-tolerant algorithms for different failure modes (see Configuration section).
These instructions will get you a copy of the project up and running on your local machine.
- Python 3.10 virtual environment installed. To do that, you can run:
sudo apt install python3.10-venv
- Ports 5001, 5002 and 5003 available.
-
Go to folder
Generatorand open a terminal. -
On the folder
Generatorrun:./scripts/local/setup.sh
This will create the .env file and install the python libraries.
-
On the folder
Generatorrun:./scripts/local/start.sh
This will start the Generator component. In the end, this is what you should see:
-
Go to folder
Validatorand open a terminal. -
On the folder
Validatorrun:./scripts/local/setup.sh
This will create the .env file, install the python libraries and the spin framework.
-
On the folder
Validatorrun:./scripts/local/start.sh
This will start the Validator component. In the end, this is what you should see:
-
Go to folder
Clientand open a terminal. -
On the folder
Clientrun:./scripts/local/setup.sh
This will create the .env file and install the python libraries.
-
On the folder
Clientrun:./scripts/local/start_RBLearner.sh
This will start the process of generating the Reliable Broadcast algorithm on the foreground. In the end, this is what you should see:
You will be able to follow both generation and validation processes on the
GeneratorandValidatorterminals, respectively. A folder with the nameoutputwill appear on the root of the folderGeneratorfrom where the simulator will output the progress of the generation process.
These instructions will get you a copy of the project up and running on your local machine using Docker.
- Docker and Docker-compose installed (https://docs.docker.com/compose/install/).
-
Go to folder
Generatorand open a terminal. -
On the folder
Generatorrun:./scripts/docker/setup.sh
This will create the Generator docker image.
-
On the folder
Generatorrun:./scripts/docker/start.sh
This will start the Generator container. In the end, this is what you should see:
-
Go to folder
Validatorand open a terminal. -
On the folder
Validatorrun:./scripts/docker/setup.sh
This will create the Validator docker image.
-
On the folder
Validatorrun:./scripts/docker/start.sh
This will start the Validator container. In the end, this is what you should see:
-
Go to folder
Clientand open a terminal. -
On the folder
Clientrun:./scripts/docker/setup.sh
This will create the Client docker image.
-
On the folder
Clientrun:./scripts/docker/start_RBLearner.sh
This will start the process of generating the Reliable Broadcast algorithm on the foreground. In the end, this is what you should see:
You will be able to follow both generation and validation processes on the
GeneratorandValidatorterminals, respectively. A folder with the nameoutputwill appear on the root of the folderGeneratorfrom where the simulator will output the progress of the generation process. This folder will appear both locally and on the docker container.
The inputs can be changed in order to study different problems and find innovative solutions. In this section, I show you how to update some parameters of the inputs.
Note: these are only two possible examples of configuration. If you need help and want to change other inputs, please contact me.
The default failure-mode is the No-Failure mode. To change this input to generate a Crash-Failure or Byzantine-Failure algorithms:
-
Go to the folder
Client/inputs/Validationand open the filevalidation_inputs.jsonc. -
There you will see a
FailureModeproperty containing 3 objects:NO_FAILURE,CRASH_FAILUREandBYZANTINE_FAILURE. -
Each
FailureModecontains aModeproperty with a boolean value. Change theModeproperty totrueonly on the failure mode that you want to test.
Note: only one failure mode will be tested even if you put truein all cases. The order is No-Failure -> Crash-Failure -> Byzantine-Failure.
When changing the properties of the algorithm to be generated, an higher number of episodes may be needed to train the agent. To change that:
-
Go to the folder
Client/inputs/Generationand open the filegeneration_inputs.jsonc. -
There you will see a
NumberOfEpisodesproperty (default value is 1000) that you can change to a higher value.
Different technologies were used to implement this approach. Here we present the main technologies used.
Note: this code is for research purposes, meaning that programming issues are of secondary importance.







