Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update code comments #48

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading