DarwinPy-0.0.1
توضیحات
A evolutionary computation module
| ویژگی | مقدار |
|---|---|
| سیستم عامل | Microsoft :: Windows :: Windows 10 |
| نام فایل | DarwinPy-0.0.1 |
| نام | DarwinPy |
| نسخه کتابخانه | 0.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Pius Arhanbhunde |
| ایمیل نویسنده | pjacks419@gmail.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/DarwinPy/ |
| مجوز | MIT License |
# DarwinPy
A evolutionary computation module built with python
Sample DarwinPy implementation
```python
import DarwinPy
import numpy as np
def hammingDist(goal, matrix):
result = []
for i in range(len(matrix)):
temp = 0.
for j in range(len(goal)):
if goal[j] == matrix[i][j]:
temp += 1.
result.append(temp)
return result
if __name__ == "__main__":
mouse_population = 5
mutation_rate = 0.5
search_space = (0,1)
goal = np.array([1,0,1,1,0,1,1, 0,1,1,0],int)
chromosome_length = len(goal)
mouse_species = DarwinPy.Genetics.Genetics(chromosome_length,
mouse_population, (0,1), int)
print("mouse species instantiated:\n {}".format(mouse_species))
print("the goal:\n {}".format(goal))
mouse_species.populate()
print("get mouse matrix(GA):\n {}".
format(mouse_species.getChromosomeMatrix()))
fitness_vector = np.array(
hammingDist(goal,mouse_species.getChromosomeMatrix()),
float)
print("get fitness vector: {}".format(fitness_vector))
is_goal = False
gen = 1
while is_goal == False:
print("Generation #{}\n".format(gen))
gen += 1
mouse_species.evolve(fitness_vector,
mutation_rate, 0.5)
print("get mouse matrix(GA):\n {}".
format(mouse_species.getChromosomeMatrix()))
fitness_vector = np.array(
hammingDist(goal,mouse_species.getChromosomeMatrix()),
float)
print("get fitness vector: {}".format(fitness_vector))
if chromosome_length in fitness_vector:
is_goal = True
```
Change Log
==========
0.0.1 (10/10/2021)
------------------
- First Release
نحوه نصب
نصب پکیج whl DarwinPy-0.0.1:
pip install DarwinPy-0.0.1.whl
نصب پکیج tar.gz DarwinPy-0.0.1:
pip install DarwinPy-0.0.1.tar.gz