Genetic Algorithm for Python
Project description
gapy
Genetic algorithm for Python 3.
What is this?
This algorithm is simply a class which can be directly implemented in your project.
Required Packages
You will need the following packages to run this algorithm (also listed in src/gapy/requirements.txt)
numpy
pandas
scipy
Pandas is only used for aesthetic reasons on the write method for the printing and is entirely optional. To remove this feature, simply comment out the method and set logging to False.
Instalation
A testing version is available in PyPI:
pip3 install genapy
How to use
The file test.py presents an example on how to use this algorithm. It requires a fitness function, which must receive a numpy array containing the population on each line, each composed of real numbers, and output a numpy vector with the fitness of each individual as a real number.
Probabilities for crossover or mutation are numbers in the interval [0,1] and set by the parameters crossover and mutation respectively. They both default to 0.5.
The output range of each parameter used to make up the individual can be scaled separately by passing a numpy array containing the upper and lower bounds in the shape (k,2), where k is the number of parameters (chromosome_size), and also setting has_mask to True.
The number of bits for each parameter can also be set as an integer in resolution.
A printing delay for the write method is set by passing the desired value in seconds on time_print.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genapy-0.0.13.tar.gz.
File metadata
- Download URL: genapy-0.0.13.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27ed5d9c5e5522d1389cd00ab19068e7589e4bce9aec1d322cfdf580b51d44a1
|
|
| MD5 |
691fb1f9fe383d1e56ccf5bcca3dad5e
|
|
| BLAKE2b-256 |
2f56069005a236affa56e7ed8033f0ce5b59eec6b641f9ddf9a03f9204c1b612
|
File details
Details for the file genapy-0.0.13-py3-none-any.whl.
File metadata
- Download URL: genapy-0.0.13-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffdfe434cd00f9aea5413c50e4465f1f0cba1898c0a665625e110e78d8b87c81
|
|
| MD5 |
990184031cfe8d8b5d11475a94492f9f
|
|
| BLAKE2b-256 |
c7840792e3c9580b6b6c875492c0ccc36a0a59e27eacc33f2bb65c5f486eb3bf
|