How to use binary bits in genetic algorithm for integer constraints?

조회 수: 4 (최근 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.

채택된 답변

Walter Roberson
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
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 CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by