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

📄 ga_init.m

📁 这是好用的源代码
💻 M
字号:
%
% Creating a front end for the tree structured genetic algorithm
%
            
%                      Ben.McKay & Mark Willis
%                             (c) 1995
% 
%                 Dept. of Chemical Engineering               
%                       University of Sydney
%
%                               &
%
%            Dept. of Chemical and Process Engineering
%                University of Newcastle-Upon-Tyne
%
%       This package may not be modified, reproduced or sold
%              without the permission of the authors.
%

% Author             Date     Predecessor   Modification
% ======             ====     ===========   ============
% B.McKay M.Willis   26/5/95      -              -
%
% Function Calls: ga_inp, ga_selec, ga_view1, ga_ini
% ==============  
%    
% Last Modification: 8/8/95
% =================
%

da_front
data_comb=0;
output_var=[];





%--
main=figure('Number','Off',...
        'Name','Genetic Programming Algorithm for Steady-State System Identification',...
        'Menubar','None',...
        'Resize','off',...
        'Units','Pixels',...
        'Position',[0 0 636 455]);
	
%
% Use a push button (without callback, i.e. inactive) for text title
%
datitle_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[50 390 500 25],...
        'String','Genetic Programming Algorithm for Steady-State System Identification');

datinn_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[50 365 500 25],...
        'String','Load Data from File:   ',...
        'Callback',[...
        'if get(datinn_rb,''string'')==''Load Data from File:   '';',...
        'set(datinn_rb,''string'',''Data being Loaded: Wait'');',...
        '[data data_loaded]=ga_inp;',...
                'if data_loaded == 1;',...
                '[D L]=size(data);',...
                'set(datinn_rb,''string'',''Data Loaded Sucessfully'');',...
                'set(datinn_rb,''enable'',''off'');',...
                'end;',...      
        'end;']);
%
% Choose the input-output combination
%
datwho_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[50 340 250 25],...
        'String','Choose Input Output Data Combination',...
        'Callback',[...
        'if data_loaded == 1;',...
                'ga_selec;',...
                'data_comb=1;',...
        'else;',...
                'dialog(''style'',''error'',''replace'',''on'',''resize'',''off'',''name'',''Error'',''Textstring'',e2);',...
        'end;']);

datlok_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[300 340 250 25],...
        'String','Plot the data',...
        'Callback',[...
                'if data_loaded == 1;',...
                'ga_view1;',...
                'gobck;',...
                'else;',...
                'dialog(''style'',''error'',''replace'',''on'',''resize'',''off'',''name'',''Error'',''Textstring'',e1);',...           
                'end;']);

gainit_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[50 315 250 25],...
        'String','Initialise the GA',...
        'Callback',[...
        'if data_loaded == 1 & data_comb == 1 & sum(output_var) > 0;'...
                'close(gcf);',...
                'ga_ini;',...
        'else;',...
                'dialog(''style'',''error'',''replace'',''on'',''resize'',''off'',''name'',''Error'',''Textstring'',e3);',...   
        'end;']);

closebtn=uicontrol(gcf,'Style','Push',...
        'Position',[300 315 250 25],...
        'String','Close',...
        'Callback',[...
        'close(gcf);',...
        'clear all;']);

%
% Set up error strings
%

%
% No data loaded #1
%
e1=['         You have not loaded any  data'
   '         into the programme yet.  This'
   '         means  that  analysing it  is'
   '         going to be tricky ....      '];    

%
% No data loaded #2
%
e2=['         You have not loaded any  data'
   '         into the programme yet.  This'
   '         means  that  choosing a      '
   '         combination is going to be   '
   '         tricky ....                  '];    
%
% No data or No combination

e3=['         You have not loaded any  data '
   '         into the programme or you have'
   '         not chosen the I/O combination'
   '         or no output is specified     '];    

        

⌨️ 快捷键说明

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