% Method of optiGTest class L. LAURENT -- 15/04/2018 -- luc.laurent@lecnam.net
0001 %% Method of optiGTest class 0002 % L. LAURENT -- 15/04/2018 -- luc.laurent@lecnam.net 0003 0004 % sources available here: 0005 % https://bitbucket.org/luclaurent/optigtest/ 0006 % https://github.com/luclaurent/optigtest/ 0007 0008 % optiGTest - set of testing functions A toolbox to easy manipulate functions. 0009 % Copyright (C) 2018 Luc LAURENT <luc.laurent@lecnam.net> 0010 % 0011 % This program is free software: you can redistribute it and/or modify 0012 % it under the terms of the GNU General Public License as published by 0013 % the Free Software Foundation, either version 3 of the License, or 0014 % (at your option) any later version. 0015 % 0016 % This program is distributed in the hope that it will be useful, 0017 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0019 % GNU General Public License for more details. 0020 % 0021 % You should have received a copy of the GNU General Public License 0022 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0023 0024 %% check function by checking minimum and gradients 0025 % INPUTS: 0026 % - pbName: name of the problems [optional] 0027 % - statusPause: allow to pause the process [optional] 0028 % OUTPUT: 0029 % - isOk: status of the checking 0030 0031 function isOk=checkPb(obj,pbName,statusPause) 0032 if nargin==1; pbName=obj.namePb;end 0033 if nargin<3; statusPause=false;end 0034 %check minimum 0035 obj.namePb=pbName; 0036 %check minimum on objective function 0037 isOk=obj.checkFunObj; 0038 %check gradients 0039 % of objective function(s) 0040 for itF=1:obj.nbObj 0041 funCheck=@(X)obj.evalObj(X,itF); 0042 isOkCurrent=obj.checkGradFun(funCheck,obj.funObj{itF}); 0043 isOk=isOk&&isOkCurrent; 0044 end 0045 % of constraint function(s) 0046 if obj.nbCons>0 0047 for itF=1:obj.nbCons 0048 funCheck=@(X)obj.evalCons(X,itF); 0049 isOkCurrent=obj.checkGradFun(funCheck,obj.funCons{itF}); 0050 isOk=isOk&&isOkCurrent; 0051 end 0052 end 0053 if ~isOk&&statusPause 0054 pause 0055 end 0056 end