SevgiAkten / pycellga

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

individual.py #53

Closed jbytecode closed 3 months ago

jbytecode commented 3 months ago

This is a description. Please feel free to close the issue when you got the point.

The constructor is

def __init__(self,
                 gen_type: GeneType = GeneType.BINARY,
                 ch_size: int = 0,
                 mins : list[float] = [],
                 maxs : list[float] = []):

Case 1

When we set ch_size = 5 and gen_type = BINARY, then a chromosome of binaries is created with len = 5

Case 2

When we set ch_size = 5 and gen_type = Permutation, then a chromosome of permutation is created with using numbers from 1 to 5

Case 3

When we set ch_size = 5 and gen_type = REAL, then a chromosome of reals is created with numbers between mins[i] and maxs[i] for i in 1 to 5.

So, we can cover all of the gen types using a single individual with its current form.

fyi.

jbytecode commented 3 months ago

The other option is to taking the Individual as an interface (like) and provide 3 classes with names BinaryIndividual, PermutationIndividual, and RealIndividual. It would be more clear in that design. This is up to you.

SevgiAkten commented 3 months ago

Thank you! I've reviewed the description and understand it. I'll close the issue now.