📄 stsp_v61_export.m
字号:
function varargout = stsp_v61_export(varargin)
% STSP_V61_EXPORT M-file for stsp_v61_export.fig
% STSP_V61_EXPORT, by itself, creates a new STSP_V61_EXPORT or raises the existing
% singleton*.
%
% H = STSP_V61_EXPORT returns the handle to a new STSP_V61_EXPORT or the handle to
% the existing singleton*.
%
% STSP_V61_EXPORT('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in STSP_V61_EXPORT.M with the given input arguments.
%
% STSP_V61_EXPORT('Property','Value',...) creates a new STSP_V61_EXPORT or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before stsp_v61_export_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to stsp_v61_export_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 stsp_v61_export
% Last Modified by GUIDE v2.5 22-Mar-2006 20:15:26
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @stsp_v61_export_OpeningFcn, ...
'gui_OutputFcn', @stsp_v61_export_OutputFcn, ...
'gui_LayoutFcn', @stsp_v61_export_LayoutFcn, ... 'gui_Callback', []);
if nargin && ischar(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 stsp_v61_export is made visible.
function stsp_v61_export_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 stsp_v61_export (see VARARGIN)
% Choose default command line output for stsp_v61_export
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes stsp_v61_export wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = stsp_v61_export_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;
function initial_temperature_Callback(hObject, eventdata, handles)
% hObject handle to initial_temperature (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of initial_temperature as text
% str2double(get(hObject,'String')) returns contents of initial_temperature as a double
s = str2double(get(hObject,'String'));
if isnan(s)
set(hObject,'String','1000')
end
if s < 0 | s > 10000
set(hObject,'String','1000')
end
% --- Executes during object creation, after setting all properties.
function initial_temperature_CreateFcn(hObject, eventdata, handles)
% hObject handle to initial_temperature (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function maximum_iterations_Callback(hObject, eventdata, handles)
% hObject handle to maximum_iterations (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of maximum_iterations as text
% str2double(get(hObject,'String')) returns contents of maximum_iterations as a double
s = str2double(get(hObject,'String'));
if isnan(s)
set(hObject,'String','10000')
end
if s < 1000 | s > 1000000
set(hObject,'String','10000')
end
% --- Executes during object creation, after setting all properties.
function maximum_iterations_CreateFcn(hObject, eventdata, handles)
% hObject handle to maximum_iterations (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function cooling_rate_Callback(hObject, eventdata, handles)
% hObject handle to cooling_rate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
s = sprintf('Cooling Rate : %0.3f',get(hObject,'Value'));
set(handles.cooling_rate_display, 'String', s);
% --- Executes during object creation, after setting all properties.
function cooling_rate_CreateFcn(hObject, eventdata, handles)
% hObject handle to cooling_rate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on slider movement.
function cities_to_swap_Callback(hObject, eventdata, handles)
% hObject handle to cities_to_swap (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
s = sprintf('Cities to swap : %d',get(hObject,'Value'));
set(handles.cities_to_swap_display,'String',s)
% --- Executes during object creation, after setting all properties.
function cities_to_swap_CreateFcn(hObject, eventdata, handles)
% hObject handle to cities_to_swap (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes during object creation, after setting all properties.
function cooling_rate_display_CreateFcn(hObject, eventdata, handles)
% hObject handle to cooling_rate_display (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function cities_to_swap_display_CreateFcn(hObject, eventdata, handles)
% hObject handle to cities_to_swap_display (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in start_button.
function start_button_Callback(hObject, eventdata, handles)
% hObject handle to start_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
selection = get(handles.select_data_set, 'Value');
switch selection
case 2
data_file;
case 3
loadbays29;
case 4
loadatt48;
case 5
loadst70;
case 6
loadpr76;
case 7
loadgr96;
case 8
loadeil101;
case 9
loadpcb442;
case 10
loadeil535;
end
if selection ~= 1
set(handles.initial_temperature, 'Enable', 'Off')
set(handles.cooling_rate, 'Enable', 'Off')
set(handles.maximum_iterations, 'Enable', 'Off')
set(handles.cities_to_swap, 'Enable', 'Off')
set(handles.start_button, 'Enable', 'Off')
set(handles.select_data_set, 'Enable', 'Off')
cities = load ('cities.mat');
cities = cities.cities;
simulatedannealing(cities,...
str2double(get(handles.initial_temperature,'String')),...
get(handles.cooling_rate,'Value'),...
str2double(get(handles.maximum_iterations,'String')),...
get(handles.cities_to_swap,'Value'));
set(handles.initial_temperature, 'Enable', 'On')
set(handles.cooling_rate, 'Enable', 'On')
set(handles.maximum_iterations, 'Enable', 'On')
set(handles.cities_to_swap, 'Enable', 'On')
set(handles.start_button, 'Enable', 'On')
set(handles.select_data_set, 'Enable', 'On')
end
% --- Executes on selection change in select_data_set.
function select_data_set_Callback(hObject, eventdata, handles)
% hObject handle to select_data_set (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns select_data_set contents as cell array
% contents{get(hObject,'Value')} returns selected item from select_data_set
% --- Executes during object creation, after setting all properties.
function select_data_set_CreateFcn(hObject, eventdata, handles)
% hObject handle to select_data_set (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Creates and returns a handle to the GUI figure.
function h1 = stsp_v61_export_LayoutFcn(policy)
% policy - create a new figure or use a singleton. 'new' or 'reuse'.
persistent hsingleton;
if strcmpi(policy, 'reuse') & ishandle(hsingleton)
h1 = hsingleton;
return;
end
appdata = [];
appdata.GUIDEOptions = struct(...
'active_h', 171.095825195313, ...
'taginfo', struct(...
'figure', 2, ...
'pushbutton', 3, ...
'slider', 5, ...
'uipanel', 2, ...
'text', 7, ...
'edit', 5, ...
'axes', 2, ...
'popupmenu', 2), ...
'override', 0, ...
'release', 13, ...
'resize', 'none', ...
'accessibility', 'callback', ...
'mfile', 1, ...
'callbacks', 1, ...
'singleton', 1, ...
'syscolorfig', 1, ...
'blocking', 0, ...
'lastSavedFile', 'C:\Aravind\Personal Stuffs\COURSES\Intelligent Systems\Simulated Annealing\SA_TSP\stsp_v61_export.m');
appdata.lastValidTag = 'figure1';
appdata.GUIDELayoutEditor = [];
h1 = figure(...
'Units','characters',...
'Color',[0.925490196078431 0.913725490196078 0.847058823529412],...
'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
'IntegerHandle','off',...
'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),...
'MenuBar','none',...
'Name','Simulated Annealing (MATLAB V6.1 Compatible)',...
'NumberTitle','off',...
'PaperPosition',get(0,'defaultfigurePaperPosition'),...
'Position',[103.8 23.5384615384616 150.4 37.9230769230769],...
'Resize','off',...
'HandleVisibility','callback',...
'Tag','figure1',...
'UserData',[],...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -