This is a static copy of a profile reportHome
createExitMsg (860 calls, 1.585 sec)
Generated 05-Aug-2011 13:03:55 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/shared/optimlib/createExitMsg.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
barrier | function | 860 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
399 | detailedMsg = sprintf(['\nOpti... | 818 | 0.153 s | 9.7% |  |
392 | basicMsg = sprintf(['\n%sLocal... | 818 | 0.087 s | 5.5% |  |
111 | presolveInfeasTag = sprintf(li... | 860 | 0.055 s | 3.4% |  |
112 | noEqSolTag = sprintf(linkCmd,'... | 860 | 0.044 s | 2.8% |  |
99 | gradCalcFailTag = sprintf(link... | 860 | 0.044 s | 2.8% |  |
All other lines | | | 1.202 s | 75.9% |  |
Totals | | | 1.585 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 1001 |
Non-code lines (comments, blank lines) | 667 |
Code lines (lines that can run) | 334 |
Code lines that did run | 116 |
Code lines that did not run | 218 |
Coverage (did run/can run) | 34.73 % |
Function listing
time calls line
1 function outputMsg = createExitMsg(caller,exitflag,dispMsg,detailedExitMsg,varargin)
2 %createExitMsg create exit messages for Optimization Toolbox solvers.
3 %
4 % This utility creates and displays the exit messages (default and
5 % detailed) for all Optimization Toolbox solvers.
6 %
7 % INPUTS:
8 % - caller is a string containing the name of the function that originally
9 % called createExitMsg.
10 % - exitflag is the flag indicating which exit condition caused the solver to
11 % stop.
12 % - dispMsg is a boolean which is true when the message is to be displayed in
13 % the Command Window.
14 % - detailedExitMsg is a boolean which is true when the user has selected the
15 % detailed message via optimset.
16 % - varargin contains the list of quantities that are to be embedded in the
17 % message. The list of these quantities varies, but the order must be
18 % consistent:
19 % {'topLevelFcn',quantity,optionChoiceString,optionValue,quantity2, ...
20 % option2ChoiceString,option2Value,...}
21
22 % Copyright 2008-2010 The MathWorks, Inc.
23 % $Revision: 1.1.6.11 $ $Date: 2010/10/08 17:17:21 $
24
0.01 860 25 enableLinks = feature('hotlinks') && dispMsg && ~isdeployed;
26
27 % Define constants for exitflags
860 28 stoppedAtX0 = 100;
860 29 undefGrads = 26;
860 30 dirDeriv = 5;
860 31 smallSearchDir = 4;
860 32 deltaF = 3;
860 33 deltaX = 2;
860 34 optimal = 1;
860 35 maxFunEval = 0;
860 36 maxIter = 10;
860 37 outputFcn = -1;
860 38 infeasSQP = -20;
860 39 infeasStationary = -21;
860 40 infeasDeltaX = -22;
860 41 infeasDeltaF = -23;
860 42 infeasSmallSearchDir = -24;
860 43 infeasDirDeriv = -25;
860 44 infeasUndefGrads = -26;
860 45 unbounded = -3;
860 46 nonconvex = -6;
47
48 % Make sure that there are enough cells (at least 10) in the messageInfo
49 % array. That is, there must be a uniform amount of inputs to createExitMsg.
50 % Otherwise, creating the "detail" link in the command window will break.
51 % varargin will be of length 1, 4, 7, or 9. It is never empty.
0.01 860 52 messageInfo = [varargin,{0,'',0,0,'',0,0,'',0}];
53
54 % Initialize basicMsg and detailedMsg
860 55 basicMsg = '';
0.02 860 56 detailedMsg = '';
57
860 58 if enableLinks
59 endLinkTag = '</a>';
60 % Create template html tag, anchors within CSH are filled in below.
61 linkCmd = '<a href = "matlab: helpview([docroot ''/toolbox/optim/msg_csh/optim_msg_csh.map''],''%s'',''CSHelpWindow'');">';
62 % Create html tag for the "<detail>" link
63 detailTag = sprintf(['<<a href = "matlab: createExitMsg(''%s'',%e,true,true,''%s'',%e,''%s'',%e,%e,''%s'',%e,%e,''%s'',%e);">' ...
64 'stopping criteria details</a>>'],caller,exitflag,messageInfo{1:10});
860 65 else
860 66 linkCmd = '';
860 67 endLinkTag = '';
860 68 detailTag = '';
0.02 860 69 end
70
71 % Fill in template html tag with anchors pointing to CSH
0.02 860 72 uncLocalOptTag = sprintf(linkCmd,'local_min_unconstrained'); % exitflag 1: fminusub, sfminbx, sfminle
0.01 860 73 lsqLocalOptTag = sprintf(linkCmd,'local_min_lsq'); % exitflag 1: levenbergMarquardt,snls
0.01 860 74 qpMinFoundTag = sprintf(linkCmd,'quadprogipc_min_found'); % exitflag 1: ipqpcommon
860 75 presolveOptimTag = sprintf(linkCmd,'soln_found_in_presolve'); % exitflag 1: presolve
860 76 uncInitPtTag = sprintf(linkCmd,'initial_local_unc'); % exitflag 100: fminusub, sfminbx, sfminle
860 77 lsqInitPtTag = sprintf(linkCmd,'lsq_init_pt_min'); % exitflag 100: levenbergMarquardt,snls
0.04 860 78 normGradTag = sprintf(linkCmd,'first_order_opt_unc'); % exitflag 1,100: fminusub, sfminbx, sfminle,levenbergMarquardt
0.01 860 79 gradSizeTag = sprintf(linkCmd,'grad_size'); % exitflag 1,100: fminusub, sfminbx, sfminle
0.02 860 80 regProbTag = sprintf(linkCmd,'appears_regular'); % exitflag 1,100: levenbergMarquardt,snls,trustnleqn
0.02 860 81 lsqGradSizeTag = sprintf(linkCmd,'lsq_grad_size'); % exitflag 1,100: levenbergMarquardt,snls
0.02 860 82 lsqNormGradTag = sprintf(linkCmd,'firstorder_lsq'); % exitflag 1,100: levenbergMarquardt,snls
0.02 860 83 eqSolvInitTag = sprintf(linkCmd,'eq_init_pt'); % exitflag 100: levenbergMarquardt,snls,trustnleqn
860 84 eqSolvedTag = sprintf(linkCmd,'eqn_solved'); % exitflag 1: levenbergMarquardt,snls,trustnleqn
0.02 860 85 normStepTag = sprintf(linkCmd,'norm_current_step'); % exitflag 2: fminusub,sfminbx, sfminle
0.01 860 86 uncPossMinTag = sprintf(linkCmd,'local_min_possible'); % exitflag 2,3: fminusub,sfminbx,sfminle
0.01 860 87 eqSolveSingTag = sprintf(linkCmd,'eqn_solved_singular'); % exitflag 2: levenbergMarquardt,snls,trustnleqn (fsolve)
0.04 860 88 lsqPossMinTag = sprintf(linkCmd,'local_min_possible_lsq'); % exitflag 2: levenbergMarquardt,snls,trustnleqn (lsqnonlin/curvefit)
860 89 conLocalOptTag = sprintf(linkCmd,'local_min_found'); % exitflag 1: nlconst,barrier,sqpLineSearch
0.01 860 90 conInitPtTag = sprintf(linkCmd,'did_not_move'); % exitflag 100: barrier,sqpLineSearch
0.02 860 91 firstOrdOptTag = sprintf(linkCmd,'first_order_opt_con'); % exitflag 1,100: barrier,sqpLineSearch,nlconst
0.01 860 92 feasDirTag = sprintf(linkCmd,'feasible_directions'); % exitflag 1,100: barrier,sqpLineSearch,nlconst
860 93 qpFeasDirTag = sprintf(linkCmd,'quadprog_feasible_direction'); % exitflag 1: ipqpcommon
0.01 860 94 dualFeasTag = sprintf(linkCmd,'quadprog_relative_dual_feas'); % exitflag 1: ipqpcommon
0.02 860 95 complementTag = sprintf(linkCmd,'quadprog_complementarity'); % exitflag 1: ipqpcommon
860 96 normSearchDirTag = sprintf(linkCmd,'norm_search_direction'); % exitflag 4,-24: nlconst
0.04 860 97 searchDirTag = sprintf(linkCmd,'search_direction'); % exitflag 5: fminusub
0.02 860 98 conNormStepTag = sprintf(linkCmd,'norm_curr_step_fminconip'); % exitflag 2: barrier,sqpLineSearch
0.04 860 99 gradCalcFailTag = sprintf(linkCmd,'grad_calc_failed'); % exitflag 26,-26: sqpLineSearch
860 100 jacCalcFailTag = sprintf(linkCmd,'lsq_no_Jacobian'); % exitflag 26: levenbergMarquardt
0.03 860 101 conPossMinTag = sprintf(linkCmd,'local_min_poss_with_constr'); % exitflag 2,3,4,5: all optimizers
860 102 dirDerivTag = sprintf(linkCmd,'pred_change'); % exitflag 5,-25: all solvers
0.02 860 103 lsIntervalTag = sprintf(linkCmd,'line_search_interval'); % exitflag 5: fminusub
0.03 860 104 eqSolvedInaccTag = sprintf(linkCmd,'eqn_inaccuracy'); % exitflag 3: levenbergMarquardt,snls,trustnleqn (fsolve)
0.02 860 105 ineffectiveStepTag = sprintf(linkCmd,'last_step_ineffective'); % exitflag 3: levenbergMarquardt,snls,trustnleqn (fsolve)
860 106 inFeasTag = sprintf(linkCmd,'no_feasible_point'); % exitflag -20,-21,-22,-24,-25: barrier,sqpLineSearch,nlconst
860 107 unboundedTag = sprintf(linkCmd,'appears_unbounded'); % exitflag -3: barrier,sqpLineSearch
0.02 860 108 stationaryConstrTag = sprintf(linkCmd,'constr_viol_flat'); % exitflag -21: barrier
0.01 860 109 totalRelErrorTag = sprintf(linkCmd,'total_rel_error'); % exitflag -21: ipqpcommon
0.02 860 110 presolveTag = sprintf(linkCmd,'presolve'); % exitflag 1,-21,3: presolve
0.05 860 111 presolveInfeasTag = sprintf(linkCmd,'infeasible_presolve'); % exitflag -21: presolve
0.04 860 112 noEqSolTag = sprintf(linkCmd,'eqn_no_soln'); % exitflag -21,-22,-23,-24: trustnleqn,levenbergMarquardt,snls
0.03 860 113 noEqSolTrrTag = sprintf(linkCmd,'eqn_no_soln_negexit'); % exitflag -3: trustnleqn,levenbergMarquardt,snls
0.03 860 114 localSingularTag = sprintf(linkCmd,'local_singular'); % exitflag -3: trustnleqn
0.01 860 115 localSingularLSQTag = sprintf(linkCmd,'local_singular_lsq'); % exitflag -3: trustnleqn
860 116 regParamTag = sprintf(linkCmd,'reg_param'); % exitflag -3: levenbergMarquardt
0.02 860 117 trRadiusTag = sprintf(linkCmd,'trr'); % exitflag -3: trustnleqn
0.02 860 118 presolveUnboundTag = sprintf(linkCmd,'presolve_unbounded'); % exitflag -3: presolve
0.01 860 119 maxSQPIterTag = sprintf(linkCmd,'maxsqpiter_csh'); % exitflag -20: nlconst
0.01 860 120 objectiveLimitTag = sprintf(linkCmd,'objective_limit'); % exitflag -3: barrier,sqpLineSearch
0.01 860 121 nonconvexTag = sprintf(linkCmd,'quadprog_nonconvex'); % exitflag -6: ipqpcommon
0.01 860 122 functionTolTag = sprintf(linkCmd,'function_tolerance'); % exitflag 1,100,3,5,-25: all scalar nonlinear solvers
0.03 860 123 tolFunTag = sprintf(linkCmd,'tolfun'); % exitflag 1,100,3,5,-25: all scalar nonlinear solvers
0.01 860 124 functionTolLSQTag = sprintf(linkCmd,'function_tolerance_lsq'); % exitflag 1,100,3,-21,-23: nonlinear lsq solvers
0.01 860 125 tolFunLSQTag = sprintf(linkCmd,'tolfun_lsq'); % exitflag 1,100,3,-21,-23: nonlinear lsq solvers
0.02 860 126 funcTolFsolveTag = sprintf(linkCmd,'fcn_tolerance_fsolve'); % exitflag 1,100,3,-21,-23: fsolve
0.03 860 127 tolFunFsolveTag = sprintf(linkCmd,'tolfun_fsolve'); % exitflag 1,100,3,-21,-23: fsolve
860 128 stepSizeTolTag = sprintf(linkCmd,'step_size_tol'); % exitflag 2,-224,-24: all solvers
0.01 860 129 tolXTag = sprintf(linkCmd,'tolx'); % exitflag 2,-24,-24: all solvers
0.01 860 130 constrTolTag = sprintf(linkCmd,'constraint_tolerance'); % All exitflags: barrier,sqpLineSearch,nlconst
0.03 860 131 tolConTag = sprintf(linkCmd,'tol_con'); % All exitflags: barrier,sqpLineSearch,nlconst
0.01 860 132 maxFunEvalTag = sprintf(linkCmd,'max_fun_evals'); % exitflag 0
860 133 prematureStopTag = sprintf(linkCmd,'solver_stopped_premature'); % exitflag 0,10
0.01 860 134 maxIterTag = sprintf(linkCmd,'max_iter'); % exitflag 10
860 135 outputFcnTag = sprintf(linkCmd,'output_function'); % exitflag -1
136
0.02 860 137 switch exitflag
860 138 case stoppedAtX0 % exitflag = 100
139 switch caller
140 case {'barrier','sqpLineSearch'}
141 % messageInfo = {'fmincon',firstordopt,tolFunChoice,tolFun,maxConstr,tolConChoice,tolCon}
142 basicMsg = sprintf(['\n%sInitial point is a local minimum that satisfies the constraints%s.\n\n',...
143 'Optimization completed because at the initial point, the objective function is ', ...
144 'non-decreasing \nin %sfeasible directions%s to within the %s value of the %sfunction tolerance%s, ', ...
145 'and \nconstraints are satisfied to within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
146 conInitPtTag,endLinkTag,feasDirTag,endLinkTag,messageInfo{3},functionTolTag,endLinkTag,messageInfo{6}, ...
147 constrTolTag,endLinkTag,detailTag);
148
149 detailedMsg = sprintf(['\nOptimization completed: The final point is the initial point.\n', ...
150 'The %sfirst-order optimality measure%s, %e, is less than\n%soptions.TolFun%s = %e, and ', ...
151 'the maximum constraint\nviolation, %e, is less than %soptions.TolCon%s = %e.\n\n', ...
152 'Optimization Metric Options\n', ...
153 'first-order optimality = %10.2e TolFun = %7.0e (%s)\n', ...
154 'max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],firstOrdOptTag,endLinkTag, ...
155 messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag,messageInfo{7}, ...
156 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
157 case {'fminusub','sfminbx','sfminle'}
158 % messageInfo = {'fminunc',firstOrdOpt,tolFunChoice,tolFun}
159 basicMsg = sprintf(['\n%sInitial point is a local minimum%s.\n\n',...
160 'Optimization completed because the %ssize of the gradient%s at the initial point \n',...
161 'is less than the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
162 uncInitPtTag,endLinkTag,gradSizeTag,endLinkTag,messageInfo{3},functionTolTag,endLinkTag,detailTag);
163
164 detailedMsg = sprintf(['\nOptimization completed: The final point is the initial point.\n', ...
165 'The %sfirst-order optimality measure%s, %e, is less than\n%soptions.TolFun%s = %e.\n\n', ...
166 'Optimization Metric Options\n', ...
167 'relative first-order optimality = %10.2e TolFun = %7.0e (%s)\n'],normGradTag,endLinkTag, ...
168 messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
169 case {'trustnleqn','snls'}
170 if strcmpi(messageInfo{1},'fsolve')
171 % messageInfo = {'trustnleqn',firstOrdOpt,tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(TolFun)}
172 basicMsg = sprintf(['\n%sEquation solved at initial point%s.\n\n',...
173 'fsolve completed because the vector of function values at the initial point\n',...
174 'is near zero as measured by the %s value of the %sfunction tolerance%s, and\n',...
175 'the %sproblem appears regular%s as measured by the gradient.\n\n%s\n'], ...
176 eqSolvInitTag,endLinkTag,messageInfo{3},funcTolFsolveTag,endLinkTag,regProbTag,endLinkTag, ...
177 detailTag);
178
179 detailedMsg = sprintf(['\nEquation solved. The final point is the initial point.\n', ...
180 'The sum of squared function values, r = %e, is less than ',...
181 'sqrt(%soptions.TolFun%s) = %e.\nThe relative norm of the ',...
182 'gradient of r, %e, is less than options.TolFun = %e.\n\n', ...
183 'Optimization Metric Options\n', ...
184 'relative norm(grad r) = %10.2e TolFun = %7.0e (%s)\n', ...
185 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'],messageInfo{5}, ...
186 tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2},messageInfo{4},messageInfo{2}, ...
187 messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
188 else % caller is lsqnonlin/lsqcurvefit
189 % messageInfo = {'lsqnonlin',firstOrdOpt,tolFunChoice,tolFun}
190 basicMsg = sprintf(['\n%sInitial point is a local minimum%s.\n\n',...
191 'Optimization completed because the %ssize of the gradient%s at the initial point \n',...
192 'is less than the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
193 lsqInitPtTag,endLinkTag,lsqGradSizeTag,endLinkTag,messageInfo{3},functionTolLSQTag,endLinkTag,detailTag);
194
195 detailedMsg = sprintf(['\nOptimization completed: The final point is the initial point.\n', ...
196 'The %sfirst-order optimality measure%s, %e, is less than\n%soptions.TolFun%s = %e.\n\n', ...
197 'Optimization Metric Options\n', ...
198 'relative first-order optimality = %10.2e TolFun = %7.0e (%s)\n'],lsqNormGradTag,endLinkTag, ...
199 messageInfo{2},tolFunLSQTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
200 end
201 case 'levenbergMarquardt'
202 if strcmpi(messageInfo{1},'fsolve')
203 % messageInfo = {'fsolve',firstOrdOpt,tolFunChoice,1e-4*tolFun,F'*F,tolFunChoice,sqrt(TolFun)}
204 basicMsg = sprintf(['\n%sEquation solved at initial point%s.\n\n',...
205 '%s completed because the vector of function values at the initial\npoint is near ',...
206 'zero as measured by the %s value of the %sfunction tolerance%s,\nand ',...
207 'the %sproblem appears regular%s as measured by the gradient.\n\n%s\n'], ...
208 eqSolvInitTag,endLinkTag,messageInfo{1},messageInfo{3},funcTolFsolveTag,endLinkTag, ...
209 regProbTag,endLinkTag,detailTag);
210
211 detailedMsg = sprintf(['\nEquation solved. The final point is the initial point. The sum ', ...
212 'of squared function values,\nr = %e, is less than sqrt(%soptions.TolFun%s) = %e. ', ...
213 'The relative norm\nof the gradient of r, %e, is less than 1e-4*options.TolFun = %e.\n\n', ...
214 'Optimization Metric Options\n', ...
215 'relative norm(grad r) = %10.2e 1e-4*TolFun = %7.0e (%s)\n', ...
216 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'],messageInfo{5}, ...
217 tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2},messageInfo{4},messageInfo{2}, ...
218 messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
219 else % Caller is lsqnonlin/lsqcurvefit
220 % messageInfo = {'lsq*',firstOrdOpt,tolFunChoice,tolFun}
221 basicMsg = sprintf(['\n%sInitial point is a local minimum%s.\n\n',...
222 'Optimization completed because the %ssize of the gradient%s at the initial point\n', ...
223 'is less than the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
224 lsqInitPtTag,endLinkTag,lsqGradSizeTag,endLinkTag,messageInfo{3},functionTolLSQTag,endLinkTag,detailTag);
225
226 detailedMsg = sprintf(['\nOptimization completed: The final point is the initial point.\nThe ', ...
227 '%sfirst-order optimality measure%s, %e, is less than\n1e-4*%soptions.TolFun%s = %e.\n\n', ...
228 'Optimization Metric Options\n', ...
229 'relative norm(gradient) = %10.2e 1e-4*TolFun = %7.0e (%s)\n'],lsqNormGradTag,endLinkTag, ...
230 messageInfo{2},tolFunLSQTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
231 end
232 end % switch(caller) - exitflag 100
860 233 case optimal % exitflag = 1
42 234 switch caller
42 235 case 'nlconst'
236 %messageInfo ={'fmincon',firstordopt,tolFunChoice,tolFun,maxConstr,tolConChoice,tolCon}
237 basicMsg = sprintf(['\n%sLocal minimum found that satisfies the constraints%s.\n\n',...
238 'Optimization completed because the objective function is non-decreasing ', ...
239 'in \n%sfeasible directions%s, to within the %s value of the %sfunction tolerance%s,\n', ...
240 'and constraints are satisfied to within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
241 conLocalOptTag,endLinkTag,feasDirTag,endLinkTag,messageInfo{3},functionTolTag,endLinkTag,messageInfo{6}, ...
242 constrTolTag,endLinkTag,detailTag);
243
244 detailedMsg = sprintf(['\nOptimization completed: The %sfirst-order optimality measure%s, %e, ', ...
245 'is less\nthan %soptions.TolFun%s = %e, and the maximum constraint violation, %e,\nis less ', ...
246 'than %soptions.TolCon%s = %e.\n\n', ...
247 'Optimization Metric Options\n', ...
248 'first-order optimality = %10.2e TolFun = %7.0e (%s)\n', ...
249 'max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],firstOrdOptTag,endLinkTag, ...
250 messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag,messageInfo{7}, ...
251 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
42 252 case {'barrier','sqpLineSearch'}
253 %messageInfo ={'fmincon',firstordopt,tolFunChoice,tolFun,maxConstr,tolConChoice,tolCon}
42 254 basicMsg = sprintf(['\n%sLocal minimum found that satisfies the constraints%s.\n\n',...
255 'Optimization completed because the objective function is non-decreasing ', ...
256 'in \n%sfeasible directions%s, to within the %s value of the %sfunction tolerance%s,\n', ...
257 'and constraints are satisfied to within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
258 conLocalOptTag,endLinkTag,feasDirTag,endLinkTag,messageInfo{3},functionTolTag,endLinkTag,messageInfo{6}, ...
259 constrTolTag,endLinkTag,detailTag);
260
42 261 detailedMsg = sprintf(['\nOptimization completed: The relative %sfirst-order optimality measure%s, %e,\n', ...
262 'is less than %soptions.TolFun%s = %e, and the relative maximum constraint\nviolation, %e, is less ', ...
263 'than %soptions.TolCon%s = %e.\n\n', ...
264 'Optimization Metric Options\n', ...
265 'relative first-order optimality = %10.2e TolFun = %7.0e (%s)\n', ...
266 'relative max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],firstOrdOptTag,endLinkTag, ...
267 messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag,messageInfo{7}, ...
268 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
269 case {'sfminbx','sfminle'}
270 %messageInfo = {'fminunc',normGrad,tolFunChoice,tolFun}
271 % Create messages for display
272 basicMsg = sprintf(['\n%sLocal minimum found%s.\n\n',...
273 'Optimization completed because the %ssize of the gradient%s is less than\n',...
274 'the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
275 uncLocalOptTag,endLinkTag,gradSizeTag,endLinkTag,messageInfo{3},functionTolTag,endLinkTag,detailTag);
276
277 detailedMsg = sprintf(['\nOptimization completed: The %sfirst-order optimality measure%s', ...
278 ', %e, \nis less than %soptions.TolFun%s = %e, and no negative/zero curvature is\n', ...
279 'detected in the trust-region model.\n\n', ...
280 'Optimization Metric Options\n', ...
281 'relative first-order optimality = %10.2e TolFun = %7.0e (%s)\n'],normGradTag,endLinkTag, ...
282 messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
283 case 'fminusub'
284 %messageInfo = {'fminunc',normGrad,tolFunChoice,tolFun}
285 % Create messages for display
286 basicMsg = sprintf(['\n%sLocal minimum found%s.\n\n',...
287 'Optimization completed because the %ssize of the gradient%s is less than\n',...
288 'the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
289 uncLocalOptTag,endLinkTag,gradSizeTag,endLinkTag,messageInfo{3},functionTolTag,endLinkTag,detailTag);
290
291 detailedMsg = sprintf(['\nOptimization completed: The %sfirst-order optimality measure%s', ...
292 ', %e, is less \nthan %soptions.TolFun%s = %e.\n\n', ...
293 'Optimization Metric Options\n', ...
294 'relative norm(gradient) = %10.2e TolFun = %7.0e (%s)\n'],normGradTag,endLinkTag, ...
295 messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
296 case {'snls','trustnleqn'}
297 if strcmpi(messageInfo{1},'fsolve')
298 % messageInfo = {'fsolve',firstOrdOpt,tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(TolFun)}
299 basicMsg = sprintf(['\n%sEquation solved%s.\n\n',...
300 'fsolve completed because the vector of function values is near zero\n',...
301 'as measured by the %s value of the %sfunction tolerance%s, and\n',...
302 'the %sproblem appears regular%s as measured by the gradient.\n\n%s\n'], ...
303 eqSolvedTag,endLinkTag,messageInfo{3},funcTolFsolveTag,endLinkTag,regProbTag,endLinkTag, ...
304 detailTag);
305
306 detailedMsg = sprintf(['\nEquation solved. The sum of squared function values, r = %e, ', ...
307 'is less than\nsqrt(%soptions.TolFun%s) = %e. The relative norm of the ', ...
308 'gradient of r, %e,\nis less than options.TolFun = %e.\n\n',...
309 'Optimization Metric Options\n', ...
310 'relative norm(grad r) = %10.2e TolFun = %7.0e (%s)\n', ...
311 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
312 messageInfo{5},tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2},messageInfo{4}, ...
313 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
314 else % Caller is lsqnonlin or lsqcurvefit
315 % messageInfo = {'lsq*',firstOrdOpt,tolFunChoice,tolFun}
316 basicMsg = sprintf(['\n%sLocal minimum found%s.\n\n',...
317 'Optimization completed because the %ssize of the gradient%s is less than\n',...
318 'the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
319 lsqLocalOptTag,endLinkTag,lsqGradSizeTag,endLinkTag,messageInfo{3},functionTolLSQTag,endLinkTag,detailTag);
320
321 detailedMsg = sprintf(['\nOptimization completed: The %sfirst-order optimality measure%s, %e,\n', ...
322 'is less than %soptions.TolFun%s = %e.\n\n', ...
323 'Optimization Metric Options\n', ...
324 'relative first-order optimality = %10.2e TolFun = %7.0e (%s)\n'],lsqNormGradTag,endLinkTag, ...
325 messageInfo{2},tolFunLSQTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
326 end
327 case 'levenbergMarquardt'
328 if strcmpi(messageInfo{1},'fsolve')
329 % messageInfo = {'fsolve',firstOrdOpt,tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(TolFun)}
330 basicMsg = sprintf(['\n%sEquation solved%s.\n\n',...
331 '%s completed because the vector of function values is near zero\n',...
332 'as measured by the %s value of the %sfunction tolerance%s, and\n',...
333 'the %sproblem appears regular%s as measured by the gradient.\n\n%s\n'], ...
334 eqSolvedTag,endLinkTag,messageInfo{1},messageInfo{3},funcTolFsolveTag,endLinkTag, ...
335 regProbTag,endLinkTag,detailTag);
336
337 detailedMsg = sprintf(['\nEquation solved. The sum of squared function values, r = %e, ', ...
338 'is less\nthan sqrt(%soptions.TolFun%s) = %e. The relative norm of the ', ...
339 'gradient of\nr, %e, is less than 1e-4*options.TolFun = %e.\n\n',...
340 'Optimization Metric Options\n', ...
341 'relative norm(grad r) = %10.2e 1e-4*TolFun = %7.0e (%s)\n', ...
342 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
343 messageInfo{5},tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2},messageInfo{4}, ...
344 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
345 else % Caller is lsqnonlin/lsqcurvefit
346 % messageInfo = {'lsq*',firstOrdOpt,tolFunChoice,tolFun}
347 basicMsg = sprintf(['\n%sLocal minimum found%s.\n\n',...
348 'Optimization completed because the %ssize of the gradient%s is less than\n',...
349 'the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
350 lsqLocalOptTag,endLinkTag,lsqGradSizeTag,endLinkTag,messageInfo{3},functionTolLSQTag,endLinkTag,detailTag);
351
352 detailedMsg = sprintf(['\nOptimization completed: The %sfirst-order optimality measure%s, %e,\n', ...
353 'is less than 1e-4*%soptions.TolFun%s = %e.\n\n', ...
354 'Optimization Metric Options\n', ...
355 'relative norm(gradient) = %10.2e 1e-4*TolFun = %7.0e (%s)\n'],lsqNormGradTag,endLinkTag, ...
356 messageInfo{2},tolFunLSQTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
357 end
358 case 'ipqpcommon'
359 % messageInfo = {'quadprog',dualFeas,tolFunChoice,tolFun,complmntrty,tolFunChoice,tolFun,maxConstr,tolConChoice,tolCon}
360 basicMsg = sprintf(['\n%sMinimum found that satisfies the constraints%s.\n\n',...
361 'Optimization completed because the objective function is non-decreasing ', ...
362 'in \n%sfeasible directions%s, to within the %s value of the %sfunction tolerance%s,\n', ...
363 'and constraints are satisfied to within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
364 qpMinFoundTag,endLinkTag,qpFeasDirTag,endLinkTag,messageInfo{3},functionTolTag,endLinkTag,messageInfo{9}, ...
365 constrTolTag,endLinkTag,detailTag);
366
367 detailedMsg = sprintf(['\nOptimization completed: The relative %sdual feasibility%s, %e,\n', ...
368 'is less than %soptions.TolFun%s = %e, the %scomplementarity measure%s,\n%e, is less than ', ...
369 'options.TolFun, and the relative maximum constraint\nviolation, %e, is less ', ...
370 'than %soptions.TolCon%s = %e.\n\n', ...
371 'Optimization Metric Options\n', ...
372 'relative dual feasibility = %10.2e TolFun = %7.0e (%s)\n', ...
373 'complementarity measure = %10.2e TolFun = %7.0e (%s)\n', ...
374 'relative max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],dualFeasTag,endLinkTag, ...
375 messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},complementTag,endLinkTag,messageInfo{5},messageInfo{8}, ...
376 tolConTag,endLinkTag,messageInfo{10},messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5}, ...
377 messageInfo{7},messageInfo{6},messageInfo{8},messageInfo{10},messageInfo{9});
378 case 'presolve'
379 % messageInfo = {'topLevelFcn'}
380 basicMsg = sprintf(['\n%sSolution found during presolve%s.\n\n', ...
381 'Some combination of the bounds, linear constraints, and linear terms\n',...
382 'in the objective function immediately lead to the solution.\n'], ...
383 presolveOptimTag,endLinkTag);
384 % Force detailedExitMsg to false so that basicMsg will always print, since there is no detailedMsg.
385 detailedExitMsg = false;
386 end % switch(caller) - exitflag 1
818 387 case deltaX % exitflag = 2
818 388 switch caller
0.01 818 389 case {'barrier','sqpLineSearch'}
390 % Create messages for display
391 % messageInfo = {'fmincon',normStep,tolXchoice,tolX,maxConstr,tolConChoice,tolCon}
0.09 818 392 basicMsg = sprintf(['\n%sLocal minimum possible. Constraints satisfied%s.\n\n',...
393 '%s stopped because the %ssize of the current step%s is less than\n',...
394 'the %s value of the %sstep size tolerance%s and constraints are \nsatisfied to ',...
395 'within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
396 conPossMinTag,endLinkTag,messageInfo{1},conNormStepTag,endLinkTag,messageInfo{3}, ...
397 stepSizeTolTag,endLinkTag,messageInfo{6},constrTolTag,endLinkTag,detailTag);
398
0.15 818 399 detailedMsg = sprintf(['\nOptimization stopped because the %srelative changes in all elements of x%s', ...
400 ' are\nless than %soptions.TolX%s = %e, and the relative maximum constraint\n', ...
401 'violation, %e, is less than %soptions.TolCon%s = %e.\n\n', ...
402 'Optimization Metric Options\n', ...
403 'max(abs(delta_x./x)) = %10.2e TolX = %7.0e (%s)\n' ,...
404 'relative max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],conNormStepTag,endLinkTag, ...
405 tolXTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag,messageInfo{7}, ...
406 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
407 case {'fminusub','sfminbx','sfminle'}
408 %messageInfo = {'fminunc',norm(deltaX),tolXChoice,tolX}
409 % Create messages for display
410 basicMsg = sprintf(['\n%sLocal minimum possible%s.\n\n',...
411 '%s stopped because the %ssize of the current step%s is less than\n',...
412 'the %s value of the %sstep size tolerance%s.\n\n%s\n'], ...
413 uncPossMinTag,endLinkTag,messageInfo{1},normStepTag,endLinkTag,messageInfo{3},stepSizeTolTag,endLinkTag,detailTag);
414
415 detailedMsg = sprintf(['\nOptimization stopped because the %snorm of the current step%s', ...
416 ', %e, is\nless than %soptions.TolX%s = %e.\n\n', ...
417 'Optimization Metric Options\n', ...
418 'relative norm(step) = %10.2e TolX = %7.0e (%s)\n'], ...
419 normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
420 messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
421 case 'snls'
422 if strcmpi(messageInfo{1},'fsolve')
423 %messageInfo = {'fsolve',norm(deltaX),tolXChoice,tolX,F'*F,tolFunChoice,sqrt(tolFun)}
424 % Create messages for display
425 basicMsg = sprintf(['\n%sEquation solved, fsolve stalled%s.\n\n',...
426 '%s stopped because the %ssize of the current step%s is less than ',...
427 'the %s\nvalue of the %sstep size tolerance%s and the vector of ', ...
428 'function values\nis near zero as measured by the %s value of the ',...
429 '%sfunction tolerance%s.\n\n%s\n'],eqSolveSingTag,endLinkTag,messageInfo{1}, ...
430 normStepTag,endLinkTag,messageInfo{3},stepSizeTolTag,endLinkTag,messageInfo{6}, ...
431 funcTolFsolveTag,endLinkTag,detailTag);
432
433 detailedMsg = sprintf(['\n%s stopped because the %snorm of the current step%s, %e, is ', ...
434 'less than\n%soptions.TolX%s = %e. The sum of squared function values, r = %e,\n',...
435 'is less than sqrt(%soptions.TolFun%s) = %e.\n\n', ...
436 'Optimization Metric Options\n', ...
437 'norm(step) = %10.2e TolX = %7.0e (%s)\n', ...
438 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
439 messageInfo{1},normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
440 messageInfo{4},messageInfo{5},tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2}, ...
441 messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
442 else % Caller is lsqnonlin/lsqcurvefit
443 %messageInfo = {'lsqnonlin',norm(deltaX),tolXChoice,tolX}
444 basicMsg = sprintf(['\n%sLocal minimum possible%s.\n\n',...
445 '%s stopped because the %ssize of the current step%s is less than\n',...
446 'the %s value of the %sstep size tolerance%s.\n\n%s\n'], ...
447 lsqPossMinTag,endLinkTag,messageInfo{1},normStepTag,endLinkTag,messageInfo{3}, ...
448 stepSizeTolTag,endLinkTag,detailTag);
449
450 detailedMsg = sprintf(['\nOptimization stopped because the %snorm of the current step%s', ...
451 ', %e,\nis less than %soptions.TolX%s = %e.\n\n', ...
452 'Optimization Metric Options\n', ...
453 'norm(step) = %10.2e TolX = %7.0e (%s)\n'], ...
454 normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
455 messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
456 end
457 case 'trustnleqn'
458 %messageInfo = {'fsolve',norm(deltaX),tolXChoice,max(tolX^2,eps),F'*F,tolFunChoice,sqrt(tolFun)}
459 % Create messages for display
460 basicMsg = sprintf(['\n%sEquation solved, fsolve stalled%s.\n\n',...
461 '%s stopped because the relative %ssize of the current step%s is less than ',...
462 'the\n%s value of the %sstep size tolerance%s squared and the vector of ', ...
463 'function values\nis near zero as measured by the %s value of the ',...
464 '%sfunction tolerance%s.\n\n%s\n'],eqSolveSingTag,endLinkTag,messageInfo{1}, ...
465 normStepTag,endLinkTag,messageInfo{3},stepSizeTolTag,endLinkTag,messageInfo{6}, ...
466 funcTolFsolveTag,endLinkTag,detailTag);
467
468 detailedMsg = sprintf(['\n%s stopped because the relative %snorm of the current step%s, ', ...
469 '%e, is less than \nmax(%soptions.TolX%s^2,eps) = %e. The sum of squared function ',...
470 'values, r = %e,\nis less than sqrt(%soptions.TolFun%s) = %e.\n\n', ...
471 'Optimization Metric Options\n', ...
472 'relative norm(step) = %10.2e max(TolX^2,eps) = %7.0e (%s)\n', ...
473 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
474 messageInfo{1},normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
475 messageInfo{4},messageInfo{5},tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2}, ...
476 messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
477 end % switch(caller) - exitflag 2
478 case undefGrads % exitflag = 26
479 switch caller
480 case 'sqpLineSearch'
481 % messageInfo = {'fmincon',maxConstr,tolConChoice,tolCon}
482 basicMsg = sprintf(['\n%sLocal minimum possible. Constraints satisfied%s.\n\n',...
483 '%s stopped because the %sgradient calculation is undefined%s. Constraints\n',...
484 'are satisfied to within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
485 conPossMinTag,endLinkTag,messageInfo{1},gradCalcFailTag,endLinkTag,messageInfo{3}, ...
486 constrTolTag,endLinkTag,detailTag);
487
488 detailedMsg = sprintf(['\nOptimization stopped because the objective or constraint ',...
489 '%sgradient calculation is undefined%s\nat the current point and the relative maximum ', ...
490 'constraint violation, %e, is \nless than %soptions.TolCon%s = %e.\n\n', ...
491 'Optimization Metric Options\n', ...
492 'relative max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'], ...
493 gradCalcFailTag,endLinkTag,messageInfo{2},tolConTag,endLinkTag,messageInfo{4}, ...
494 messageInfo{2},messageInfo{4},messageInfo{3});
495
496 case 'levenbergMarquardt'
497 basicMsg = sprintf(['\n%sLocal minimum possible%s.\n\n',...
498 '%s stopped because the %sJacobian calculation is undefined%s.\n'], ...
499 lsqPossMinTag,endLinkTag,messageInfo{1},jacCalcFailTag,endLinkTag);
500
501 % Force detailedExitMsg to false so that basicMsg will
502 % always print, since there is no detailedMsg.
503 detailedExitMsg = false;
504 end
505 case deltaF % exitflag = 3
506 switch caller
507 case {'sfminbx','sfminle'}
508 % messageInfo = {'fmincon',relnorm(deltaF),tolFunChoice,tolFun}
509 basicMsg = sprintf(['\n%sLocal minimum possible%s.\n\n',...
510 '%s stopped because the final change in function value relative to \nits ', ...
511 'initial value is less than the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
512 uncPossMinTag,endLinkTag,messageInfo{1},messageInfo{3},functionTolTag,endLinkTag,detailTag);
513
514 detailedMsg = sprintf(['\nOptimization stopped because the relative objective ', ...
515 'function value is changing\nby less than %soptions.TolFun%s = %e.\n\n', ...
516 'Optimization Metric Options\n', ...
517 'relative change objective = %10.2e TolFun = %7.0e (%s)\n'], ...
518 tolFunTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
519 case {'snls','levenbergMarquardt'}
520 if strcmpi(messageInfo{1},'fsolve')
521 % messageInfo = {'fsolve',relnorm(deltaF),tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(tolFun)}
522 basicMsg = sprintf(['\n%sEquation solved, inaccuracy possible%s.\n\n',...
523 'The vector of function values is near zero, as measured by the %s value\nof the ',...
524 '%sfunction tolerance%s. However, the %slast step was ineffective%s.\n\n%s\n'],eqSolvedInaccTag, ...
525 endLinkTag,messageInfo{6},funcTolFsolveTag,endLinkTag,ineffectiveStepTag,endLinkTag,detailTag);
526
527 detailedMsg = sprintf(['\n%s stopped because the sum of squared function values, r, changed ', ...
528 'by %e\nrelative to its initial value; this is less than %soptions.TolFun%s = %e.\n', ...
529 'r = %e, is less than sqrt(options.TolFun) = %e.\n\n' ...
530 'Optimization Metric Options\n', ...
531 'relative change r = %10.2e TolFun = %7.0e (%s)\n', ...
532 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'],messageInfo{1}, ...
533 messageInfo{2},tolFunFsolveTag,endLinkTag,messageInfo{4},messageInfo{5},messageInfo{7}, ...
534 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
535 else % caller is lsqnonlin/lsqcuvefit
536 % messageInfo = {'lsqnonlin',relnorm(deltaF),tolFunChoice,tolFun}
537 basicMsg = sprintf(['\n%sLocal minimum possible%s.\n\n',...
538 '%s stopped because the final change in the sum of squares relative to \nits ', ...
539 'initial value is less than the %s value of the %sfunction tolerance%s.\n\n%s\n'], ...
540 lsqPossMinTag,endLinkTag,messageInfo{1},messageInfo{3},functionTolLSQTag,endLinkTag,detailTag);
541
542 detailedMsg = sprintf(['\nOptimization stopped because the relative sum of squares (r) is ', ...
543 'changing\nby less than %soptions.TolFun%s = %e.\n\n', ...
544 'Optimization Metric Options\n', ...
545 'relative change r = %10.2e TolFun = %7.0e (%s)\n'], ...
546 tolFunLSQTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
547 end
548 case 'trustnleqn'
549 % messageInfo = {'fsolve',relnorm(deltaF),tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(tolFun)}
550 basicMsg = sprintf(['\n%sEquation solved, inaccuracy possible%s.\n\n',...
551 'The vector of function values is near zero, as measured by the %s value\nof the ',...
552 '%sfunction tolerance%s. However, the %slast step was ineffective%s.\n\n%s\n'],eqSolvedInaccTag, ...
553 endLinkTag,messageInfo{6},funcTolFsolveTag,endLinkTag,ineffectiveStepTag,endLinkTag,detailTag);
554
555 detailedMsg = sprintf(['\n%s stopped because the sum of squared function values, r, changed ', ...
556 'by %e\nrelative to its initial value; this is less than max(%soptions.TolFun%s^2,eps) ', ...
557 '= %e.\nr = %e, is less than sqrt(options.TolFun) = %e.\n\n' ...
558 'Optimization Metric Options\n', ...
559 'relative change r = %10.2e max(TolFun^2,eps) = %7.0e (%s)\n', ...
560 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
561 messageInfo{1},messageInfo{2},tolFunFsolveTag,endLinkTag,messageInfo{4},messageInfo{5},messageInfo{7}, ...
562 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
563 end % switch(caller) - exitflag 3
564 case smallSearchDir % exitflag = 4
565 switch caller
566 case 'nlconst'
567 % messageInfo = {'fmincon',normSD,tolXchoice,tolX,maxConstr,tolConChoice,tolCon}
568 basicMsg = sprintf(['\n%sLocal minimum possible. Constraints satisfied%s.\n\n',...
569 '%s stopped because the %ssize of the current search direction%s is less than\n',...
570 'twice the %s value of the %sstep size tolerance%s and constraints are \nsatisfied to ',...
571 'within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
572 conPossMinTag,endLinkTag,messageInfo{1},normSearchDirTag,endLinkTag,messageInfo{3}, ...
573 stepSizeTolTag,endLinkTag,messageInfo{6},constrTolTag,endLinkTag,detailTag);
574
575 detailedMsg = sprintf(['\nOptimization stopped because the %snorm of the current search direction%s', ...
576 ', %e,\nis less than 2*%soptions.TolX%s = %e, and the maximum ', ...
577 'constraint \nviolation, %e, is less than %soptions.TolCon%s = %e.\n\n', ...
578 'Optimization Metric Options\n', ...
579 'norm(search direction) = %10.2e TolX = %7.0e (%s)\n' ,...
580 'max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],normSearchDirTag, ...
581 endLinkTag,messageInfo{2},tolXTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag, ...
582 messageInfo{7},messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
583
584 case 'levenbergMarquardt'
585 if strcmpi(messageInfo{1},'fsolve')
586 %messageInfo = {'fsolve',norm(deltaX),tolXChoice,tolX,F'*F,tolFunChoice,sqrt(tolFun)}
587 basicMsg = sprintf(['\n%sEquation solved, fsolve stalled%s.\n\n',...
588 '%s stopped because the relative %ssize of the current step%s is less than ',...
589 'the\n%s value of the %sstep size tolerance%s and the vector of ', ...
590 'function values\nis near zero as measured by the %s value of the ',...
591 '%sfunction tolerance%s.\n\n%s\n'],eqSolveSingTag,endLinkTag,messageInfo{1}, ...
592 normStepTag,endLinkTag,messageInfo{3},stepSizeTolTag,endLinkTag,messageInfo{6}, ...
593 funcTolFsolveTag,endLinkTag,detailTag);
594
595 detailedMsg = sprintf(['\n%s stopped because the relative %snorm of the current step%s, ', ...
596 '%e, is less\nthan %soptions.TolX%s = %e. The sum of squared function values, ',...
597 'r = %e,\nis less than sqrt(%soptions.TolFun%s) = %e.\n\n', ...
598 'Optimization Metric Options\n', ...
599 'relative norm(step) = %10.2e TolX = %7.0e (%s)\n', ...
600 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
601 messageInfo{1},normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
602 messageInfo{4},messageInfo{5},tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2}, ...
603 messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
604 else % Caller is lsqnonlin/lsqcurvefit
605 %messageInfo = {'lsqnonlin',norm(deltaX),tolXChoice,tolX}
606 % Create messages for display
607 basicMsg = sprintf(['\n%sLocal minimum possible%s.\n\n',...
608 '%s stopped because the relative %ssize of the current step%s is less than\n',...
609 'the %s value of the %sstep size tolerance%s.\n\n%s\n'], ...
610 lsqPossMinTag,endLinkTag,messageInfo{1},normStepTag,endLinkTag,messageInfo{3}, ...
611 stepSizeTolTag,endLinkTag,detailTag);
612
613 detailedMsg = sprintf(['\nOptimization stopped because the relative %snorm of the current step%s', ...
614 ', %e,\nis less than %soptions.TolX%s = %e.\n\n', ...
615 'Optimization Metric Options\n', ...
616 'relative norm(step) = %10.2e TolX = %7.0e (%s)\n'], ...
617 normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
618 messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
619 end
620 end
621 case dirDeriv % exitflag = 5
622 switch caller
623 case 'nlconst'
624 % Create messages for display
625 % messageInfo = {'fmincon',abs(alpha*dirDeriv),tolFunChoice,tolFun,maxConstr,tolConChoice,tolCon}
626 basicMsg = sprintf(['\n%sLocal minimum possible. Constraints satisfied%s.\n\n',...
627 '%s stopped because the %spredicted change in the objective function%s\n', ...
628 'is less than the %s value of the %sfunction tolerance%s and constraints \nare satisfied to ',...
629 'within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
630 conPossMinTag,endLinkTag,messageInfo{1},dirDerivTag,endLinkTag,messageInfo{3}, ...
631 functionTolTag,endLinkTag,messageInfo{6},constrTolTag,endLinkTag,detailTag);
632
633 detailedMsg = sprintf(['\nOptimization stopped because the %spredicted change in the objective function%s', ...
634 ',\n%e, is less than %soptions.TolFun%s = %e, and the maximum constraint\n', ...
635 'violation, %e, is less than %soptions.TolCon%s = %e.\n\n', ...
636 'Optimization Metric Options\n',...
637 'abs(steplength*directional derivative) = %10.2e TolFun = %7.0e (%s)\n' ,...
638 'max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],dirDerivTag, ...
639 endLinkTag,messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag, ...
640 messageInfo{7},messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
641 case 'fminusub'
642 %messageInfo = {'fminunc',abs(alpha*dirDeriv),tolFunChoice,tolFun}
643 % Create messages for display
644 basicMsg = sprintf(['\n%sLocal minimum possible%s.\n\n',...
645 '%s stopped because it cannot decrease the objective function\n', ...
646 'along the current %ssearch direction%s.\n\n%s\n'], ...
647 uncPossMinTag,endLinkTag,messageInfo{1},searchDirTag,endLinkTag,detailTag);
648
649 detailedMsg = sprintf(['\nOptimization stopped because the objective function cannot be decreased ', ...
650 'in the \ncurrent %ssearch direction%s. Either the %spredicted change in the objective function%s,\n', ...
651 'or the %sline search interval%s is less than eps.'],searchDirTag,endLinkTag, ...
652 dirDerivTag,endLinkTag,lsIntervalTag,endLinkTag);
653 end % switch caller - exitflag 5
654 case maxFunEval % exitflag = 0
655 % messageInfo = {'topLevelFcn',[],maxFunEvalsChoice,maxFunEvals}
656 basicMsg = sprintf(['\n%sSolver stopped prematurely%s.\n\n', ...
657 '%s stopped because it exceeded the function evaluation limit,\n',...
658 '%soptions.MaxFunEvals%s = %i (the %s value).\n'],prematureStopTag,endLinkTag,messageInfo{1},...
659 maxFunEvalTag,endLinkTag,messageInfo{4},messageInfo{3});
660 % Force detailedExitMsg to false so that basicMsg will always print, since there is no detailedMsg.
661 detailedExitMsg = false;
662 case maxIter % exitflag = 10
663 % messageInfo = {'topLevelFcn',[],maxIterChoice,maxIter}
664 basicMsg = sprintf(['\n%sSolver stopped prematurely%s.\n\n', ...
665 '%s stopped because it exceeded the iteration limit,\n',...
666 '%soptions.MaxIter%s = %i (the %s value).\n'],prematureStopTag,endLinkTag,messageInfo{1}, ...
667 maxIterTag,endLinkTag,messageInfo{4},messageInfo{3});
668 % Force detailedExitMsg to false so that basicMsg will always print, since there is no detailedMsg.
669 detailedExitMsg = false;
670 case outputFcn % exitflag = -1
671 % messageInfo = {'topLevelFcn'}
672 basicMsg = sprintf('\n%s stopped by the %soutput or plot function%s.\n',...
673 messageInfo{1},outputFcnTag,endLinkTag);
674 % Force detailedExitMsg to false so that basicMsg will always print, since there is no detailedMsg.
675 detailedExitMsg = false;
676 case infeasSQP % exitflag = -20
677 % Create messages for display - caller is nlconst
678 % messageInfo = {'fmincon',[],maxSQPIterChoice,maxSQPIter,maxConstr,tolConChoice,tolCon}
679 basicMsg = sprintf(['\n%sNo feasible solution found%s.\n\n',...
680 '%s stopped because it is unable to find a point locally that satisfies\n',...
681 'the constraints within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
682 inFeasTag,endLinkTag,messageInfo{1},messageInfo{6},constrTolTag,endLinkTag,detailTag);
683
684 detailedMsg = sprintf(['\nOptimization stopped because the maximum number of iterations ', ...
685 'of the\nquadratic programming subproblem, %soptions.MaxSQPIter%s = %i, was\nreached ', ...
686 'but the maximum constraint violation, %e, exceeds\n%soptions.TolCon%s = %e.\n\n', ...
687 'Optimization Metric Options\n', ...
688 'max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'], ...
689 maxSQPIterTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag, ...
690 messageInfo{7},messageInfo{5},messageInfo{7},messageInfo{6});
691 case infeasStationary % exitflag = -21
692 switch caller
693 case 'barrier'
694 % messageInfo = {'fmincon',maxConstr,tolConChoice,tolCon}
695 basicMsg = sprintf(['\n%sNo feasible solution found%s.\n\n',...
696 '%s stopped because it is unable to find a point locally that satisfies\n',...
697 'the constraints within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
698 inFeasTag,endLinkTag,messageInfo{1},messageInfo{3},constrTolTag,endLinkTag,detailTag);
699
700 detailedMsg = sprintf(['\nOptimization stopped because the %sconstraint violations ', ...
701 'are locally stationary%s \nbut the relative maximum constraint violation,', ...
702 ' %e, exceeds\n%soptions.TolCon%s = %e.\n\n', ...
703 'Optimization Metric Options\n', ...
704 'relative max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],stationaryConstrTag,endLinkTag, ...
705 messageInfo{2},tolConTag,endLinkTag,messageInfo{4},messageInfo{2},messageInfo{4},messageInfo{3});
706 case {'snls','trustnleqn'}
707 % messageInfo = {'fsolve',gradNorm,tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(tolFun)}
708 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
709 '%s stopped because the %sproblem appears regular%s as measured by the %sgradient%s,\n', ...
710 'but the vector of function values is not near zero as measured by the\n',...
711 '%s value of the %sfunction tolerance%s.\n\n%s\n'], ...
712 noEqSolTag,endLinkTag,messageInfo{1},regProbTag,endLinkTag,lsqGradSizeTag,endLinkTag, ...
713 messageInfo{3},funcTolFsolveTag,endLinkTag,detailTag);
714
715 detailedMsg = sprintf(['\n%s stopped because the sum of squared function values, r, has ', ...
716 'gradient with\nrelative norm %e; this is less than %soptions.TolFun%s = %e.\nHowever, ',...
717 'r = %e, exceeds sqrt(options.TolFun) = %e.\n\n', ...
718 'Optimization Metric Options\n', ...
719 'norm(grad r) = %10.2e TolFun = %7.0e (%s)\n', ...
720 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
721 messageInfo{1},messageInfo{2},tolFunFsolveTag,endLinkTag,messageInfo{4},messageInfo{5},messageInfo{7}, ...
722 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
723 case 'levenbergMarquardt'
724 % messageInfo = {'fsolve',firstOrdOpt,tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(TolFun)}
725 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
726 '%s stopped because the %sproblem appears regular%s as measured by the %sgradient%s,\n', ...
727 'but the vector of function values is not near zero as measured by the\n',...
728 '%s value of the %sfunction tolerance%s.\n\n%s\n'], ...
729 noEqSolTag,endLinkTag,messageInfo{1},regProbTag,endLinkTag,lsqGradSizeTag,endLinkTag, ...
730 messageInfo{3},funcTolFsolveTag,endLinkTag,detailTag);
731
732 detailedMsg = sprintf(['\n%s stopped because the sum of squared function values, r, has ', ...
733 'gradient with\nrelative norm %e; this is less than 1e-4*%soptions.TolFun%s = %e.\nHowever, ',...
734 'r = %e, exceeds sqrt(options.TolFun) = %e.\n\n', ...
735 'Optimization Metric Options\n', ...
736 'norm(grad r) = %10.2e 1e-4*TolFun = %7.0e (%s)\n', ...
737 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
738 messageInfo{1},messageInfo{2},tolFunFsolveTag,endLinkTag,messageInfo{4},messageInfo{5},messageInfo{7}, ...
739 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
740 case 'ipqpcommon'
741 % messageInfo = {'quadprog',maxConstr,tolConChoice,tolCon,totalRelErr,'',[]}
742 basicMsg = sprintf(['\n%sNo feasible solution found%s.\n\n',...
743 '%s stopped because it was unable to find a point that satisfies\n',...
744 'the constraints within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
745 inFeasTag,endLinkTag,messageInfo{1},messageInfo{3},constrTolTag,endLinkTag,detailTag);
746
747 detailedMsg = sprintf(['\nOptimization stopped because the %stotal relative error%s, ', ...
748 '%e has grown\nto more than 1e5 times its minimum value during the iterations.\n',], ...
749 totalRelErrorTag,endLinkTag,messageInfo{2});
750 case 'presolve'
751 % messageInfo = {'topLevelFcn',0,tolConChoice,0}
752 basicMsg = sprintf(['\n%sThe problem is infeasible%s.\n\n', ...
753 'During %spresolve%s, %s found the constraints to be inconsistent \nto within ', ...
754 'the %sconstraint tolerance%s.\n'], ...
755 presolveInfeasTag,endLinkTag,presolveTag,endLinkTag,messageInfo{1},constrTolTag,endLinkTag);
756 % Force detailedExitMsg to false so that basicMsg will always print, since there is no detailedMsg.
757 detailedExitMsg = false;
758 end % switch caller - exitflag -21
759 case infeasDeltaX % exitflag = -22
760 switch caller
761 case {'barrier','sqpLineSearch'}
762 % messageInfo = {'fmincon',normStep,tolXchoice,tolX,maxConstr,tolConChoice,tolCon}
763 basicMsg = sprintf(['\n%sNo feasible solution found%s.\n\n',...
764 '%s stopped because the %ssize of the current step%s is less than\n',...
765 'the %s value of the %sstep size tolerance%s but constraints are not\nsatisfied to ',...
766 'within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
767 inFeasTag,endLinkTag,messageInfo{1},conNormStepTag,endLinkTag,messageInfo{3}, ...
768 stepSizeTolTag,endLinkTag,messageInfo{6},constrTolTag,endLinkTag,detailTag);
769
770 detailedMsg = sprintf(['\nOptimization stopped because the %srelative changes in all elements of x%s', ...
771 ' are\nless than %soptions.TolX%s = %e, but the relative maximum constraint\n', ...
772 'violation, %e, exceeds %soptions.TolCon%s = %e.\n\n', ...
773 'Optimization Metric Options\n', ...
774 'max(abs(delta_x./x)) = %10.2e TolX = %7.0e (%s)\n' ,...
775 'relative max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],conNormStepTag,endLinkTag, ...
776 tolXTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag,messageInfo{7}, ...
777 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
778 case 'trustnleqn'
779 %messageInfo = {'fsolve',norm(deltaX),tolXChoice,max(tolX^2,eps),F'*F,tolFunChoice,sqrt(tolFun)}
780 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
781 '%s stopped because the relative %ssize of the current step%s is less than ',...
782 'the\n%s value of the %sstep size tolerance%s squared, but the vector of ', ...
783 'function values\nis not near zero as measured by the %s value of the ',...
784 '%sfunction tolerance%s.\n\n%s\n'],noEqSolTag,endLinkTag,messageInfo{1}, ...
785 normStepTag,endLinkTag,messageInfo{3},stepSizeTolTag,endLinkTag,messageInfo{6}, ...
786 funcTolFsolveTag,endLinkTag,detailTag);
787
788 detailedMsg = sprintf(['\n%s stopped because the relative %snorm of the current step%s, %e, ', ...
789 'is less than\nmax(%soptions.TolX%s^2,eps) = %e. However, the sum of squared function ',...
790 'values,\nr = %e, exceeds sqrt(%soptions.TolFun%s) = %e.\n\n', ...
791 'Optimization Metric Options\n', ...
792 'relative norm(step) = %10.2e max(TolX^2,eps) = %7.0e (%s)\n', ...
793 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
794 messageInfo{1},normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
795 messageInfo{4},messageInfo{5},tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2},messageInfo{4}, ...
796 messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
797 case 'snls'
798 %messageInfo = {'fsolve',norm(deltaX),tolXChoice,tolX,F'*F,tolFunChoice,sqrt(tolFun)}
799 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
800 '%s stopped because the %ssize of the current step%s is less than ',...
801 'the\n%s value of the %sstep size tolerance%s, but the vector of ', ...
802 'function values\nis not near zero as measured by the %s value of the ',...
803 '%sfunction tolerance%s.\n\n%s\n'],noEqSolTag,endLinkTag,messageInfo{1}, ...
804 normStepTag,endLinkTag,messageInfo{3},stepSizeTolTag,endLinkTag,messageInfo{6}, ...
805 funcTolFsolveTag,endLinkTag,detailTag);
806
807 detailedMsg = sprintf(['\n%s stopped because the %snorm of the current step%s, %e, ', ...
808 'is less than\n%soptions.TolX%s = %e. However, the sum of squared function values',...
809 ', r = %e,\nexceeds sqrt(%soptions.TolFun%s) = %e.\n\n', ...
810 'Optimization Metric Options\n', ...
811 'norm(step) = %10.2e TolX = %7.0e (%s)\n', ...
812 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
813 messageInfo{1},normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
814 messageInfo{4},messageInfo{5},tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2}, ...
815 messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
816 end % switch caller - exitflag -22
817 case infeasDeltaF % exitflag = -23
818 switch caller
819 case 'trustnleqn'
820 % messageInfo = {'fsolve',relnorm(deltaF),tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(tolFun)}
821 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
822 '%s stopped because the %slast step was ineffective%s. However, the vector of function\nvalues ', ...
823 'is not near zero, as measured by the %s value of the %sfunction tolerance%s. \n\n%s\n'],noEqSolTag,...
824 endLinkTag,messageInfo{1},ineffectiveStepTag,endLinkTag,messageInfo{6},funcTolFsolveTag,endLinkTag,detailTag);
825
826 detailedMsg = sprintf(['\n%s stopped because the sum of squared function values, r, changed ', ...
827 'by %e\nrelative to its initial value; this is less than max(%soptions.TolFun%s^2,eps) = %e.\n', ...
828 'However, r = %e, exceeds sqrt(options.TolFun) = %e.\n\n' ...
829 'Optimization Metric Options\n', ...
830 'relative change r = %10.2e max(TolFun^2,eps) = %7.0e (%s)\n', ...
831 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'],messageInfo{1}, ...
832 messageInfo{2},tolFunFsolveTag,endLinkTag,messageInfo{4},messageInfo{5},messageInfo{7},messageInfo{2}, ...
833 messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
834 case {'snls','levenbergMarquardt'}
835 % messageInfo = {'fsolve',relnorm(deltaF),tolFunChoice,tolFun,F'*F,tolFunChoice,sqrt(tolFun)}
836 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
837 '%s stopped because the %slast step was ineffective%s. However, the vector of function\nvalues ', ...
838 'is not near zero, as measured by the %s value of the %sfunction tolerance%s. \n\n%s\n'],noEqSolTag,...
839 endLinkTag,messageInfo{1},ineffectiveStepTag,endLinkTag,messageInfo{6},funcTolFsolveTag,endLinkTag,detailTag);
840
841 detailedMsg = sprintf(['\n%s stopped because the sum of squared function values, r, changed ', ...
842 'by %e\nrelative to its initial value; this is less than %soptions.TolFun%s = %e.\n', ...
843 'However, r = %e, exceeds sqrt(options.TolFun) = %e.\n\n' ...
844 'Optimization Metric Options\n', ...
845 'relative change r = %10.2e TolFun = %7.0e (%s)\n', ...
846 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'],messageInfo{1}, ...
847 messageInfo{2},tolFunFsolveTag,endLinkTag,messageInfo{4},messageInfo{5},messageInfo{7},messageInfo{2}, ...
848 messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
849 end % switch caller - exitflag -23
850 case infeasSmallSearchDir % exitflag = -24
851 switch caller
852 case 'nlconst'
853 % messageInfo = {'fmincon',normSD,tolXchoice,tolX,maxConstr,tolConChoice,tolCon}
854 basicMsg = sprintf(['\n%sNo feasible solution found%s.\n\n',...
855 '%s stopped because the %ssize of the current search direction%s is less than\n',...
856 'twice the %s value of the %sstep size tolerance%s but constraints are not \nsatisfied to ',...
857 'within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
858 inFeasTag,endLinkTag,messageInfo{1},normSearchDirTag,endLinkTag,messageInfo{3}, ...
859 stepSizeTolTag,endLinkTag,messageInfo{6},constrTolTag,endLinkTag,detailTag);
860
861 detailedMsg = sprintf(['\nOptimization stopped because the %snorm of the current search direction%s ', ...
862 ', %e,\nis less than 2*%soptions.TolX%s = %e, but the maximum constraint\n', ...
863 'violation, %e, exceeds %soptions.TolCon%s = %e.\n\n', ...
864 'Optimization Metric Options\n', ...
865 'norm(search direction) = %10.2e TolX = %7.0e (%s)\n' ,...
866 'max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],normSearchDirTag,endLinkTag, ...
867 messageInfo{2},tolXTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag,messageInfo{7}, ...
868 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
869 case 'levenbergMarquardt'
870 %messageInfo = {'fsolve',norm(deltaX),tolXChoice,tolX,F'*F,tolFunChoice,sqrt(tolFun)}
871 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
872 '%s stopped because the relative %ssize of the current step%s is less than ',...
873 'the\n%s value of the %sstep size tolerance%s, but the vector of ', ...
874 'function values\nis not near zero as measured by the %s value of the ',...
875 '%sfunction tolerance%s.\n\n%s\n'],noEqSolTag,endLinkTag,messageInfo{1}, ...
876 normStepTag,endLinkTag,messageInfo{3},stepSizeTolTag,endLinkTag,messageInfo{6}, ...
877 funcTolFsolveTag,endLinkTag,detailTag);
878
879 detailedMsg = sprintf(['\n%s stopped because the relative %snorm of the current step%s', ...
880 ', %e, is less than\n%soptions.TolX%s = %e. However, the sum of squared function values',...
881 ', r = %e,\nis less than sqrt(%soptions.TolFun%s) = %e.\n\n', ...
882 'Optimization Metric Options\n', ...
883 'relative norm(step) = %10.2e TolX = %7.0e (%s)\n', ...
884 'r = %10.2e sqrt(TolFun) = %8.1e (%s)\n'], ...
885 messageInfo{1},normStepTag,endLinkTag,messageInfo{2},tolXTag,endLinkTag, ...
886 messageInfo{4},messageInfo{5},tolFunFsolveTag,endLinkTag,messageInfo{7},messageInfo{2},messageInfo{4}, ...
887 messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
888 end % switch caller - exitflag -24
889 case infeasDirDeriv % exitflag = -25
890 % Create messages for display - caller is nlconst
891 % messageInfo = {'fmincon',alpha*dirDeriv,tolXchoice,tolX,maxConstr,tolConChoice,tolCon}
892 basicMsg = sprintf(['\n%sNo feasible solution found%s.\n\n',...
893 '%s stopped because the %spredicted change in the objective function%s\n', ...
894 'is less than the %s value of the %sfunction tolerance%s but constraints \nare not satisfied to ',...
895 'within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
896 inFeasTag,endLinkTag,messageInfo{1},dirDerivTag,endLinkTag,messageInfo{3}, ...
897 functionTolTag,endLinkTag,messageInfo{6},constrTolTag,endLinkTag,detailTag);
898
899 detailedMsg = sprintf(['\nOptimization stopped because the %spredicted change in the objective function%s', ...
900 ', %e,\nis less than %soptions.TolFun%s = %e, but the maximum constraint ', ...
901 'violation,\n%e, exceeds %soptions.TolCon%s = %e.\n\n', ...
902 'Optimization Metric Options\n',...
903 'abs(steplength*directional derivative) = %10.2e TolFun = %7.0e (%s)\n' ,...
904 'max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],dirDerivTag,endLinkTag, ...
905 messageInfo{2},tolFunTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag,messageInfo{7},...
906 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
907 case infeasUndefGrads % exitflag = -26
908 % Only caller is sqpLineSearch, do not break out by algorithm
909 % messageInfo = {'fmincon',maxConstr,tolConChoice,tolCon}
910 basicMsg = sprintf(['\n%sNo feasible solution found%s.\n\n',...
911 '%s stopped because the %sgradient calculation is undefined%s. Constraints\n',...
912 'are not satisfied to within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
913 inFeasTag,endLinkTag,messageInfo{1},gradCalcFailTag,endLinkTag,messageInfo{3}, ...
914 constrTolTag,endLinkTag,detailTag);
915
916 detailedMsg = sprintf(['\nOptimization stopped because the objective or constraint ',...
917 '%sgradient calculation is undefined%s\nat the current point and the relative maximum ', ...
918 'constraint violation, %e,\nexceeds %soptions.TolCon%s = %e.\n\n', ...
919 'Optimization Metric Options\n', ...
920 'relative max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'], ...
921 gradCalcFailTag,endLinkTag,messageInfo{2},tolConTag,endLinkTag,messageInfo{4}, ...
922 messageInfo{2},messageInfo{4},messageInfo{3});
923 case unbounded % exitflag = -3
924 switch caller
925 case {'barrier','sqpLineSearch'}
926 % messageInfo = {'fmincon',fval,objLimitChoice,objLimit,maxConstr,tolConChoice,tolCon}
927 basicMsg = sprintf(['\n%sProblem appears unbounded%s.\n\n',...
928 '%s stopped because the objective function value is less than\n', ...
929 'the %s value of the %sobjective function limit%s and constraints \nare satisfied to ',...
930 'within the %s value of the %sconstraint tolerance%s.\n\n%s\n'], ...
931 unboundedTag,endLinkTag,messageInfo{1},messageInfo{3},objectiveLimitTag, ...
932 endLinkTag,messageInfo{6},constrTolTag,endLinkTag,detailTag);
933
934 detailedMsg = sprintf(['\n%s stopped because the objective function value, %e, is less than\n', ...
935 '%soptions.ObjectiveLimit%s = %e, and the relative maximum constraint\n', ...
936 'violation, %e, is less than %soptions.TolCon%s = %e.\n\n', ...
937 'Optimization Metric Options\n', ...
938 'objective value = %10.2e ObjectiveLimit = %7.0e (%s)\n', ...
939 'relative max(constraint violation) = %10.2e TolCon = %7.0e (%s)\n'],messageInfo{1},messageInfo{2}, ...
940 objectiveLimitTag,endLinkTag,messageInfo{4},messageInfo{5},tolConTag,endLinkTag,messageInfo{7}, ...
941 messageInfo{2},messageInfo{4},messageInfo{3},messageInfo{5},messageInfo{7},messageInfo{6});
942 case 'trustnleqn'
943 % messageInfo = {'fsolve',trRadius,'',2*eps}
944 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
945 '%s stopped because the problem %sappears to be locally singular%s.\n\n%s\n'],noEqSolTrrTag,...
946 endLinkTag,messageInfo{1},localSingularTag,endLinkTag,detailTag);
947
948 detailedMsg = sprintf(['\n%s stopped because the %strust-region radius%s, %e, is less than 2*eps.\n\n' ...
949 'Optimization Metric Options\n', ...
950 'trust-region radius = %10.2e 2*eps = %8.1e\n'],messageInfo{1}, ...
951 trRadiusTag,endLinkTag,messageInfo{2},messageInfo{2},messageInfo{4});
952 case 'levenbergMarquardt'
953 % messageInfo = {'fsolve',LMparam,'',0}
954 basicMsg = sprintf(['\n%sNo solution found%s.\n\n',...
955 '%s stopped because the problem %sappears to be locally singular%s.\n\n%s\n'],noEqSolTrrTag,...
956 endLinkTag,messageInfo{1},localSingularLSQTag,endLinkTag,detailTag);
957
958 detailedMsg = sprintf('\n%s stopped because the %sregularization parameter%s, %e, exceeds 1e16.\n', ...
959 messageInfo{1},regParamTag,endLinkTag,messageInfo{2});
960 case 'presolve'
961 % messageInfo = {'topLevelFcn'}
962 basicMsg = sprintf(['\n%sThe problem is unbounded%s.\n\n', ...
963 'During %spresolve%s, %s found a feasible direction that causes the objective \nto decrease without ', ...
964 'bound.\n'],presolveUnboundTag,endLinkTag,presolveTag,endLinkTag,messageInfo{1});
965 % Force detailedExitMsg to false so that basicMsg will always print, since there is no detailedMsg.
966 detailedExitMsg = false;
967 end
968 case nonconvex % exitflag = -6
969 % Caller is ipqpcommon
970 % Create messages for display: messageInfo = {}
971 basicMsg = sprintf('\n%sThe problem is non-convex%s.\n',nonconvexTag,endLinkTag);
972 % Force detailedExitMsg to false so that basicMsg will always print, since there is no detailedMsg.
973 detailedExitMsg = false;
974 otherwise
975 basicMsg = sprintf('\nOptimization stopped.\nUnrecognized exitflag input to createExitMsg.\n');
976 end
977
860 978 if dispMsg % Display Message
979 if ~detailedExitMsg
980 disp(basicMsg)
981 else
982 disp(detailedMsg)
983 end
984 end
985
986 % Create message for output structure.
860 987 if nargout > 0
988 % Remove html tags from basicMsg
0.02 860 989 basicMsg = regexprep(basicMsg,'</?(\w+).*?>','');
990 % Remove "stopping criteria details" from basicMsg
0.03 860 991 basicMsg = strtrim(regexprep(basicMsg,'<(\w+).*?>',''));
0.01 860 992 detailedMsg = regexprep(detailedMsg,'</?(\w+).*?>',''); % Remove html tags from detailedMsg
993 % Only separate messages by 'Stopping criteria details:' if there is a detailedMsg
0.01 860 994 if ~isempty(detailedMsg)
0.02 860 995 details = sprintf('\n\nStopping criteria details:\n');
996 else
997 details = '';
998 end
0.03 860 999 outputMsg = sprintf('%s%s%s',basicMsg,details,detailedMsg); % Concatenate strings
860 1000 outputMsg = strtrim(outputMsg); % Trim trailing newline chars and assign to output
860 1001 end