This repository contains a Python script that simulates a randomized algorithm for solving the consensus problem in a distributed system. This is often analogized as the "Coordinated Attack" problem.
The script simulates a number of processes that try to reach a consensus (agree on a decision) despite the possibility of communication failures. The simulation runs the algorithm multiple times to measure its effectiveness and plots the results.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You need to have Python 3 installed on your system. You will also need the following Python libraries:
matplotlib
networkx
- Clone the repository to your local machine:
git clone https://github.com/TheMrn/Randomized-Coordinated-Attack.git
- Install the required libraries using pip:
pip install matplotlib networkx
To run the simulation, simply execute the random-attack.py
script:
python random-attack.py
The script will run a simulation and generate a plot showing the agreement rate as a function of the number of rounds (r
). The plot will be displayed in a new window.
The main parameters of the simulation, such as the number of processes and the number of rounds, can be adjusted by modifying the script.