dialog used for calculating the largest p-decrease value copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut This file is part of SOS SOS is free software: you can redistribute it and/or modify it for academic and non-commercial purposes under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For commercial or for-profit uses, please contact the authors (sos@cnbc.cmu.edu). SOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
0001 % dialog used for calculating the largest p-decrease value 0002 % 0003 % copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut 0004 % 0005 % This file is part of SOS 0006 % 0007 % SOS is free software: you can redistribute it and/or modify 0008 % it for academic and non-commercial purposes 0009 % under the terms of the GNU General Public License as published by 0010 % the Free Software Foundation, either version 3 of the License, or 0011 % (at your option) any later version. For commercial or for-profit 0012 % uses, please contact the authors (sos@cnbc.cmu.edu). 0013 % 0014 % SOS is distributed in the hope that it will be useful, 0015 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 % GNU General Public License for more details. 0018 0019 % You should have received a copy of the GNU General Public License 0020 % along with SOS (see COPYING.txt). 0021 % If not, see <http://www.gnu.org/licenses/>. 0022 0023 0024 function varargout = maxpDecrease_Dialog(varargin) 0025 % MAXPDECREASE_DIALOG M-file for maxpDecrease_Dialog.fig 0026 % MAXPDECREASE_DIALOG, by itself, creates a new MAXPDECREASE_DIALOG or raises the existing 0027 % singleton*. 0028 % 0029 % H = MAXPDECREASE_DIALOG returns the handle to a new MAXPDECREASE_DIALOG or the handle to 0030 % the existing singleton*. 0031 % 0032 % MAXPDECREASE_DIALOG('CALLBACK',hObject,eventData,handles,...) calls the local 0033 % function named CALLBACK in MAXPDECREASE_DIALOG.M with the given input arguments. 0034 % 0035 % MAXPDECREASE_DIALOG('Property','Value',...) creates a new MAXPDECREASE_DIALOG or raises the 0036 % existing singleton*. Starting from the left, property value pairs are 0037 % applied to the GUI before maxpDecrease_Dialog_OpeningFcn gets called. An 0038 % unrecognized property name or invalid value makes property application 0039 % stop. All inputs are passed to maxpDecrease_Dialog_OpeningFcn via varargin. 0040 % 0041 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 0042 % instance to run (singleton)". 0043 % 0044 % See also: GUIDE, GUIDATA, GUIHANDLES 0045 0046 % Edit the above text to modify the response to help maxpDecrease_Dialog 0047 0048 % Last Modified by GUIDE v2.5 12-Sep-2010 13:41:31 0049 0050 % Begin initialization code - DO NOT EDIT 0051 gui_Singleton = 1; 0052 gui_State = struct('gui_Name', mfilename, ... 0053 'gui_Singleton', gui_Singleton, ... 0054 'gui_OpeningFcn', @maxpDecrease_Dialog_OpeningFcn, ... 0055 'gui_OutputFcn', @maxpDecrease_Dialog_OutputFcn, ... 0056 'gui_LayoutFcn', [] , ... 0057 'gui_Callback', []); 0058 if nargin && ischar(varargin{1}) 0059 gui_State.gui_Callback = str2func(varargin{1}); 0060 end 0061 0062 if nargout 0063 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 0064 else 0065 gui_mainfcn(gui_State, varargin{:}); 0066 end 0067 % End initialization code - DO NOT EDIT 0068 0069 0070 % --- Executes just before maxpDecrease_Dialog is made visible. 0071 function maxpDecrease_Dialog_OpeningFcn(hObject, eventdata, handles, varargin) 0072 % This function has no output args, see OutputFcn. 0073 % hObject handle to figure 0074 % eventdata reserved - to be defined in a future version of MATLAB 0075 % handles structure with handles and user data (see GUIDATA) 0076 % varargin command line arguments to maxpDecrease_Dialog (see VARARGIN) 0077 0078 % Choose default command line output for maxpDecrease_Dialog 0079 handles.output = hObject; 0080 0081 % Update handles structure 0082 guidata(hObject, handles); 0083 0084 % UIWAIT makes maxpDecrease_Dialog wait for user response (see UIRESUME) 0085 % uiwait(handles.figure_maxpDecrease_Dialog); 0086 0087 0088 % --- Outputs from this function are returned to the command line. 0089 function varargout = maxpDecrease_Dialog_OutputFcn(hObject, eventdata, handles) 0090 % varargout cell array for returning output args (see VARARGOUT); 0091 % hObject handle to figure 0092 % eventdata reserved - to be defined in a future version of MATLAB 0093 % handles structure with handles and user data (see GUIDATA) 0094 0095 % Get default command line output from handles structure 0096 varargout{1} = handles.output; 0097 0098 0099 0100 function edit_initDeltaCost_Callback(hObject, eventdata, handles) 0101 % hObject handle to edit_initDeltaCost (see GCBO) 0102 % eventdata reserved - to be defined in a future version of MATLAB 0103 % handles structure with handles and user data (see GUIDATA) 0104 0105 % Hints: get(hObject,'String') returns contents of edit_initDeltaCost as text 0106 % str2double(get(hObject,'String')) returns contents of edit_initDeltaCost as a double 0107 0108 % validate initDeltaCost 0109 validate_initDeltaCost(handles); 0110 0111 0112 function flag = validate_initDeltaCost(handles) 0113 str = get(handles.edit_initDeltaCost,'String'); 0114 0115 errmsg = 'initDeltaCost must be a number'; 0116 errtitle = 'Invalid initDeltaCost!'; 0117 0118 flag = validateRealNumber(str,errmsg,errtitle); 0119 0120 0121 0122 % --- Executes during object creation, after setting all properties. 0123 function edit_initDeltaCost_CreateFcn(hObject, eventdata, handles) 0124 % hObject handle to edit_initDeltaCost (see GCBO) 0125 % eventdata reserved - to be defined in a future version of MATLAB 0126 % handles empty - handles not created until after all CreateFcns called 0127 0128 % Hint: edit controls usually have a white background on Windows. 0129 % See ISPC and COMPUTER. 0130 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0131 set(hObject,'BackgroundColor','white'); 0132 end 0133 0134 0135 0136 function edit_finalDeltaCost_Callback(hObject, eventdata, handles) 0137 % hObject handle to edit_finalDeltaCost (see GCBO) 0138 % eventdata reserved - to be defined in a future version of MATLAB 0139 % handles structure with handles and user data (see GUIDATA) 0140 0141 % Hints: get(hObject,'String') returns contents of edit_finalDeltaCost as text 0142 % str2double(get(hObject,'String')) returns contents of edit_finalDeltaCost as a double 0143 validate_finalDeltaCost(handles); 0144 0145 0146 function flag = validate_finalDeltaCost(handles) 0147 str = get(handles.edit_finalDeltaCost,'String'); 0148 0149 errmsg = 'finalDeltaCost must be a number'; 0150 errtitle = 'Invalid initDeltaCost!'; 0151 0152 flag = validateRealNumber(str,errmsg,errtitle); 0153 0154 0155 % --- Executes during object creation, after setting all properties. 0156 function edit_finalDeltaCost_CreateFcn(hObject, eventdata, handles) 0157 % hObject handle to edit_finalDeltaCost (see GCBO) 0158 % eventdata reserved - to be defined in a future version of MATLAB 0159 % handles empty - handles not created until after all CreateFcns called 0160 0161 % Hint: edit controls usually have a white background on Windows. 0162 % See ISPC and COMPUTER. 0163 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0164 set(hObject,'BackgroundColor','white'); 0165 end 0166 0167 0168 0169 function edit_nStep_Callback(hObject, eventdata, handles) 0170 % hObject handle to edit_nStep (see GCBO) 0171 % eventdata reserved - to be defined in a future version of MATLAB 0172 % handles structure with handles and user data (see GUIDATA) 0173 0174 % Hints: get(hObject,'String') returns contents of edit_nStep as text 0175 % str2double(get(hObject,'String')) returns contents of edit_nStep as a double 0176 validate_nStep(handles); 0177 0178 0179 function flag = validate_nStep(handles) 0180 str = get(handles.edit_nStep,'String'); 0181 0182 errmsg = 'nStep must be a positive integer'; 0183 errtitle = 'Invalid pDecrease!'; 0184 0185 flag = validatePositiveInteger(str,errmsg,errtitle); 0186 0187 % --- Executes during object creation, after setting all properties. 0188 function edit_nStep_CreateFcn(hObject, eventdata, handles) 0189 % hObject handle to edit_nStep (see GCBO) 0190 % eventdata reserved - to be defined in a future version of MATLAB 0191 % handles empty - handles not created until after all CreateFcns called 0192 0193 % Hint: edit controls usually have a white background on Windows. 0194 % See ISPC and COMPUTER. 0195 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0196 set(hObject,'BackgroundColor','white'); 0197 end 0198 0199 0200 % --- Executes on button press in pushbutton_Calculate. 0201 function pushbutton_Calculate_Callback(hObject, eventdata, handles) 0202 % hObject handle to pushbutton_Calculate (see GCBO) 0203 % eventdata reserved - to be defined in a future version of MATLAB 0204 % handles structure with handles and user data (see GUIDATA) 0205 run = true; 0206 0207 run = validate_initDeltaCost(handles); 0208 0209 if run == true 0210 run = validate_finalDeltaCost(handles); 0211 0212 if run == true 0213 run = validate_nStep(handles); 0214 0215 if run == true 0216 % all data is valid, run the command. 0217 initDeltaCost = (get(handles.edit_initDeltaCost,'String')); 0218 finalDeltaCost = (get(handles.edit_finalDeltaCost,'String')); 0219 nStep = (get(handles.edit_nStep,'String')); 0220 0221 command = ['expAnneal.maxpDecrease(',initDeltaCost,',',... 0222 finalDeltaCost,',',nStep,');']; 0223 0224 verbosePrint(['Executing command: ','''',command,''''],'maxpDecrease_Dialog_calculate'); 0225 evalin('base',command); 0226 0227 close(handles.figure_maxpDecrease_Dialog); 0228 0229 end 0230 end 0231 end