HAVE_FEATURE_CPLEX Detect availability/version info for CPLEX Feature detection function implementing 'cplex' tag for HAVE_FEATURE to detect availability/version of CPLEX (IBM ILOG CPLEX Optimizer). See also HAVE_FEATURE, QPS_MASTER, MIQPS_MASTER, CPLEX, CPLEXQP, CPLEXLP.
0001 function [TorF, vstr, rdate] = have_feature_cplex() 0002 %HAVE_FEATURE_CPLEX Detect availability/version info for CPLEX 0003 % 0004 % Feature detection function implementing 'cplex' tag for HAVE_FEATURE 0005 % to detect availability/version of CPLEX (IBM ILOG CPLEX Optimizer). 0006 % 0007 % See also HAVE_FEATURE, QPS_MASTER, MIQPS_MASTER, CPLEX, CPLEXQP, CPLEXLP. 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 TorF = 0; 0018 vstr = ''; 0019 rdate = ''; 0020 if exist('cplexqp', 'file') 0021 %% it's installed, but we need to check for MEX for this arch 0022 p = which('cplexqp'); %% get the path 0023 len = length(p) - length('cplexqp.p'); 0024 w = what(p(1:len)); %% look for mex files on the path 0025 for k = 1:length(w.mex) 0026 if regexp(w.mex{k}, 'cplexlink[^\.]*'); 0027 TorF = 1; 0028 break; 0029 end 0030 end 0031 end 0032 if TorF 0033 try 0034 cplex = Cplex('null'); 0035 vstr = cplex.getVersion; 0036 catch 0037 TorF = 0; 0038 end 0039 end