⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainclone.m

📁 遗传算法用于函数优化问题
💻 M
字号:
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      %Q-C-A(Quantum Clone Algorithms)
      %
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      clear;
      q=(sqrt(1/2)).*ones(10,22); 
      v = 2*rand(50,22)-1;
      v=hardlim(v);
      v(1,:)=ones(1,22);
      disp(sprintf('** Please select the algorithm **'));
      disp(sprintf('1-SGA'));
      disp(sprintf('2-Clone-GA'));
      disp(sprintf('3-KClone-GA'));
      disp(sprintf('4-Self Adaptive Chaos Quantum Algorithm'));
      pp = input('Type the desired  number (or CTRL^C to Interrupt): ');
      
      numfunction = input('Type the desired function number (or CTRL^C to Interrupt): ');
      
      switch pp
      case 1
          [X,Y,x,y,fx,vx,vmfit,P] = genetic(numfunction,v);
      case 2
         [X,Y,x,y,fx,vx,vmfit,P] = clone(numfunction,q);
      case 3
         [X,Y,x,y,fx,vx,vmfit,P] = clone1(numfunction,q);
     case 4
         [X,x,fx,vx,vmfit,P] = selfc(numfunction);
      end
      disp(sprintf('Maximum found [f(x,y)]: [%.2f]',fx));
%       xx=vx;yy=vmfit;
      figure(2); plot(vx,'k'); 
      title('f(x,y) x Mean'); xlabel('Generations'); ylabel('f(x,y)');
      hold on; plot(vmfit,'k:'); legend('best','mean',0);hold off;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -