ahmedfgad / GeneticAlgorithmPython

Source code of PyGAD, a Python 3 library for building the genetic algorithm and training machine learning algorithms (Keras & PyTorch).
https://pygad.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.87k stars 462 forks source link

encoding process #81

Open mf093087 opened 2 years ago

mf093087 commented 2 years ago

I am a beginner in programming. May I ask, does this package have encoding and decoding process? For example, binary encoding. where can I see this?

ahmedfgad commented 2 years ago

The project supports both decimal and binary encoding. But it does not convert one encoding to another. That is a decimal gene will not be encoded in binary and then decoded back to decimal.

To use binary encoding, simply set gene_space=[0, 1] in the constructor of the pygad.GA class.

To know about how to use different representations in PyGAD, please check this article: https://blog.paperspace.com/working-with-different-genetic-algorithm-representations-python