How to use binary bits in genetic algorithm for integer constraints?
6 次查看(过去 30 天)
显示 更早的评论
I have five different integer constraints. But when I select bit string option in matlab ga toolbox, I get the below error:
Optimization running. Error running optimization. Problem has integer constraints. PopulationType must be set to 'doubleVector'.
Also, I am not allowed to use single point/two point crossover. By default matlab is using scattered crossover when there are integer constraints. If it is possible to use binary bits for integer constraints in matlab ga toolbox, where may I set the size of the binary bits? Please help.
0 个评论
采纳的回答
Walter Roberson
2017-2-28
When you use bitstring all variables are single bit binary that for performance reasons are stored as double.
You can use the other crossover with bitstring.
https://www.mathworks.com/help/gads/genetic-algorithm-options.html#f14223
10 个评论
Walter Roberson
2017-3-1
When you use bitstring as the population type, the elements will only ever be assigned 0.0 or 1.0.
You should not be using bitstring for integer ranges without using custom functions. Well, other than the possibility of binary numbers where you want crossover and mutation to happen at any bit boundaries.
For integer ranges like -5 to 15 you should either use intcons or custom functions.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!