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