SevgiAkten / pycellga

Cellular Genetic Algorithms in Python.
https://sevgiakten.github.io/pycellga/
MIT License
2 stars 1 forks source link

Design Problem with cga #41

Closed jbytecode closed 2 months ago

jbytecode commented 2 months ago

cga is defined as

def cga(
    n_cols: int,
    n_rows: int,
    n_gen: int,
    ch_size: int,
    gen_type: str,
    p_crossover: float,
    p_mutation: float,
    problem: AbstractProblem,
    selection: Callable,
    recombination: Callable,
    mutation: Callable,
    mins : list[float] = [],
    maxs : list[float] = []
) -> List:

but selection, recombination, and mutation are classes, not callables

jbytecode commented 2 months ago

This commit (https://github.com/SevgiAkten/pycellga/commit/ccf8ffe54b8ddb73ce8b806fe67afea2e5721019) fixes this issue and the new optimizer definition is

def cga(
    n_cols: int,
    n_rows: int,
    n_gen: int,
    ch_size: int,
    gen_type: str,
    p_crossover: float,
    p_mutation: float,
    problem: AbstractProblem,
    selection: SelectionOperator,
    recombination: RecombinationOperator,
    mutation: MutationOperator,
    mins : list[float] = [],
    maxs : list[float] = []
) -> List:

please review the changes and feel free to close this issue

SevgiAkten commented 2 months ago

Thank you! I’ve reviewed the changes, and I’m closing the issue now.