root/applications/dual/SIDP/generate_candidates.m @ 854

Revision 743, 0.9 kB (checked in by zimamiro, 15 years ago)
Line 
1function candidates=generate_candidates(best_control, search_region, num_of_candidates,mode)
2%OK
3%vraci sloupec kandidatu na rizeni
4switch mode
5    case (0)    %nahodne rozlozeni kandidatu
6        candidates=best_control*ones(num_of_candidates-1,1)+(2*rand(num_of_candidates-1,1)-ones(num_of_candidates-1,1))*search_region;
7        candidates(num_of_candidates)=best_control;
8    case (1)    %linearni rozlozeni kandidatu
9        if (mod(num_of_candidates,2)==0)
10            pom=((-((num_of_candidates-2)/2)):((num_of_candidates-2)/2))/((num_of_candidates-2)/2);
11            candidates=best_control*ones(num_of_candidates-1,1)+pom'*search_region;
12            candidates(num_of_candidates)=best_control+(2*rand-1)*search_region;
13        else
14            pom=((-((num_of_candidates-1)/2)):((num_of_candidates-1)/2))/((num_of_candidates-1)/2);
15            candidates=best_control*ones(num_of_candidates,1)+pom'*search_region;
16        end     
17end
18end
Note: See TracBrowser for help on using the browser.