Revision 1181, 0.7 kB
(checked in by zimamiro, 14 years ago)
|
|
Line | |
---|
1 | function candidates=generate_candidates(best_control, search_region, num_of_candidates)
|
---|
2 | if (mod(num_of_candidates,2)==0)
|
---|
3 | pom=((-((num_of_candidates-2)/2)):((num_of_candidates-2)/2))/((num_of_candidates-2)/2);
|
---|
4 | candidates=best_control*ones(num_of_candidates-1,1)+pom'*search_region;
|
---|
5 | candidates(num_of_candidates)=best_control+(2*rand-1)*search_region;
|
---|
6 | else
|
---|
7 | pom=((-((num_of_candidates-1)/2)):((num_of_candidates-1)/2))/((num_of_candidates-1)/2);
|
---|
8 | candidates=best_control*ones(num_of_candidates,1)+pom'*search_region;
|
---|
9 | end
|
---|
10 | pom1=(max(candidates)-min(candidates))/(2*num_of_candidates);
|
---|
11 | for i=1:num_of_candidates
|
---|
12 | if(candidates(i)<0)
|
---|
13 | candidates(i)=abs(abs(candidates(i))-pom1);
|
---|
14 | end
|
---|
15 | end
|
---|
16 | end
|
---|