HAVE_FEATURE_KNITROMATLAB Detect availability/version info for KNITROMATLAB Feature detection function implementing 'knitromatlab' tag for HAVE_FEATURE to detect availability/version of Artelys Knitro 9.0.0 and later. See also HAVE_FEATURE, HAVE_FEATURE_KNITRO, KNITROMATLAB.
0001 function [TorF, vstr, rdate] = have_feature_knitromatlab() 0002 %HAVE_FEATURE_KNITROMATLAB Detect availability/version info for KNITROMATLAB 0003 % 0004 % Feature detection function implementing 'knitromatlab' tag for HAVE_FEATURE 0005 % to detect availability/version of Artelys Knitro 9.0.0 and later. 0006 % 0007 % See also HAVE_FEATURE, HAVE_FEATURE_KNITRO, KNITROMATLAB. 0008 0009 % MP-Opt-Model 0010 % Copyright (c) 2004-2020, Power Systems Engineering Research Center (PSERC) 0011 % by Ray Zimmerman, PSERC Cornell 0012 % 0013 % This file is part of MP-Opt-Model. 0014 % Covered by the 3-clause BSD License (see LICENSE file for details). 0015 % See https://github.com/MATPOWER/mp-opt-model for more info. 0016 0017 %% knitromatlab for Knitro 9.0 or greater 0018 TorF = exist('knitromatlab', 'file'); 0019 vstr = ''; 0020 rdate = ''; 0021 if TorF 0022 try 0023 str = evalc(['[x fval] = knitromatlab(@(x)1,1);']); 0024 end 0025 TorF = exist('fval', 'var') && fval == 1; 0026 if TorF 0027 pat = 'KNITRO ([^\s]+)\n|Knitro ([^\s]+)\n'; 0028 [s,e,tE,m,t] = regexp(str, pat); 0029 if ~isempty(t) 0030 vstr = t{1}{1}; 0031 end 0032 end 0033 end