Simulating a Genetic Algorithm to solve a problem of Mono-Alphabetic encryption on a text file.
There are three types of algorithms:
- Regular - Runs a regular GA.
- Darwin - Runs a Darwin GA with local optimization on the solutions that are not passed on to the next generation.
- Lamarck - Runs a Lamarck GA with local optimization on the solutions that are passed on to the next generation.
- enc.txt
- Letter_Freq.txt
- Letter2_Freq.txt
- dict.txt
These files should be in the executable's directory.
Python version should be 3.6 or above.
Install all the requirements by running:
pip install -r requirements.txt
To run in CLI mode run:
python main.py [required flags] [optional flags]
The available flag are:
Optional:
-n: Setting the number of max tries the algorithm will run [default 10].
-ps: Setting the size of the population [default 300].
-acc: Setting the fitness goal of the algorithm [default 0.99].
Required flags:
-r: Run a regular Genetic Algorithm.
-d: Run a Darwin Genetic Algorithm.
-l: Run a Lamarck Genetic Algorithm.
Notice: Only one of the required flags can be chosen.
Install pyinstaller:
pip install pyinstaller
Create executable:
pyinstaller -wF -p src main.py
To run the executable in CLI mode run:
main.exe [required flags] [optional flags]
Notice: The flags here are the same as the flags to the python file.