diff --git a/EasyGA/EasyGA.py b/EasyGA/EasyGA.py index d204fe2..5c91c5d 100644 --- a/EasyGA/EasyGA.py +++ b/EasyGA/EasyGA.py @@ -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. diff --git a/EasyGA/attributes.py b/EasyGA/attributes.py index 7e78c34..89e78c4 100644 --- a/EasyGA/attributes.py +++ b/EasyGA/attributes.py @@ -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 diff --git a/README.md b/README.md index 18fa659..2b78c15 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,6 @@ Chromosome - 8 [E][a][s][y][Z][A] / Fitness = 5 Chromosome - 9 [E][a][s][Y][G][A] / Fitness = 5 ``` -![]() ## Issues