0001 function [TorF, vstr, rdate] = have_feature_glpk()
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 TorF = 0;
0019 vstr = '';
0020 rdate = '';
0021 if exist('glpk','file') == 3
0022 TorF = 1;
0023 str = evalc('glpk');
0024 pat = 'GLPK: GNU Linear Programming Kit \[v([^\s,\]]+).*\]';
0025 [s,e,tE,m,t] = regexp(str, pat);
0026 if ~isempty(t)
0027 vstr = t{1}{1};
0028 end
0029 pat = 'Built ([^\],])+';
0030 [s,e,tE,m,t] = regexp(str, pat);
0031 if ~isempty(t)
0032 rdate = datestr(t{1}{1}, 'dd-mmm-yyyy');
0033 end
0034 elseif exist('glpk','file') == 2
0035 if exist('__glpk__','file') == 3
0036 TorF = 1;
0037 if have_feature('evalc')
0038 str = evalc('glpk(1, 1, 1, 1, 1, ''U'', ''C'', -1, struct(''msglev'', 3))');
0039 pat = 'GLPK Simplex Optimizer, v([^\s,]+)';
0040 [s,e,tE,m,t] = regexp(str, pat);
0041 if ~isempty(t)
0042 vstr = t{1}{1};
0043 end
0044 end
0045 elseif exist('glpkcc','file') == 3
0046 TorF = 1;
0047 str = evalc('glpk');
0048 pat = 'GLPK Matlab interface\. Version: ([^\s,]+)';
0049 [s,e,tE,m,t] = regexp(str, pat);
0050 if ~isempty(t)
0051 vstr = t{1}{1};
0052 end
0053 end
0054 end