Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork495
-
I'm currently making some first steps with pygad and, after some difficulties in the beginning, this question arose. Is it possible to use mixed data types for genes? I know about the internal random function using float values, which then are converted to integer if the user setsgene_type=int. Right now I tend to stay with float and to convert these to int later, since I have some genes, which need to be float, others are integer. It confused me a bit regarding the mutation of genes as floating, which become the same integer after conversion (no mutation). Is this covered in some way? Just curious. Regards, |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Replies: 4 comments 4 replies
-
Hi Rainer, Despite being not supported yet, it is very interesting to have this feature in the next release of PyGAD to help you specify a data type for each gene. For now, all genes could be only of a single data type. Thank you at all! |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi Rainer, Your requested feature is supported in PyGAD 2.14.1 Tor example, if you have 2 Gene's where the first is int and the second is float, then use: Please try this feature and let me know if there are any problems to be solved or if you have any new features in mind to be included later. |
BetaWas this translation helpful?Give feedback.
All reactions
-
That was faster then any Police might allow .. great! At first I accidently downloaded 2.14, which did produce an error (AttributeError: module 'pygad' has no attribute 'GA'), but2.14.1 is working again. It seems to work on my in pro-gress examples, but printing the solution is not looking nice anymore. solution, solution_fitness, solution_idx = ga_instance.best_solution() gene_type=int, gene_type=[int, int, float], |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Sorry I had a problem in the I figured out the problem and fixed it. I pushed the new Thank you too much for your valuable feedback! |
BetaWas this translation helpful?Give feedback.
All reactions
-
A general question in this context would be decimal places of float genes. I my opinion (beyond what is going on during mutation) it would be helpful if one could decrease the precision of floats, global and/or individual. If this could also increase the whole workflow performance it would make sense to me, to use this i.e. for a exploratory run or for destinct use cases, where a finer granularity over a certain precision does not make any sense. |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
-
That is something interesting to be supported. Sure, controlling the precision for floating-point numbers is a good feature. I will add this feature in the to-do list to be supported in the next release. |
BetaWas this translation helpful?Give feedback.
All reactions
-
could be possible a gene type of boolean? or maybe a list of possible values? like [0,1] |
BetaWas this translation helpful?Give feedback.
All reactions
-
You can use |
BetaWas this translation helpful?Give feedback.