필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

could anyone hep me to clear my doubt

조회 수: 2 (최근 30일)
jaah navi
jaah navi 2019년 4월 3일
마감: MATLAB Answer Bot 2021년 8월 20일
In Particle swarm optimization for minimization, the global best is initialized to inf ;
for maximization the global best is initialized to -inf;
But in general inf is a largest value and how it can be used for minimization
and -inf is a smallest value and how it can be used for maximization.
Could anyone please clarify it.

답변 (1개)

Rik
Rik 2019년 4월 3일
Because inf is the extreme, you can use it to find the next value in your data. As an example, the code below finds the maximum value in a vector:
max_val=-inf;
data=rand(1,100);
for n=1:numel(data)
if data(n)>max_val%is bigger than current max?
max_val=data(n);%store new max
end
end
Now the -inf will be replaced by the actual larger value once it finds one. The only case where it will stay -inf is when all values in the data are -inf, in which case it is indeed the maximum value.
Minimization works the same in the reverse case.
  댓글 수: 1
Rik
Rik 2019년 4월 9일
Did this suggestion solve your problem? If so, please consider marking it as accepted answer. It will make it easier for other people with the same question to find an answer. If this didn't solve your question, please comment with what problems you are still having.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by