How can I view the automatically generated initial population from GA in Global Optimization Toolbox?
    조회 수: 11 (최근 30일)
  
       이전 댓글 표시
    
I am using the GA function in the Optimization Toolbox, and I'm trying to figure out how I can see the initial population that MATLAB created for me. Any tips on that?
댓글 수: 0
채택된 답변
  Prabhakar
    
 2011년 1월 18일
        To see the intial population, one can specify/set the 'OutputFcns' property from the option used by GA. The function set by 'OutputFcns' gets called every itteration. First write a function MATLAB file called my_view containing
    function [state, options,optchanged] =  my_view(options,state,flag,interval)  
    optchanged = false; 
  disp(state.Population) 
    end
Now set the 'OutputFcns' property to this function via
options = gaoptimset('OutputFcns',@my_view);
Finally call the GA function with this specified option
x = ga(fitnessfcn,nvars,options)
댓글 수: 2
  saranya thangavel
 2014년 1월 30일
				i am using GA for feture selection,i need to specify my features in initial population.features are in double vectore format.can u tell me how to specify those values in initial population? i need format,i am using matlab12b optimization toolbox
  Igor
      
 2014년 1월 30일
				saranya thangavel,
I might not have understood what you mean, but if you need to pass your initial population instead of having GA produce it for you using a creation function, this can be done with the Initial population option. From the help:
Initial population (InitialPopulation) specifies an initial population for the genetic algorithm. The default value is [], in which case ga uses the default Creation function to create an initial population. If you enter a nonempty array in the Initial population field, the array must have no more than Population size rows, and exactly Number of variables columns. In this case, the genetic algorithm calls a Creation function to generate the remaining individuals, if required.
Then use something like
options = gaoptimset('InitialPopulation', Your_population)
and call GA with this options structure.
You can also write your own creation function.
추가 답변 (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!



