How to set the variables of genetic algorithm toolbox changing 1 or 0?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
It would be much appropriated that if anybody can tell me how to let the variables changing 1 or 0 by using genetic algorithm toolbox.
x = ga(fitnessfcn,nvars)
how to make the output 'x' change either 1 or 0.
댓글 수: 0
채택된 답변
추가 답변 (1개)
Todd Leonhardt
2016년 5월 23일
편집: Todd Leonhardt
2016년 5월 23일
If the output x is between 0 and 1 then you can simply do:
round(x);
If not, then you can define a threshold and do:
x = 0;
if x > threshold
x = 1;
end
댓글 수: 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!