This commit is contained in:
SimpleArt
2021-06-10 22:15:37 -04:00
3 changed files with 3 additions and 4 deletions

View File

@ -93,7 +93,8 @@ class GA(Attributes):
self.sort_by_best_fitness()
# Save the population to the database
self.save_population()
if self.save_data:
self.save_population()
# Adapt the ga if the generation times the adapt rate
# passes through an integer value.

View File

@ -180,6 +180,7 @@ class Attributes:
database: Database = field(default_factory=sql_database.SQL_Database)
database_name: str = 'database.db'
save_data: bool = True
sql_create_data_structure: str = """
CREATE TABLE IF NOT EXISTS data (
id INTEGER PRIMARY KEY,
@ -418,10 +419,8 @@ def get_database_name(self: Attributes) -> str:
def set_database_name(self: Attributes, name: str) -> None:
# Update the database class' name
self.database._database_name = name
# Set the attribute for itself
self._database_name = name

View File

@ -109,7 +109,6 @@ Chromosome - 8 [E][a][s][y][Z][A] / Fitness = 5
Chromosome - 9 [E][a][s][Y][G][A] / Fitness = 5
```
![]()
<img width="500px" src="https://raw.githubusercontent.com/danielwilczak101/EasyGA/media/images/password_cracker_results.png" />
## Issues