Home > matpower7.1 > mp-opt-model > lib > have_feature_glpk.m

have_feature_glpk

PURPOSE ^

HAVE_FEATURE_GLPK Detect availability/version info for GLPK

SYNOPSIS ^

function [TorF, vstr, rdate] = have_feature_glpk()

DESCRIPTION ^

HAVE_FEATURE_GLPK  Detect availability/version info for GLPK

   Feature detection function implementing 'glpk' tag for HAVE_FEATURE
   to detect availability/version of GLPK (GNU Linear Programming Kit),
   LP/MILP solver.

   See also HAVE_FEATURE, QPS_MASTER, MIQPS_MASTER, GLPK.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [TorF, vstr, rdate] = have_feature_glpk()
0002 %HAVE_FEATURE_GLPK  Detect availability/version info for GLPK
0003 %
0004 %   Feature detection function implementing 'glpk' tag for HAVE_FEATURE
0005 %   to detect availability/version of GLPK (GNU Linear Programming Kit),
0006 %   LP/MILP solver.
0007 %
0008 %   See also HAVE_FEATURE, QPS_MASTER, MIQPS_MASTER, GLPK.
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 TorF = 0;
0019 vstr = '';
0020 rdate = '';
0021 if exist('glpk','file') == 3    %% Windows OPTI install (no glpk.m)
0022     TorF = 1;
0023     str = evalc('glpk');
0024     pat = 'GLPK: GNU Linear Programming Kit \[v([^\s,\]]+).*\]';  %% OPTI, Giorgetti/Currie
0025     [s,e,tE,m,t] = regexp(str, pat);
0026     if ~isempty(t)
0027         vstr = t{1}{1};
0028     end
0029     pat = 'Built ([^\],])+';  %% OPTI, Giorgetti/Currie
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    %% others have glpk.m and ...
0035     if exist('__glpk__','file') == 3    %% octave __glpk__ MEX
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  %% MATLAB glpkcc MEX
0046         TorF = 1;
0047         str = evalc('glpk');
0048         pat = 'GLPK Matlab interface\. Version: ([^\s,]+)';     %% glpkccm, Giorgetti/Klitgord
0049         [s,e,tE,m,t] = regexp(str, pat);
0050         if ~isempty(t)
0051             vstr = t{1}{1};
0052         end
0053     end
0054 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005