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
Generator
and open a terminal. -
On the folder
Generator
run:./scripts/local/setup.sh
This will create the .env file and install the python libraries.
-
On the folder
Generator
run:./scripts/local/start.sh
This will start the Generator component. In the end, this is what you should see:
-
Go to folder
Validator
and open a terminal. -
On the folder
Validator
run:./scripts/local/setup.sh
This will create the .env file, install the python libraries and the spin framework.
-
On the folder
Validator
run:./scripts/local/start.sh
This will start the Validator component. In the end, this is what you should see:
-
Go to folder
Client
and open a terminal. -
On the folder
Client
run:./scripts/local/setup.sh
This will create the .env file and install the python libraries.
-
On the folder
Client
run:./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
Generator
andValidator
terminals, respectively. A folder with the nameoutput
will appear on the root of the folderGenerator
from 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
Generator
and open a terminal. -
On the folder
Generator
run:./scripts/docker/setup.sh
This will create the Generator docker image.
-
On the folder
Generator
run:./scripts/docker/start.sh
This will start the Generator container. In the end, this is what you should see:
-
Go to folder
Validator
and open a terminal. -
On the folder
Validator
run:./scripts/docker/setup.sh
This will create the Validator docker image.
-
On the folder
Validator
run:./scripts/docker/start.sh
This will start the Validator container. In the end, this is what you should see:
-
Go to folder
Client
and open a terminal. -
On the folder
Client
run:./scripts/docker/setup.sh
This will create the Client docker image.
-
On the folder
Client
run:./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
Generator
andValidator
terminals, respectively. A folder with the nameoutput
will appear on the root of the folderGenerator
from 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/Validation
and open the filevalidation_inputs.jsonc
. -
There you will see a
FailureMode
property containing 3 objects:NO_FAILURE
,CRASH_FAILURE
andBYZANTINE_FAILURE
. -
Each
FailureMode
contains aMode
property with a boolean value. Change theMode
property totrue
only on the failure mode that you want to test.
Note: only one failure mode will be tested even if you put true
in 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/Generation
and open the filegeneration_inputs.jsonc
. -
There you will see a
NumberOfEpisodes
property (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.