A python package implementing the genetic algorithm
Project description
Genetic Algorithm
Installation
pip install genetic_algorithm
Use Cases
from genetic_algorithm import GeneticAlgorithm
def func(a,b,c,d):
return -(a-1)**2 - (b-3)**2 - (c-5) ** 2 - len(d)
def fitness(params):
return func(**params)
param_space = {"a": {'type': 'float', 'range':[0, 2]},
"b": {'type': 'float', 'range':[1, 5]},
"c": {'type': 'int', 'range':[3, 7]},
"d": {'type': 'object', 'range':['ab', 'abc', 'abcd', 'a']}}
ga = GeneticAlgorithm(model=fitness,
param_space=param_space,
pop_size=100,
parent_pool_size=5,
max_iter=100,
mutation_prob=0.2,
max_stop_rounds=5)
result = ga.evolve()
print(result)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file genetic_algorithm-0.2.2.tar.gz
.
File metadata
- Download URL: genetic_algorithm-0.2.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b60d71da6d71774f76280c6a71141855030485a1a535297df4341bb4a1a5362 |
|
MD5 | 84a775496248c44c0eac561debe73c69 |
|
BLAKE2b-256 | 71cba9714e85afc38ef1009ef184966d1c9190ad1ea3bffc8cc5d616edecb835 |