Skip to content

Commit

Permalink
update code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytecode committed Aug 9, 2024
1 parent ccf8ffe commit 92792a4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
5 changes: 4 additions & 1 deletion src/individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
from problems.abstract_problem import AbstractProblem



class GeneType(Enum):
"""
GeneType is an enumeration class that represents the type of genome representation for an individual in an evolutionary algorithm.
The three types of genome representation are BINARY, PERMUTATION, and REAL.
"""
BINARY = 1
PERMUTATION = 2
REAL = 3
Expand Down
20 changes: 10 additions & 10 deletions src/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def cga(
Size of the tournament for selection.
problem : AbstractProblem
The problem instance used for fitness evaluation.
selection : Callable
selection : SelectionOperator
Function or class used for selecting parents.
recombination : Callable
recombination : RecombinationOperator
Function or class used for recombination (crossover).
mutation : Callable
mutation : MutationOperator
Function or class used for mutation.
mins : list[float]
List of minimum values for each gene in the chromosome (for real value optimization).
Expand Down Expand Up @@ -228,11 +228,11 @@ def sync_cga(
Probability of mutation in offspring.
problem : Callable[[List[float]], float]
Function to evaluate the fitness of a solution. Takes a list of floats and returns a float.
selection : Callable
selection : SelectionOperator
Function or class used for selecting parents.
recombination : Callable
recombination : RecombinationOperator
Function or class used for recombination (crossover).
mutation : Callable
mutation : MutationOperator
Function or class used for mutation.
mins : List[float]
List of minimum values for each gene in the chromosome (for real value optimization).
Expand Down Expand Up @@ -373,11 +373,11 @@ def alpha_cga(
Tournament size for selection.
problem : AbstractProblem
The problem instance used to evaluate fitness.
selection : Callable
selection : SelectionOperator
Function used for selection in the evolutionary algorithm.
recombination : Callable
recombination : RecombinationOperator
Function used for recombination (crossover) in the evolutionary algorithm.
mutation : Callable
mutation : MutationOperator
Function used for mutation in the evolutionary algorithm.
mins : List[float]
List of minimum values for each gene in the chromosome (for real value optimization).
Expand Down Expand Up @@ -527,7 +527,7 @@ def ccga(
Type of genome representation (GeneType.BINARY, Genetype.PERMUTATION, GeneType.REAL).
problem : AbstractProblem
The problem instance used to evaluate fitness.
selection : Callable
selection : SelectionOperator
Function used for selection in the evolutionary algorithm.
mins : List[float]
List of minimum values for each gene in the chromosome (for real value optimization).
Expand Down
6 changes: 5 additions & 1 deletion src/population.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
from enum import Enum


# "cga", "sync_cga", "alpha_cga", "ccga", "mcccga"
class OptimizationMethod(Enum):
"""
OptimizationMethod is an enumeration class that represents the optimization methods used in an evolutionary algorithm.
The five optimization methods are CGA, SYNCGA, ALPHA_CGA, CCGA, and MCCCGA.
"cga", "sync_cga", "alpha_cga", "ccga", "mcccga"
"""
CGA = 1
SYNCGA = 2
ALPHA_CGA = 3
Expand Down

0 comments on commit 92792a4

Please sign in to comment.