ShuhuaGao / geppy

A framework for gene expression programming (an evolutionary algorithm) in Python
https://geppy.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
207 stars 76 forks source link

Linking operators for 3 or more genes in a chromosome #21

Closed FarshadTabasi closed 4 years ago

FarshadTabasi commented 4 years ago

Hi Shuhua,

Thank you for creating this great package!

Do you have any example with the number of genes more than 2 in a chromosome? I tried to increase the number of genes to 3 in example #2 (Simple mathematical expression inference), however I got "TypeError: add expected 2 arguments, got 3". I'm new to Python, not sure if I understand the code correctly, but it seems that the "add" operator does not work as a linker for more than 2 genes since it only accepts two parameters.

Regards, Shaun

ShuhuaGao commented 4 years ago

Hi, Shaun,

This is because the built-in 'add' operator in Python can only accept two arguments. If you have three genes, you need to provide a custom 'add' function that can accept three parameters. See this issue for more information.