How to use binary bits in genetic algorithm for integer constraints?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
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
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
Thanks for replying. Actually I want to use binary bits for my problem (integer constraint) so that I could use single point or two point crossover. I don't want to use real coded GA. But apparently if you have integer variables, GA Tool Box overrides with its default sets. Please suggest.
Do not ask for integer constraints when population type is set to bitstring, and do not specify any constraints like lb or ub. Just give the population type as bitstring and give your choice of crossover. All variables will be configured as integer 0 or 1.
If you want use mixed integer with some variables that happen to be binary, or want to use all integer but some of them happen to be binary and you want special crossover, then that is a different situation than choosing population type bitstring, which is strictly for the case all bits are single bit binary.
For mixed integer or all integer cases where you want something different than the crossover provided automatically when you give intcons, then what you have to do is not tell it that you are using intcons or bitstring, and instead provide custom population and crossover and mutation functions that all just happen to only create integer values in appropriate positions
Ok. Thanks again. Let me try then.
Dear Walter, It's working. Thanks. Can you suggest me some reference material on the same? I want to study and see how is it actually works? Like how is it assigning 0 and 1 to integer variables and other stuff. Regards,
Ripunjoy
Which arrangement did you end up using?
The one with not asking for integer constraints. The first one. I haven't specified any bounds.
To confirm, you used population type bitstring ?
Yes, I have used population type as bit string (my constraints are only integers). But please tell me one thing, if I don't provide the bounds, how does is it know its bounds as I have bounds e.g. 5<x<15 (all integers). Actually these are some of the questions that I have. Also, how is it assigning 0 and 1 to integer variables, like are they single bit or 2 bits or so on. Please reply and if possible give me some links/files to refer. Thank you.
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.
Ok. Thanks
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
