📄 ww.asv
字号:
function varargout = ww(varargin)
% WW M-file for ww.fig
% WW, by itself, creates a new WW or raises the existing
% singleton*.
%
% H = WW returns the handle to a new WW or the handle to
% the existing singleton*.
%
% WW('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in WW.M with the given input arguments.
%
% WW('Property','Value',...) creates a new WW or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before ww_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to ww_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help ww
% Last Modified by GUIDE v2.5 25-May-2006 09:48:45
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ww_OpeningFcn, ...
'gui_OutputFcn', @ww_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before ww is made visible.
function ww_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to ww (see VARARGIN)
% Choose default command line output for ww
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes ww wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = ww_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)Size=80;
G=1000;
CodeL=21;
umax=10.;
umin=-10;
E=round(rand(Size,CodeL));
for k=1:1:G
time(k)=k;
for s=1:1:Size
m=E(s,:);
y=0;
m1=m(1:1:CodeL);
for j=1:1:CodeL
y=y+m1(j)*2^(j-1);
end
x=(umax-umin)*y/2097151+umin;
F(s)=(0.5+(sin(sum(x.^2)).^(1/2).*sin(sum(x.^2)).^(1/2)-0.5)/(1.0+0.01*sum(x.^2)).^2);;
end
fi=F;
[Oderfi,Indexfi]=sort(fi);
Minfi=Oderfi(1);
MinS=E(Indexfi(1),:);
bfi(k)=Minfi;
fi_sum=sum(fi);
fi_Size=(Oderfi/fi_sum)*Size;
fi_S=floor(fi_Size);
kk=1;
for i=1:1:Size
for j=1:1:fi_S(i)
TempE(kk,:)=E(Indexfi(i),:);
kk=kk+1;
end
end
pc=0.60;
n=ceil(20*rand);
for i=1:2:(Size-1)
temp=rand;
if pc>temp
for j=n:1:20
TempE(i,j)=E(i+1,j);
TempE(i+1,j)=E(i,j);
end
end
end
TempE(Size,:)=MinS;
E=TempE;
pm=0.1;
for i=1:1:Size
for j=1:1:CodeL
temp=rand;
if pm>temp
if TempE(i,j)==0
TempE(i,j)=1;
else
TempE(i,j)=0;
end
end
end
end
TempE(Size,:)=MinS;
E=TempE;
end
x
Min_Value=Minfi
MinS
% --- Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)clc% --- Executes on button press in pushbutton5.function pushbutton5_Callback(hObject, eventdata, handles)% hObject handle to pushbutton5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)Size=80;
G=10000;
CodeL=21;
umax=10.;
umin=-10;
E=round(rand(Size,CodeL));
for k=1:1:G
time(k)=k;
for s=1:1:Size
m=E(s,:);
y=0;
m1=m(1:1:CodeL);
for j=1:1:CodeL
y=y+m1(j)*2^(j-1);
end
x=(umax-umin)*y/2097151+umin;
F(s)=(0.5+(sin(sum(x.^2)).^(1/2).*sin(sum(x.^2)).^(1/2)-0.5)/(1.0+0.01*sum(x.^2)).^2);;
end
fi=F;
[Oderfi,Indexfi]=sort(fi);
Minfi=Oderfi(1);
MinS=E(Indexfi(1),:);
bfi(k)=Minfi;
fi_sum=sum(fi);
fi_Size=(Oderfi/fi_sum)*Size;
fi_S=floor(fi_Size);
kk=1;
for i=1:1:Size
for j=1:1:fi_S(i)
TempE(kk,:)=E(Indexfi(i),:);
kk=kk+1;
end
end
pc=0.60;
n=ceil(20*rand);
for i=1:2:(Size-1)
temp=rand;
if pc>temp
for j=n:1:20
TempE(i,j)=E(i+1,j);
TempE(i+1,j)=E(i,j);
end
end
end
TempE(Size,:)=MinS;
E=TempE;
pm=0.1;
for i=1:1:Size
for j=1:1:CodeL
temp=rand;
if pm>temp
if TempE(i,j)==0
TempE(i,j)=1;
else
TempE(i,j)=0;
end
end
end
end
TempE(Size,:)=MinS;
E=TempE;
end
x
Min_Value=Minfi
MinS% --- Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)close(ww)
c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -